Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. OpenHardware.io
  3. 💬 Multi-Sensor: Temp/Humidity/PIR/ Leak/Magnet/Light/Accel

💬 Multi-Sensor: Temp/Humidity/PIR/ Leak/Magnet/Light/Accel

Scheduled Pinned Locked Moved OpenHardware.io
117 Posts 18 Posters 23.9k Views 17 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • NeverDieN Offline
    NeverDieN Offline
    NeverDie
    Hero Member
    wrote on last edited by NeverDie
    #89

    I finally received the MAX44009 board:
    https://www.aliexpress.com/item/Smart-Electronics-5PCS-lot-MAX44009-ambient-light-sensor-is-the-I2C-digital-output-module-development-board/32767691971.html?spm=a2g0s.9042311.0.0.sOFetX
    I'm able to read lux values by pulling A0 on the board to Vcc and using this library and sketch:
    https://github.com/dantudose/MAX44009/blob/master/Example/Luxmeter.ino
    Very easy. :)

    Nca78N 1 Reply Last reply
    1
    • NeverDieN NeverDie

      I finally received the MAX44009 board:
      https://www.aliexpress.com/item/Smart-Electronics-5PCS-lot-MAX44009-ambient-light-sensor-is-the-I2C-digital-output-module-development-board/32767691971.html?spm=a2g0s.9042311.0.0.sOFetX
      I'm able to read lux values by pulling A0 on the board to Vcc and using this library and sketch:
      https://github.com/dantudose/MAX44009/blob/master/Example/Luxmeter.ino
      Very easy. :)

      Nca78N Offline
      Nca78N Offline
      Nca78
      Hardware Contributor
      wrote on last edited by
      #90

      @neverdie you don't even need to bother with a lib, just 2 functions are enough.
      https://blog.kkessler.com/tag/max44009/

      1 Reply Last reply
      0
      • scalzS Offline
        scalzS Offline
        scalz
        Hardware Contributor
        wrote on last edited by scalz
        #91

        even if it's two functions only, if i need to reuse them in others sketch, I would prefer them in a lib. Only "one line" (include) in the sketch compared to x lines ;)

        1 Reply Last reply
        2
        • Nca78N Nca78

          @neverdie this looks pretty small for a buzzer already. Sorry no idea about smaller ones, but please post your results I'm interested :)

          NeverDieN Offline
          NeverDieN Offline
          NeverDie
          Hero Member
          wrote on last edited by NeverDie
          #92

          @nca78 said in 💬 Multi-Sensor: Temp/Humidity/PIR/ Leak/Magnet/Light/Accel:

          @neverdie this looks pretty small for a buzzer already. Sorry no idea about smaller ones, but please post your results I'm interested :)

          Received it today. Putting just DC across it produces no sound at all. Driving it with a pulsed voltage (say 10K hertz at 50% duty cycle) directly from an arduino pin produces sound, but at very low volume. Since it draws 220ma with a straight 3v DC voltage across it, I'm guessing a current more like that is what it will take to get it to produce louder sound, but that's only just a wild guess.

          NeverDieN 1 Reply Last reply
          0
          • NeverDieN NeverDie

            @nca78 said in 💬 Multi-Sensor: Temp/Humidity/PIR/ Leak/Magnet/Light/Accel:

            @neverdie this looks pretty small for a buzzer already. Sorry no idea about smaller ones, but please post your results I'm interested :)

            Received it today. Putting just DC across it produces no sound at all. Driving it with a pulsed voltage (say 10K hertz at 50% duty cycle) directly from an arduino pin produces sound, but at very low volume. Since it draws 220ma with a straight 3v DC voltage across it, I'm guessing a current more like that is what it will take to get it to produce louder sound, but that's only just a wild guess.

            NeverDieN Offline
            NeverDieN Offline
            NeverDie
            Hero Member
            wrote on last edited by NeverDie
            #93

            I tried driving it from a load switch controlled by the arduino, and that helped increase the volume somewhat.

            Doing that, and using this script, I think it will be audible if you're in the same room as it (and if the room is otherwise quiet).

            long lastMicrosTime=0;  //timestamp in microseconds
            
            void setup() {
              pinMode(10,OUTPUT);
            }
            
            void loop() {
              for (int x=0;x<1000;x++) {
                digitalWrite(10,HIGH);
                lastMicrosTime=micros();
                while ((micros()-lastMicrosTime)<300) {} //wait until 300 microseconds have passed
                digitalWrite(10,LOW);
                while ((micros()-lastMicrosTime)<x) {} //wait until another x microseconds have passed
              }
            }
            

            So, if you were to use it as a locator beacon attached to something you wanted to find, it might be good enough for that.

            Nca78N 1 Reply Last reply
            1
            • NeverDieN NeverDie

              I tried driving it from a load switch controlled by the arduino, and that helped increase the volume somewhat.

              Doing that, and using this script, I think it will be audible if you're in the same room as it (and if the room is otherwise quiet).

              long lastMicrosTime=0;  //timestamp in microseconds
              
              void setup() {
                pinMode(10,OUTPUT);
              }
              
              void loop() {
                for (int x=0;x<1000;x++) {
                  digitalWrite(10,HIGH);
                  lastMicrosTime=micros();
                  while ((micros()-lastMicrosTime)<300) {} //wait until 300 microseconds have passed
                  digitalWrite(10,LOW);
                  while ((micros()-lastMicrosTime)<x) {} //wait until another x microseconds have passed
                }
              }
              

              So, if you were to use it as a locator beacon attached to something you wanted to find, it might be good enough for that.

              Nca78N Offline
              Nca78N Offline
              Nca78
              Hardware Contributor
              wrote on last edited by
              #94

              @neverdie said in 💬 Multi-Sensor: Temp/Humidity/PIR/ Leak/Magnet/Light/Accel:

              Doing that, and using this script, I think it will be audible if you're in the same room as it (and if the room is otherwise quiet).

              Guess this is not made for Vietnam then :D
              I supposed this type of buzzer is made more for user feedback for things like touch sensors, than for raising alert.

              NeverDieN 1 Reply Last reply
              1
              • Nca78N Nca78

                @neverdie said in 💬 Multi-Sensor: Temp/Humidity/PIR/ Leak/Magnet/Light/Accel:

                Doing that, and using this script, I think it will be audible if you're in the same room as it (and if the room is otherwise quiet).

                Guess this is not made for Vietnam then :D
                I supposed this type of buzzer is made more for user feedback for things like touch sensors, than for raising alert.

                NeverDieN Offline
                NeverDieN Offline
                NeverDie
                Hero Member
                wrote on last edited by NeverDie
                #95

                @nca78 What strange is that if I cup my hand over it, it actually becomes louder. Not sure what's up with that. So, maybe I'm just not driving it right.

                Nca78N 1 Reply Last reply
                0
                • NeverDieN Offline
                  NeverDieN Offline
                  NeverDie
                  Hero Member
                  wrote on last edited by
                  #96

                  Here's the latest version of the PIR sensor embodiment:
                  0_1514738791273_compactPIR.jpg
                  It runs from two CR2032's.

                  Very compact! :)

                  ahmedadelhosniA 1 Reply Last reply
                  3
                  • NeverDieN NeverDie

                    Here's the latest version of the PIR sensor embodiment:
                    0_1514738791273_compactPIR.jpg
                    It runs from two CR2032's.

                    Very compact! :)

                    ahmedadelhosniA Offline
                    ahmedadelhosniA Offline
                    ahmedadelhosni
                    wrote on last edited by
                    #97

                    @neverdie how do you connect thr two Cr batteries ?

                    Another question ? I read in another comments that you need 100-200 uF capacitor so that the radio can work since thr CR battery wont be strong enough. Did you add this ?

                    NeverDieN 1 Reply Last reply
                    0
                    • ahmedadelhosniA ahmedadelhosni

                      @neverdie how do you connect thr two Cr batteries ?

                      Another question ? I read in another comments that you need 100-200 uF capacitor so that the radio can work since thr CR battery wont be strong enough. Did you add this ?

                      NeverDieN Offline
                      NeverDieN Offline
                      NeverDie
                      Hero Member
                      wrote on last edited by
                      #98

                      @ahmedadelhosni said in 💬 Multi-Sensor: Temp/Humidity/PIR/ Leak/Magnet/Light/Accel:

                      how do you connect thr two Cr batteries ?

                      This was recently discussed in the Bluetooth action! thread.

                      1 Reply Last reply
                      0
                      • NeverDieN NeverDie

                        @nca78 What strange is that if I cup my hand over it, it actually becomes louder. Not sure what's up with that. So, maybe I'm just not driving it right.

                        Nca78N Offline
                        Nca78N Offline
                        Nca78
                        Hardware Contributor
                        wrote on last edited by
                        #99

                        @neverdie said in 💬 Multi-Sensor: Temp/Humidity/PIR/ Leak/Magnet/Light/Accel:

                        @nca78 What strange is that if I cup my hand over it, it actually becomes louder. Not sure what's up with that. So, maybe I'm just not driving it right.

                        Isn't that the principle for most speakers, using a sound box ?

                        1 Reply Last reply
                        1
                        • T Offline
                          T Offline
                          Tiwo85
                          wrote on last edited by
                          #100

                          Wich board do you use in arduino? I can only use Waveshare BLE4.0. At Generic etc. It seems, that the oscillator doesn't work probably.

                          NeverDieN 1 Reply Last reply
                          0
                          • T Tiwo85

                            Wich board do you use in arduino? I can only use Waveshare BLE4.0. At Generic etc. It seems, that the oscillator doesn't work probably.

                            NeverDieN Offline
                            NeverDieN Offline
                            NeverDie
                            Hero Member
                            wrote on last edited by
                            #101

                            @tiwo85 said in 💬 Multi-Sensor: Temp/Humidity/PIR/ Leak/Magnet/Light/Accel:

                            Wich board do you use in arduino? I

                            Not sure what you're asking.

                            T 1 Reply Last reply
                            0
                            • NeverDieN NeverDie

                              @tiwo85 said in 💬 Multi-Sensor: Temp/Humidity/PIR/ Leak/Magnet/Light/Accel:

                              Wich board do you use in arduino? I

                              Not sure what you're asking.

                              T Offline
                              T Offline
                              Tiwo85
                              wrote on last edited by Tiwo85
                              #102

                              @neverdie I mean this:
                              0_1517742775930_ArduinoBoard.png
                              When I use Generic nRF51 or something else, the onboard LED turns on and doesn't turns off. When I use Waveshare BLE400 the sketch works as usual

                              NeverDieN 1 Reply Last reply
                              0
                              • T Tiwo85

                                @neverdie I mean this:
                                0_1517742775930_ArduinoBoard.png
                                When I use Generic nRF51 or something else, the onboard LED turns on and doesn't turns off. When I use Waveshare BLE400 the sketch works as usual

                                NeverDieN Offline
                                NeverDieN Offline
                                NeverDie
                                Hero Member
                                wrote on last edited by NeverDie
                                #103

                                @tiwo85
                                I use this:
                                0_1517752283964_arduino_board_type.png
                                You download it from @d00616 on github.

                                1 Reply Last reply
                                1
                                • NeverDieN NeverDie

                                  For PIR capability, the multi-sensor can simply plug into this PIR module: https://www.openhardware.io/view/420/AM612-Passive-Infrared-Sensor-Breakout-Board

                                  T Offline
                                  T Offline
                                  Tiwo85
                                  wrote on last edited by
                                  #104

                                  @neverdie do you have a working example sketch. I try the example sketch from the 10years pir sensor an d modify a little bit, but it doesn't work. The sketch awake every 5 minutes and send the state from the pir and that's it.

                                  NeverDieN 1 Reply Last reply
                                  0
                                  • T Tiwo85

                                    @neverdie do you have a working example sketch. I try the example sketch from the 10years pir sensor an d modify a little bit, but it doesn't work. The sketch awake every 5 minutes and send the state from the pir and that's it.

                                    NeverDieN Offline
                                    NeverDieN Offline
                                    NeverDie
                                    Hero Member
                                    wrote on last edited by
                                    #105

                                    @tiwo85
                                    https://www.openhardware.io/view/510/Multi-Sensor-TempHumidityPIR-LeakMagnetLightAccel#tabs-source

                                    T 1 Reply Last reply
                                    0
                                    • NeverDieN NeverDie

                                      @tiwo85
                                      https://www.openhardware.io/view/510/Multi-Sensor-TempHumidityPIR-LeakMagnetLightAccel#tabs-source

                                      T Offline
                                      T Offline
                                      Tiwo85
                                      wrote on last edited by Tiwo85
                                      #106

                                      @neverdie thank you. I made this sketch work. But I need to get work interrupts. I use your code for the am612, but it doesn't work. Then I use the example from Redbear labs "Example interrupted" to turn on the led when p0.02 is high. I use Mysensors library and set My Core only. Then it runs. But when I try to integrate Mysensors routines "presentation" etc. And disable "my core only" , then the interrupt doesn't work.

                                      // SUMMARY: This demo sketch runs on the AM612 PIR v607 PCBto transmit battery voltage (heartbeat) and motion detections to a MySensors gateway using MySensors protocols.
                                      
                                      // Note: because this is a passive node, node ID must be set manually to a unique sensor node ID:
                                      #define MY_NODE_ID 143  // Passive mode requires static node ID
                                      
                                      //#define MY_CORE_ONLY
                                      
                                      #define MY_PASSIVE_NODE
                                      
                                      #define MY_RADIO_NRF5_ESB
                                      
                                      
                                      
                                      /**
                                       * The MySensors Arduino library handles the wireless radio link and protocol
                                       * between your home built sensors/actuators and HA controller of choice.
                                       * The sensors forms a self healing radio network with optional repeaters. Each
                                       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                       * network topology allowing messages to be routed to nodes.
                                       *
                                       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                       * Copyright (C) 2013-2017 Sensnology AB
                                       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                       *
                                       * Documentation: http://www.mysensors.org
                                       * Support Forum: http://forum.mysensors.org
                                       *
                                       * This program is free software; you can redistribute it and/or
                                       * modify it under the terms of the GNU General Public License
                                       * version 2 as published by the Free Software Foundation.
                                       *
                                       *******************************
                                       *
                                       * REVISION HISTORY
                                       * Version 1.0 - tekka
                                       *
                                       * DESCRIPTION
                                       * Passive node example: This is a passive & independent reporting node
                                       *
                                       */
                                      
                                      // This demo sketch also draws from the MySensor's example MotionSensor sketch.
                                      
                                      #define IS_NRF51  //true iff the target is an nRF51.  If an nRF52, then comment this line out!
                                      
                                      #define SHORT_WAIT 50
                                      
                                      // Enable debug prints
                                      //#define MY_DEBUG
                                      
                                      #define PIN_LED1                (4) // 4 is sensor LED , 1 is onboard LED
                                      #define LED_BUILTIN          PIN_LED1
                                      
                                      #define PIN_SENSOR1                (10) // 2 is waterleak, 10 is PIR , 3 is Pin5/INT
                                      #define SENSOR1         PIN_SENSOR1
                                      
                                      
                                      #include <MySensors.h>
                                      
                                      //#define CHILD_ID_TEMP 1  //definitions contributed by smilvert (see above credit)
                                      #define CHILD_ID 2   // Id of the motion sensor child
                                      #define ID_S_MULTIMETER        28
                                      
                                      // Initialize general message
                                      //MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
                                      MyMessage msg(CHILD_ID, V_TRIPPED);
                                      MyMessage msg_S_MULTIMETER_V_VOLTAGE(ID_S_MULTIMETER,V_VOLTAGE);
                                      
                                      float batteryVoltage=0;  
                                      
                                      /*#include "nrf_temp.h"
                                      
                                      float read_temp_value(){
                                      
                                        float temp=0;
                                      
                                        // Starten Sie die Temperaturmessung. 
                                        NRF_TEMP->TASKS_START = 1; 
                                      
                                        // Warten Sie, bis die Temperaturmessung abgeschlossen ist.
                                        while (NRF_TEMP->EVENTS_DATARDY == 0){
                                          // Do nothing.}
                                        }
                                        NRF_TEMP->EVENTS_DATARDY = 0;
                                      
                                        // Lesen Sie den Temperaturwert vom Sensor ab
                                        // Die Genauigkeit beträgt 0,25 Grad Celsius <=> 1 Einheit = 0,25 Grad Celsius
                                        // Teile durch 4, um einen C-Wert zu erhalten
                                        
                                        temp = ((float)nrf_temp_read() / 4.);
                                      
                                        // Hoàn thành quá trình đo. 
                                        NRF_TEMP->TASKS_STOP = 1; 
                                      
                                        return temp;
                                      }*/
                                      
                                      void blinkityBlink(uint8_t repetitions) {
                                        for (int x=0;x<repetitions;x++) {
                                          digitalWrite(LED_BUILTIN ,HIGH);
                                          delay(20);
                                          digitalWrite(LED_BUILTIN ,LOW);
                                          delay(100);
                                          digitalWrite(LED_BUILTIN ,HIGH);
                                          delay(20);
                                          digitalWrite(LED_BUILTIN ,LOW);    
                                          if (x<(repetitions-1)) {  //skip waiting at the end of the final repetition
                                            delay(500);
                                          }
                                        }
                                      }
                                      
                                      void handle_irq3(void) {
                                        if(HIGH == digitalRead(SENSOR1)){
                                            digitalWrite(LED_BUILTIN , HIGH);
                                            send(msg.set("1"));  // motion detected
                                        }
                                        else
                                        {
                                            digitalWrite(LED_BUILTIN , LOW);
                                             send(msg.set("0"));  // send all-clear to prepare for future detections
                                        }
                                      }
                                      
                                      void presentation()
                                      {
                                        // Send the sketch version information to the gateway and Controller
                                        sendSketchInfo("NRF Motion Sensor", "1.0");
                                         // wait(SHORT_WAIT);
                                         // present(CHILD_ID_TEMP, S_TEMP,"Onboard Temperature");
                                        wait(SHORT_WAIT);
                                        // Register all sensors to gw (they will be created as child devices)
                                        present(CHILD_ID, S_MOTION,"Motion Sensor");
                                      
                                        wait(SHORT_WAIT);
                                        
                                        present(ID_S_MULTIMETER,S_MULTIMETER,"Electric Station");
                                        wait(SHORT_WAIT);
                                      }
                                      
                                      
                                      void setup() {
                                          // put your setup code here, to run once:
                                          //hwInit();
                                        //hwPinMode(LED_BUILTIN,OUTPUT_D0H1);
                                        //hwPinMode(SENSOR1,INPUT);
                                      
                                         //nrf_temp_init();
                                        pinMode(LED_BUILTIN , OUTPUT);
                                          digitalWrite(LED_BUILTIN , LOW);
                                        blinkityBlink(5);  //signify power-up and start of operations
                                      
                                        // set interrupts, pin default is HIGH
                                        attachInterrupt(SENSOR1, handle_irq3, CHANGE);
                                      }
                                      
                                      void loop() {
                                        // put your main code here, to run repeatedly:
                                        //send(msgTemp.set(read_temp_value(),2));
                                        batteryVoltage=((float)hwCPUVoltage())/1000.0;  //take voltage measurement after transmission to hopefully measure lowest voltage that occurs. 
                                        send(msg_S_MULTIMETER_V_VOLTAGE.set(batteryVoltage,3));  //send battery voltage with 3 decimal places
                                        sleep(900000); //sleep 15 min
                                      }
                                      
                                      
                                      NeverDieN 1 Reply Last reply
                                      0
                                      • T Tiwo85

                                        @neverdie thank you. I made this sketch work. But I need to get work interrupts. I use your code for the am612, but it doesn't work. Then I use the example from Redbear labs "Example interrupted" to turn on the led when p0.02 is high. I use Mysensors library and set My Core only. Then it runs. But when I try to integrate Mysensors routines "presentation" etc. And disable "my core only" , then the interrupt doesn't work.

                                        // SUMMARY: This demo sketch runs on the AM612 PIR v607 PCBto transmit battery voltage (heartbeat) and motion detections to a MySensors gateway using MySensors protocols.
                                        
                                        // Note: because this is a passive node, node ID must be set manually to a unique sensor node ID:
                                        #define MY_NODE_ID 143  // Passive mode requires static node ID
                                        
                                        //#define MY_CORE_ONLY
                                        
                                        #define MY_PASSIVE_NODE
                                        
                                        #define MY_RADIO_NRF5_ESB
                                        
                                        
                                        
                                        /**
                                         * The MySensors Arduino library handles the wireless radio link and protocol
                                         * between your home built sensors/actuators and HA controller of choice.
                                         * The sensors forms a self healing radio network with optional repeaters. Each
                                         * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                         * network topology allowing messages to be routed to nodes.
                                         *
                                         * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                         * Copyright (C) 2013-2017 Sensnology AB
                                         * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                         *
                                         * Documentation: http://www.mysensors.org
                                         * Support Forum: http://forum.mysensors.org
                                         *
                                         * This program is free software; you can redistribute it and/or
                                         * modify it under the terms of the GNU General Public License
                                         * version 2 as published by the Free Software Foundation.
                                         *
                                         *******************************
                                         *
                                         * REVISION HISTORY
                                         * Version 1.0 - tekka
                                         *
                                         * DESCRIPTION
                                         * Passive node example: This is a passive & independent reporting node
                                         *
                                         */
                                        
                                        // This demo sketch also draws from the MySensor's example MotionSensor sketch.
                                        
                                        #define IS_NRF51  //true iff the target is an nRF51.  If an nRF52, then comment this line out!
                                        
                                        #define SHORT_WAIT 50
                                        
                                        // Enable debug prints
                                        //#define MY_DEBUG
                                        
                                        #define PIN_LED1                (4) // 4 is sensor LED , 1 is onboard LED
                                        #define LED_BUILTIN          PIN_LED1
                                        
                                        #define PIN_SENSOR1                (10) // 2 is waterleak, 10 is PIR , 3 is Pin5/INT
                                        #define SENSOR1         PIN_SENSOR1
                                        
                                        
                                        #include <MySensors.h>
                                        
                                        //#define CHILD_ID_TEMP 1  //definitions contributed by smilvert (see above credit)
                                        #define CHILD_ID 2   // Id of the motion sensor child
                                        #define ID_S_MULTIMETER        28
                                        
                                        // Initialize general message
                                        //MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
                                        MyMessage msg(CHILD_ID, V_TRIPPED);
                                        MyMessage msg_S_MULTIMETER_V_VOLTAGE(ID_S_MULTIMETER,V_VOLTAGE);
                                        
                                        float batteryVoltage=0;  
                                        
                                        /*#include "nrf_temp.h"
                                        
                                        float read_temp_value(){
                                        
                                          float temp=0;
                                        
                                          // Starten Sie die Temperaturmessung. 
                                          NRF_TEMP->TASKS_START = 1; 
                                        
                                          // Warten Sie, bis die Temperaturmessung abgeschlossen ist.
                                          while (NRF_TEMP->EVENTS_DATARDY == 0){
                                            // Do nothing.}
                                          }
                                          NRF_TEMP->EVENTS_DATARDY = 0;
                                        
                                          // Lesen Sie den Temperaturwert vom Sensor ab
                                          // Die Genauigkeit beträgt 0,25 Grad Celsius <=> 1 Einheit = 0,25 Grad Celsius
                                          // Teile durch 4, um einen C-Wert zu erhalten
                                          
                                          temp = ((float)nrf_temp_read() / 4.);
                                        
                                          // Hoàn thành quá trình đo. 
                                          NRF_TEMP->TASKS_STOP = 1; 
                                        
                                          return temp;
                                        }*/
                                        
                                        void blinkityBlink(uint8_t repetitions) {
                                          for (int x=0;x<repetitions;x++) {
                                            digitalWrite(LED_BUILTIN ,HIGH);
                                            delay(20);
                                            digitalWrite(LED_BUILTIN ,LOW);
                                            delay(100);
                                            digitalWrite(LED_BUILTIN ,HIGH);
                                            delay(20);
                                            digitalWrite(LED_BUILTIN ,LOW);    
                                            if (x<(repetitions-1)) {  //skip waiting at the end of the final repetition
                                              delay(500);
                                            }
                                          }
                                        }
                                        
                                        void handle_irq3(void) {
                                          if(HIGH == digitalRead(SENSOR1)){
                                              digitalWrite(LED_BUILTIN , HIGH);
                                              send(msg.set("1"));  // motion detected
                                          }
                                          else
                                          {
                                              digitalWrite(LED_BUILTIN , LOW);
                                               send(msg.set("0"));  // send all-clear to prepare for future detections
                                          }
                                        }
                                        
                                        void presentation()
                                        {
                                          // Send the sketch version information to the gateway and Controller
                                          sendSketchInfo("NRF Motion Sensor", "1.0");
                                           // wait(SHORT_WAIT);
                                           // present(CHILD_ID_TEMP, S_TEMP,"Onboard Temperature");
                                          wait(SHORT_WAIT);
                                          // Register all sensors to gw (they will be created as child devices)
                                          present(CHILD_ID, S_MOTION,"Motion Sensor");
                                        
                                          wait(SHORT_WAIT);
                                          
                                          present(ID_S_MULTIMETER,S_MULTIMETER,"Electric Station");
                                          wait(SHORT_WAIT);
                                        }
                                        
                                        
                                        void setup() {
                                            // put your setup code here, to run once:
                                            //hwInit();
                                          //hwPinMode(LED_BUILTIN,OUTPUT_D0H1);
                                          //hwPinMode(SENSOR1,INPUT);
                                        
                                           //nrf_temp_init();
                                          pinMode(LED_BUILTIN , OUTPUT);
                                            digitalWrite(LED_BUILTIN , LOW);
                                          blinkityBlink(5);  //signify power-up and start of operations
                                        
                                          // set interrupts, pin default is HIGH
                                          attachInterrupt(SENSOR1, handle_irq3, CHANGE);
                                        }
                                        
                                        void loop() {
                                          // put your main code here, to run repeatedly:
                                          //send(msgTemp.set(read_temp_value(),2));
                                          batteryVoltage=((float)hwCPUVoltage())/1000.0;  //take voltage measurement after transmission to hopefully measure lowest voltage that occurs. 
                                          send(msg_S_MULTIMETER_V_VOLTAGE.set(batteryVoltage,3));  //send battery voltage with 3 decimal places
                                          sleep(900000); //sleep 15 min
                                        }
                                        
                                        
                                        NeverDieN Offline
                                        NeverDieN Offline
                                        NeverDie
                                        Hero Member
                                        wrote on last edited by
                                        #107

                                        @tiwo85 I suggest you start a different thread on your interrupt problems, since that's really a separate issue and not specific to this hardware.

                                        1 Reply Last reply
                                        0
                                        • ehomeE Offline
                                          ehomeE Offline
                                          ehome
                                          wrote on last edited by ehome
                                          #108

                                          Hi,

                                          I like to buy this board and your AM612 breakout pcb through hardware.io.

                                          But first I have few questions unfortunately I couldn't find the answers here in this thread/forum.

                                          1. I assume this board has to be programmed via the 10pin box header. How can I connect it to my computer? I think there is some adapter or similar required? Any selfmade options available? In this thread I saw that it should be possible to program this device via the Arduino IDE?

                                          2. Can I mount the following sensors at the same time without space conflicts:

                                          • Motion PIR (AM612breakout)
                                          • Temp + Humidity
                                          • Light
                                          1. Does this board have some free digital pins for door contact and or relais? (if yes, how many?)

                                          2. (Optional) I think there are no MISO/MOSI/... pins for connecting a RFM69 module?

                                          I don't like to use the battery option. I will power the board via power supply. Can I connect a 5V power supply to the battery pins or what is the best option?

                                          Thanks in advance.

                                          Nca78N 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          12

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular