Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. DavidZH
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by DavidZH

    • RE: pimatic-mysensors controller plugin

      @ricardot said in pimatic-mysensors controller plugin:

      @Dheeraj,

      Do you plan to continue to develop this plugin? I will very pleased to see a mysensors button. Thank you!

      I second this. And also see if we can lose the dependency on serialport 2.0.6 so that we can use Node.js > 4.9.1

      posted in pimatic
      DavidZH
      DavidZH
    • RE: What is the correct way to implement a WDT, for reset on a Sleeping node?

      I have an idea that it still might be a low voltage situation. You say your ultrasonic sensor consumes about 60mA. When your battery voltage is at 3.8V those currents combined with the spikes caused by your radio can pull your battery down to below 3.3V.
      I have an outdoor sensor with a Moteino as board and that uses a MCP1703 as voltage regulator. Same family as the MCP1700-33 of your board. When my supply voltage drops in the direction of the regulated voltage, the MCP faults into some sort of short circuit mode which draws an insane amount of power but does not output any usable voltage. And that will drain your battery quick, fast, in a hurry... (ยฉ๏ธ AvE )

      My sensor is being topped up by a solar panel so theoretically, it should never run out. But theory and real world are NOT the same. Your board is also capable of charging a LiIon battery with both the Vin and 5V connections. The BQ24074 will charge your batt.

      Hope this helps you towards your solution.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: GY type breakout parasitic current draw.

      Thanks Gohan,

      there are a few reasons for me to use the BME outside. The most important: power management (and that explains my conundrum now...).
      The unit contains a light sensor. That basically controls my lighting in the living room. So that needs to measure quite often to be able to control it with any accuracy. I've chosen every minute as a basis. That was also given when I found a sketch with a weather prediction function based on barometric pressure. That sketch needs to read the pressure every minute. That means that the sensor wakes up every minute. Also the radio. That's a huge load. Not really ideal for battery power. But that meant I was able to add the light sensor very easily.
      So now I put them in an outdoor sensor with a solar panel to keep the battery topped up. That still means I have to watch the consumption in sleep. Here in NL we have quit a few overcast days, so the panel will not be able to keep up with the demand on those days.

      The solution in place now is to wake up the sensor 1 second before measurement. Power up the sensors, put the controller and radio back to sleep for one second. Then do the measurement stuff, power down the sensor and I2C bus and go into deep sleep. Average current consumption measured over 4 hrs is now 140uA. Sleep current for the whole system is 36uA. That is including the charger board and Moteino voltage regulator.
      The unit is now up for 3 weeks and the panel keeps up very good. Most of those days were overcast. So when the cold hits next week with clear skies it should be full all the time.

      Battery level is sent every 6 hours. And next to that I have implemented a voltage measurement that signals when the battery is being charged. Energy is coming in, so I am allowed an extra data transfer... ๐Ÿ˜

      Now see if it dies on me again end of november 2019...

      posted in Hardware
      DavidZH
      DavidZH
    • RE: A few random questions (V_tripped vs V_armed)

      Stubborn old me: I've dropped presentation() in my sketches. ๐Ÿ™ƒ

      But that is possible because I do not use discovery in my controller (Pimatic). All my MYS devices in Pimatic are coded so when the sensor starts it immediately shows.
      Main reason: it saves a lot of battery during startup. I've made a watchdog in Pimatic with rules to keep an eye on the device to see if they stop sending.

      posted in Development
      DavidZH
      DavidZH
    • GY type breakout parasitic current draw.

      Right now I'm really banging my head on the wall because I'm lost. I have been using an outdoor sensor unit for the last two years now. The heart is a Moteino on a perfboard carrier. Connected to the Mote are 2 GY boards; a GYBMEP with a Bosch BMP-280 and a GY-49 with a MAX44009 light sensor. The whole device is powered by a 1000mAh LiPo topped up by a small solar panel through a ADA390 solar charger (MCP73871).
      See the picture for a little overview. 0_1545340876187_domotica-011.jpg

      My problem is this: when de Mote sleeps, I can't get the current consumption of the sensor boards anywhere NEAR the specced values (0,65uA for the MA44009 and 0,1uA for the BME280). I end up at about 800uA for the sensor boards alone. So first I used software to switch off the power and I2C bus to the sensors, but that does not work because the MAX44009 needs 800ms to take a measurement, and to wait almost a second every time for the sensor to finish feels kind of stupid. So powered continuously it is. Should not be a problem with the specified power consumption. I already had removed the linear regulators for both boards to be able to use lower voltages.
      So next step; remove the resistors and MOSFets that protect the sensor from overvoltage from the GY boards. A bit of a fiddle because teeny tiny, but I think I succeeded. I dit get a lower current draw, about 300uA. But that's still nowhere near the 1,5uA it should be.

      Does anybody around here have had the same sort of phantom draw? And has that person found a way around it outside of using the bare sensor chip? I simply can't solder that stuff.

      I know there are some other kinks with this board, the regulator on the Mote goes into some sort of avalanche mode when the battery voltage goes down to Vout + Vdropout. It then passes around 90mA all the time. I've had that happening twice now: a year apart to the day. And the charger board also uses 35uA whatever the state. But that should not be a problem during the day.

      I really want to solve this now so that I never have to take a second look to that sensor. Hints are appreciated.

      posted in Hardware
      DavidZH
      DavidZH
    • RE: Complete shutdown of MySensors in code possible ?

      @GertSanders I can't know where you stand pricepoint wise, but this sounds like a 2 MCU project. One to handle the clock functions, and one to communicate with MySensors. Messages between the 2 MCU's over I2C.
      If the link is down, that will only clog the comms MCU.

      posted in Development
      DavidZH
      DavidZH
    • RE: [ SOLVED ] MyS 2.2.0 - MY_DEBUG fails on certain bootloaders

      @GertSanders

      Thank you for calling back! I had the same "issue" my nodes were working so well, no debug was needed, only when I started on a new type I needed to debug some stuff.

      And I had also tried Alex' solution with succes, but have had no time yet to report that.

      I will mark this as solved.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • [ SOLVED ] MyS 2.2.0 - MY_DEBUG fails on certain bootloaders

      I have started to update my nodes to 2.2.0. The gateway went smooth, and the first nodes were no problem either. These were simple sleeping nodes with a timer to send climate data.

      The next batch were my dimmer nodes that failed to work properly because of a button that was not read anymore (actually, after pressing, the release was not detected. The solution was the PINMODE that was declared in the before() was cleared after Presentation() ).

      When I tried to use MY_DEBUG, the compilation failed. That was Arduino IDE 1.6.13, and after I updated to 1.8.5 it ran once. After that it only failed every time.

      When I changed the board definition to Moteino (I use that for my gateway and 1 sensor) it compiled normally. When I changed back to the bootloader I use on the dimmer board it failed again.

      All my boards are basically the same (except for the two mentioned):

      • ATmega328p; internal 8 MHz clock; 2,7V BOD
      • RFM69 radio (some HW, some W)
      • bootloader by GertSanders: 32p TQFP; 2,7V; 8MHz internal; LED D5; 38k4 upload speed

      I tried to compile with other bootloaders, but a mismatch in baudrate prevented me from uploading the sketch.

      Here is the error log from the IDE:

      In file included from /Users/David/Documents/Arduino/libraries/MySensors/MySensors.h:49:0, from /var/folders/zw/bqygd0w11qd6rb620f1pjy_w0000gn/T/arduino_modified_sketch_112637/sketch_feb06a.ino:90:
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp: In function 'void stInitUpdate()':
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:124:45: error: expected ')' before 'PRIu8'
          TRANSPORT_DEBUG(PSTR("TSM:INIT:STATID=%" PRIu8 "\n"),(uint8_t)MY_NODE_ID);
                                                   ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:124:4: note: in expansion of macro 'TRANSPORT_DEBUG'
          TRANSPORT_DEBUG(PSTR("TSM:INIT:STATID=%" PRIu8 "\n"),(uint8_t)MY_NODE_ID);
          ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp: In function 'void stUplinkUpdate()':
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:265:44: error: expected ')' before 'PRIu8'
          TRANSPORT_DEBUG(PSTR("TSM:UPL:DGWC,O=%" PRIu8 ",N=%" PRIu8 "\n"), _transportConfig.distanceGW,
                                                  ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:265:4: note: in expansion of macro 'TRANSPORT_DEBUG'
          TRANSPORT_DEBUG(PSTR("TSM:UPL:DGWC,O=%" PRIu8 ",N=%" PRIu8 "\n"), _transportConfig.distanceGW,
          ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp: In function 'void stReadyTransition()':
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:292:40: error: expected ')' before 'PRIu8'
        TRANSPORT_DEBUG(PSTR("TSM:READY:ID=%" PRIu8 ",PAR=%" PRIu8 ",DIS=%" PRIu8 "\n"),
                                              ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:292:2: note: in expansion of macro 'TRANSPORT_DEBUG'
        TRANSPORT_DEBUG(PSTR("TSM:READY:ID=%" PRIu8 ",PAR=%" PRIu8 ",DIS=%" PRIu8 "\n"),
        ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp: In function 'void stFailureTransition()':
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:342:40: error: expected ')' before 'PRIu8'
        TRANSPORT_DEBUG(PSTR("TSM:FAIL:CNT=%" PRIu8 "\n"),_transportSM.failureCounter);
                                              ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:342:2: note: in expansion of macro 'TRANSPORT_DEBUG'
        TRANSPORT_DEBUG(PSTR("TSM:FAIL:CNT=%" PRIu8 "\n"),_transportSM.failureCounter);
        ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp: In function 'bool transportWaitUntilReady(uint32_t)':
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:449:38: error: expected ')' before 'PRIu32'
        TRANSPORT_DEBUG(PSTR("TSF:WUR:MS=%" PRIu32 "\n"), waitingMS); // timeout
                                            ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:449:2: note: in expansion of macro 'TRANSPORT_DEBUG'
        TRANSPORT_DEBUG(PSTR("TSF:WUR:MS=%" PRIu32 "\n"), waitingMS); // timeout
        ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp: In function 'bool transportCheckUplink(bool)':
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:485:44: error: expected ')' before 'PRIu8'
          TRANSPORT_DEBUG(PSTR("TSF:CKU:DGWC,O=%" PRIu8 ",N=%" PRIu8 "\n"), _transportConfig.distanceGW,
                                                  ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:485:4: note: in expansion of macro 'TRANSPORT_DEBUG'
          TRANSPORT_DEBUG(PSTR("TSF:CKU:DGWC,O=%" PRIu8 ",N=%" PRIu8 "\n"), _transportConfig.distanceGW,
          ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp: In function 'bool transportAssignNodeID(uint8_t)':
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:504:42: error: expected ')' before 'PRIu8'
         TRANSPORT_DEBUG(PSTR("TSF:SID:OK,ID=%" PRIu8 "\n"),newNodeId); // Node ID assigned
                                                ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:504:3: note: in expansion of macro 'TRANSPORT_DEBUG'
         TRANSPORT_DEBUG(PSTR("TSF:SID:OK,ID=%" PRIu8 "\n"),newNodeId); // Node ID assigned
         ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:507:45: error: expected ')' before 'PRIu8'
         TRANSPORT_DEBUG(PSTR("!TSF:SID:FAIL,ID=%" PRIu8 "\n"),newNodeId); // ID is invalid, cannot assign ID
                                                   ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:507:3: note: in expansion of macro 'TRANSPORT_DEBUG'
         TRANSPORT_DEBUG(PSTR("!TSF:SID:FAIL,ID=%" PRIu8 "\n"),newNodeId); // ID is invalid, cannot assign ID
         ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp: In function 'uint8_t transportPingNode(uint8_t)':
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:612:44: error: expected ')' before 'PRIu8'
         TRANSPORT_DEBUG(PSTR("TSF:PNG:SEND,TO=%" PRIu8 "\n"), targetId);
                                                  ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:612:3: note: in expansion of macro 'TRANSPORT_DEBUG'
         TRANSPORT_DEBUG(PSTR("TSF:PNG:SEND,TO=%" PRIu8 "\n"), targetId);
         ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp: In function 'void transportProcessMessage()':
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:660:40: error: expected ')' before 'PRIu8'
        TRANSPORT_DEBUG(PSTR("TSF:MSG:READ,%" PRIu8 "-%" PRIu8 "-%" PRIu8 ",s=%" PRIu8 ",c=%" PRIu8 ",t=%"
                                              ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:660:2: note: in expansion of macro 'TRANSPORT_DEBUG'
        TRANSPORT_DEBUG(PSTR("TSF:MSG:READ,%" PRIu8 "-%" PRIu8 "-%" PRIu8 ",s=%" PRIu8 ",c=%" PRIu8 ",t=%"
        ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:669:41: error: expected ')' before 'PRIu8'
         TRANSPORT_DEBUG(PSTR("!TSF:MSG:LEN,%" PRIu8 "!=%" PRIu8 "\n"), payloadLength,
                                               ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:669:3: note: in expansion of macro 'TRANSPORT_DEBUG'
         TRANSPORT_DEBUG(PSTR("!TSF:MSG:LEN,%" PRIu8 "!=%" PRIu8 "\n"), payloadLength,
         ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:677:42: error: expected ')' before 'PRIu8'
         TRANSPORT_DEBUG(PSTR("!TSF:MSG:PVER,%" PRIu8 "!=%" PRIu8 "\n"), mGetVersion(_msg),
                                                ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:677:3: note: in expansion of macro 'TRANSPORT_DEBUG'
         TRANSPORT_DEBUG(PSTR("!TSF:MSG:PVER,%" PRIu8 "!=%" PRIu8 "\n"), mGetVersion(_msg),
         ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:762:53: error: expected ')' before 'PRIu8'
               TRANSPORT_DEBUG(PSTR("TSF:MSG:FPAR OK,ID=%" PRIu8 ",D=%" PRIu8 "\n"), _transportConfig.parentNodeId,
                                                           ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:762:9: note: in expansion of macro 'TRANSPORT_DEBUG'
               TRANSPORT_DEBUG(PSTR("TSF:MSG:FPAR OK,ID=%" PRIu8 ",D=%" PRIu8 "\n"), _transportConfig.parentNodeId,
               ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:775:49: error: expected ')' before 'PRIu8'
            TRANSPORT_DEBUG(PSTR("TSF:MSG:PINGED,ID=%" PRIu8 ",HP=%" PRIu8 "\n"), sender,
                                                       ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:775:6: note: in expansion of macro 'TRANSPORT_DEBUG'
            TRANSPORT_DEBUG(PSTR("TSF:MSG:PINGED,ID=%" PRIu8 ",HP=%" PRIu8 "\n"), sender,
            ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:789:53: error: expected ')' before 'PRIu8'
             TRANSPORT_DEBUG(PSTR("TSF:MSG:PONG RECV,HP=%" PRIu8 "\n"),
                                                           ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:789:7: note: in expansion of macro 'TRANSPORT_DEBUG'
             TRANSPORT_DEBUG(PSTR("TSF:MSG:PONG RECV,HP=%" PRIu8 "\n"),
             ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp: In function 'bool transportSendWrite(uint8_t, MyMessage&)':
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:1001:42: error: expected ')' before 'PRIu8'
        TRANSPORT_DEBUG(PSTR("%sTSF:MSG:SEND,%" PRIu8 "-%" PRIu8 "-%" PRIu8 "-%" PRIu8 ",s=%" PRIu8 ",c=%"
                                                ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:1001:2: note: in expansion of macro 'TRANSPORT_DEBUG'
        TRANSPORT_DEBUG(PSTR("%sTSF:MSG:SEND,%" PRIu8 "-%" PRIu8 "-%" PRIu8 "-%" PRIu8 ",s=%" PRIu8 ",c=%"
        ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp: In function 'int16_t transportSignalReport(char)':
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:1174:39: error: expected ')' before 'PRIu8'
        TRANSPORT_DEBUG(PSTR("TSF:SIR:CMD=%" PRIu8 ",VAL=%" PRIu16 "\n"), reportCommand, result);
                                             ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MyTransport.cpp:1174:2: note: in expansion of macro 'TRANSPORT_DEBUG'
        TRANSPORT_DEBUG(PSTR("TSF:SIR:CMD=%" PRIu8 ",VAL=%" PRIu16 "\n"), reportCommand, result);
        ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MySensorsCore.cpp: In function 'void _begin()':
      /Users/David/Documents/Arduino/libraries/MySensors/core/MySensorsCore.cpp:171:42: error: expected ')' before 'PRIu8'
        CORE_DEBUG(PSTR("MCO:BGN:INIT OK,TSP=%" PRIu8 "\n"), isTransportReady());
                                                ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MySensorsCore.cpp:171:2: note: in expansion of macro 'CORE_DEBUG'
        CORE_DEBUG(PSTR("MCO:BGN:INIT OK,TSP=%" PRIu8 "\n"), isTransportReady());
        ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MySensorsCore.cpp: In function 'bool _processInternalMessages()':
      /Users/David/Documents/Arduino/libraries/MySensors/core/MySensorsCore.cpp:409:41: error: expected ')' before 'PRIu8'
          CORE_DEBUG(PSTR("MCO:PIM:NODE REG=%" PRIu8 "\n"), _coreConfig.nodeRegistered); // node registration
                                               ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MySensorsCore.cpp:409:4: note: in expansion of macro 'CORE_DEBUG'
          CORE_DEBUG(PSTR("MCO:PIM:NODE REG=%" PRIu8 "\n"), _coreConfig.nodeRegistered); // node registration
          ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MySensorsCore.cpp: In function 'int8_t _sleep(uint32_t, bool, uint8_t, uint8_t, uint8_t, uint8_t)':
      /Users/David/Documents/Arduino/libraries/MySensors/core/MySensorsCore.cpp:542:33: error: expected ')' before 'PRIu32'
        CORE_DEBUG(PSTR("MCO:SLP:MS=%" PRIu32 ",SMS=%" PRIu8 ",I1=%" PRIu8 ",M1=%" PRIu8 ",I2=%" PRIu8
                                       ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MySensorsCore.cpp:542:2: note: in expansion of macro 'CORE_DEBUG'
        CORE_DEBUG(PSTR("MCO:SLP:MS=%" PRIu32 ",SMS=%" PRIu8 ",I1=%" PRIu8 ",M1=%" PRIu8 ",I2=%" PRIu8
        ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MySensorsCore.cpp:572:35: error: expected ')' before 'PRIu32'
          CORE_DEBUG(PSTR("MCO:SLP:MS=%" PRIu32 "\n"), sleepingTimeMS);
                                         ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MySensorsCore.cpp:572:4: note: in expansion of macro 'CORE_DEBUG'
          CORE_DEBUG(PSTR("MCO:SLP:MS=%" PRIu32 "\n"), sleepingTimeMS);
          ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MySensorsCore.cpp:635:34: error: expected ')' before 'PRIi8'
        CORE_DEBUG(PSTR("MCO:SLP:WUP=%" PRIi8 "\n"), result); // sleep wake-up
                                        ^
      /Users/David/Documents/Arduino/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro 'DEBUG_OUTPUT'
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /Users/David/Documents/Arduino/libraries/MySensors/core/MySensorsCore.cpp:635:2: note: in expansion of macro 'CORE_DEBUG'
        CORE_DEBUG(PSTR("MCO:SLP:WUP=%" PRIi8 "\n"), result); // sleep wake-up
        ^ 
      

      I'm not sure why this only occurs with the GertSanders board definitions. I hope we can find a solution on this.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: [security] Migrating from library version 2.1 to 2.2

      @anticimex

      Ok clear. Thank you.

      posted in Development
      DavidZH
      DavidZH
    • RE: [security] Migrating from library version 2.1 to 2.2

      @alowhum said in [security] Migrating from library version 2.1 to 2.2:

      @anticimex Awesome!

      So I had a look at the new code, and is this a fair summary?:

      • Simple encryption and simple signing are now two separate functions you can call at the top of your script by adding a line with a password: MY_ENCRYPTION_SIMPLE_PASSWD and MY_SIGNING_SIMPLE_PASSWD.
      • You can also just put "MY_SECURITY_SIMPLE_PASSWD" at the top of your script, and that will do both in one go. This used to be called the MY_SIGNING_SIMPLE_PASSWD option, which also did both.
      MY_SIGNING_SIMPLE_PASSWD is now
      called MY_SECURITY_SIMPLE_PASSWD.
      MY_SIGNING_SIMPLE_PASSWD only affects signing,
      and a new flag, MY_ENCRYPTION_SIMPLE_PASSWD
      only affects encryption.
      MY_SECURITY_SIMPLE_PASSWD enable both these flags.
      

      I want to follow upon this: I use RFM69 for transport, they have an encryption engine in hardware. Will there be any difference in time to process the message between using:

      • MY_SECURITY_SIMPLE_PASSWORD with soft encryption done on the ATmega or
      • MY_SIGNING_SIMPLE_PASSWORD and encryption on the RFM or
      • just MY_SIGNING_SIMPLE_PASSWORD.

      If I'm not mistaken a signed message is the full 32 byes anyway, so the actual "airtime" will not change, but maybe the processing time before that will.

      And yes, I am aware of the implications in total system security. But none of my nodes are accessible from the outside of my house. I am not worried about someone reading the contents of my sketch.

      posted in Development
      DavidZH
      DavidZH
    • RE: Sensbender Micro and v2.2 library

      @mbj No problem!

      Actually, I've encountered another issue. But I found that that may depend on the bootloader.

      The first time I "solved" the problem was another board with a generic 328p breadboard bootloader (I apparently didn't pay attention when burning the BL for the various boards)

      Last week I had a problem with a board with the Gert Sanders 328p bootloader when I couldn't enable the MY_DEBUG. When I changed the board type it compiled, but wouldn't upload because of the differences in baud rate.

      I will probably have to reflash al boards withe the same bootloader but that means de-solder all radios ... ๐Ÿ˜ฃ

      When I have time again I will investigate further.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Sensbender Micro and v2.2 library

      What version of the Arduino IDE are you using? I Had a similar problem but I solved that with updating the IDE to the latest version (1.8.5).

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: RFM69 HCW in low power mode possible?

      I stand corrected about the footprints.
      But wouldn't it be an idea to choose the non "C" version for your PCB?
      The price should be exactly the same (at least it is at the supplier here in NL where I get mine from) at the cost of a slightly bigger footprint (3.7 mm wider in one direction, the other is the same).

      Sorry again for the confusion caused.

      posted in Hardware
      DavidZH
      DavidZH
    • RE: RFM69 HCW in low power mode possible?

      But CW and HCW share the same footprint! The only thing you'd have to change is to add #define MY_IS_RFM69HW for the HCW version to your code, and leave it out if you use the CW version.

      The exact same counts for the non "C" versions. The C in the type designation means it's pin compatible with previous versions of the radio (RFM12).

      But to answer your questions:
      a) the transmit power of the both is adjustable, the minimum level of both is the same, the maximum of the HCW is 7dB higher with a power consumption that is 3 times higher as the CW.
      b) when set at the same level, the power consumption is the same.

      But like I said, no need to start putting these tricks in. Just solder the right module on the PCB and add the #define accordingly in your code.

      posted in Hardware
      DavidZH
      DavidZH
    • RE: Is ARM the future of MySensors?

      I certainly can see the appeal for the NRF5 series, which wil work perfect in areas with detached and terraced houses. But in Urban areas with lots of high rises the 2.4GHz band is a bit congested. So there another band will work much better.
      In that regard I fully agree with @nagelc to pray to your deity of choice for HopeRF to start integrating an MCU with the RFM, or Nordic to start exploring a different part of the ether.
      I have not set foot in the 'large' part of the MCU spectrum, but I have a Feather M0 in the house which will be the center of my new experiments.

      posted in General Discussion
      DavidZH
      DavidZH
    • RE: what is this?

      The surface of the sensor appears to be a light-sensitive semiconductor. Maybe you can unscrew the little PCB from the case and see on the bottom. There could be some information there.

      posted in Hardware
      DavidZH
      DavidZH
    • RE: Forum upgraded

      @hek

      Thanks a lot. Way better that way!

      posted in Announcements
      DavidZH
      DavidZH
    • RE: Forum upgraded

      Hi team,

      first time I opened this forum after the upgrade, i saw no issues, but when I visited again today, there is this side bar on the right with "popular topics" that scrolls along with the page.
      I was unable to find a setting in the profile settings page to disable that bar. Any ideas?

      posted in Announcements
      DavidZH
      DavidZH
    • RE: 2gang in wall dimmer with touch sensors

      Interesting! Can you share some more details? I'm particularly interested in you power supply.

      posted in My Project
      DavidZH
      DavidZH
    • RE: Why I quit using MySensors for actuators

      @kimot

      Thanks, but I try to stay away from 2.4GHz for my home automation. I live in an apartment building with 160 units and our main ISP is kind enough to supply modem/router boxes packed with wifi. Needless to say that the ether is crowded here.

      Plus we (as in me and my better half) do not like the design of those switches as we prefer feedback ("click").

      posted in General Discussion
      DavidZH
      DavidZH
    • RE: Why I quit using MySensors for actuators

      @parachutesj I can see why you chose to move away. RF will always be in the "black magic" realm. Unable to see, hear or feel it's presence. Of course with the proper tools, and knowledge of the correct use of aforementioned tools a lot can be unveiled, but those are out of reach for the average hobbyist.

      I have stopped working on actuators as a safety precaution. Most lights I want to operate are fixed lights, and the in-wall-boxes where I'd have to put the actuators are just too small to be able to fit both my own design MySensors actuator and a momentary switch. One must in my system is the ability to switch the light locally for whenever the controller or network fails.
      The final push for me to walk away was a fire at a family members house caused by a cheap china power supply. No one was hurt, but it took 4 weeks before the family could move back in. I just felt I was not capable of designing a safe power supply to power the node, that would fit inside the wall box.
      So Z-wave it is. With a lot of compatibility issues. But I use it just for communications, not the think-work.

      So I will also stay here for the input part. Sensors galore.... And there will be an actuator later. A low voltage dimmer. Max 30V DC input. Let other people worry about the mains side of things. I just cant bear the thought of putting my family in jeopardy because I wanted a hobby so hard.

      posted in General Discussion
      DavidZH
      DavidZH
    • RE: RFM69CW Gateway and Nodes are not working with Api newer then 2.0.0

      Well there's your problem! You have a 868MHz CW version. So NOT the HCW That means both of the above mentioned defines ar not valid. The only define you'd have to make is #define MY_RADIO_RFM69. That should work.

      You can tell that it is not the H version because of the missing components that make up the extra RF amplifier on the module.

      Hope this helps! Good luck!

      posted in Bug Reports
      DavidZH
      DavidZH
    • RE: RFM69CW Gateway and Nodes are not working with Api newer then 2.0.0

      Can you post a picture of het back of your RFM module? That way we can eliminate the definitions you won't need.
      I run on 2.1.1 with 868MHz versions of both HW and low power. No problems whatsoever. I'm getting very curious as to why I keep reading about users facing issues with the RFM based nodes.

      posted in Bug Reports
      DavidZH
      DavidZH
    • RE: BME280 How to use it outdoors

      @karl261 Do you happen to live near te sea? Because salty air wreaks havoc on anything sooner or later. Tiny electronics rather sooner...

      I have a BME280 outside and that's been running for over a year now. It's pretty well protected though, but it catches a few hours of direct sunlight per day.

      posted in Hardware
      DavidZH
      DavidZH
    • RE: 3.3 or 5v tranformer for mysensors projects

      @NeverDie

      Alas! The European system does not include bigger boxes. We have a standard diameter, 82mm, with two depths; 40mm and 50 mm, where 40 is the standard installed in newly built houses. Lucky for me, the building I live in was built in 1973, when they still used 50mm. This link shows a product sheet (text is Dutch, skip that...) of such a box. That's all, plus it's embedded in concrete or masonry.

      There are bigger boxes, but they're only for some 3 phase sockets, you'd be unable to fit any lightswitch or cover. Useless.

      This is one area I'm quite envied with the US building methods. Need an extra box? Get a saw, cut a hole and be done before morning coffee. Here you'd have to get some heavier equipment plus a good shopvac, and the new render won't be dry until next day...

      posted in Hardware
      DavidZH
      DavidZH
    • RE: 3.3 or 5v tranformer for mysensors projects

      @dbemowsk

      I know the path you are wandering. I have been considering to do it myself. But the fact is that the in-wall boxes on your side of the pond are a fair bit bigger than here in the EU. It would be impossible for me to fit the button assembly (which would stick about 12mm into the box) with some form of battery and a 2-channel third party switching device with all the wiring inside the 50mm deep and 72mm across box.

      That's why I made my own. See the pictures attached.

      KiCAD render front KiCAD render back Assembled with one relay Board back

      Right now I do not have an example of the complete assembly as it is in a full-on test.

      This board of 50x50mm is the biggest I can fit inside the wall box. The idea is to first place the board inside the box and then route the wires over the pcb and connect the button/brain board last. The board is attached to the momentary switches so that closes the box neatly.

      Another consideration for me is a financial one. My current actuators are de CoCo/Intertechno 433MHz ones without any delivery confirmation. There are days that messages arrive only intermittently, and for a whole house automation, that is simply not good enough. If I have to choose a new framework, other than MySensors, it would have to be Z-Wave in my opinion, as the 2.4GHz in my apartment building is very crowded (160 units). That means I have to invest in a gateway and actuators which cost a minimum of โ‚ฌ60 each. These units can also be used as button senders, but lack the option of a signalling device (I have a RGB led option that lights between the button and the frame (I so need to make a little video of this!))

      One of the top priorities in my design spec is that even with the controller down, my better half is able to control all the lighting in the house, as there are situations that I am away from home for a few days (also another reason not to go with 2.4GHz devices). All reasons to make my own design which is adaptable to a lot of situations.

      And now I go and make an end to this very lengthy post. My humble apologies if I fail to make sense by jumping from topic to topic...

      Salutations!

      posted in Hardware
      DavidZH
      DavidZH
    • RE: 3.3 or 5v tranformer for mysensors projects

      We are now entering the realm of where you must draw the line of how far one should go in DIY'ing their home automation.
      And I think that is a very difficult discussion.
      First of all, the fire risk is constantly present in the back of my head. I am now (still...) in the process of automating the lights in our house (rented, so everything has to go when we leave). The best and safest way to do so would be to run every light power cable to a central junction box with the dimmers and switches. That makes it easy to separate the mains and low voltage cables to such a degree that a fault in either will not result in a dangerous situation.

      But a lot of houses her in Europe, like our apartment, have all the cables in conduit embedded in concrete which would make that impossible. (I know, in Belgium, the last two decades have been different. Most of the builds in that era have been done with all the light wires to a central switch box with pulse contacts in the rooms.) So. Embed the MySensors switch or dimmer in the wall box under the light switch. I have the funny feeling the WAF would suffer if the was a lump of a box hanging next to the light switch to contain the power supply.
      How do the 433MHz and Z-Wave products do it then? These are allowed inside the wall around the world. But their form factor leaves a lot to be desired. They are a pain to connect and then wrestle back inside the box. Also the little screw terminals they use do not play well with solid core wire of 2.5mmยฒ. Dilemma's!

      The first design of my switch was with a dropper power supply. But those have a nasty side effect. You have to be precise with the current consumption, because every mA not used in the circuit is burned off in a resistor, creating excess heat. And I use 2 relays, so that would result in about 90mA being wasted in case of both relays not being energized. Too big a risk, I think.
      Now I use the Hi-Link and am running a real world like test in a wall box outside of the wall. I use the on-board temperature sensor of the RFM69 to keep track of the temperature inside the box. It runs a steady 9 degrees above ambient with an extra 5 degrees when the relay is energized. So now with a room temp of 25ยฐC that's a tad under 40ยฐC inside the box. Outside of the wall. With only one relay. And all that means I am still not convinced this is the way.

      Like I said. Dilemma's!!!!

      @gohan : There is low voltage wire you can use alongside mains wiring. KNX bus cable. That has sufficient shielding and insulation.

      posted in Hardware
      DavidZH
      DavidZH
    • RE: 3.3 or 5v tranformer for mysensors projects

      Powering projects like these is always a weak point for DIY.

      I have found Vigortronix power modules with a zero-detection output. Those would be very convenient for those building a dimmer. But in some parts of the world there is a tone frequency switching system on the power grid that wreaks havoc on zero crossing, as the 50 (or 60) Hz cycle is disturbed. (In our house at 23:00 sharp, you can see the switching in the light above our dining room. So I wonder how the Vigortronix modules cope with that. Also, they're a bit bigger than the Hi-Link, so almost impossible to fit in a standard EU wall box.

      posted in Hardware
      DavidZH
      DavidZH
    • RE: rfm69hw or rfm69hcw and adjusting power

      Have you made this declaration: RFM69 radio ?

      You need to do that directly above or under the MyMessage msg.... declarations. Otherwise the compiler does not know where to send the commands.

      Either that, or you can substitute radio with RFM69, that should do the same...

      posted in Hardware
      DavidZH
      DavidZH
    • RE: Double Micro (nano) Ampere meter

      @AWI Lemme think about that..... Uuuuuhm. no... ๐Ÿ˜ˆ

      I have no plans for a meetup. Lacking a proper venue for such a thing. Unfortunately.

      posted in My Project
      DavidZH
      DavidZH
    • RE: Trace to antenna?

      There are also some online calculators. But beware, there are two different ways to calculate, depending on whether there is a ground plane underneath or not.

      I have tried to implement it, but the gaps are very small and I'm not sure how to use it properly in KiCAD.

      These are the calculators:

      • with groundplane on bottom layer
      • without groundplane

      My previous PCB's have been made without these calculations and work admirably (but not very efficient probably...).

      posted in Hardware
      DavidZH
      DavidZH
    • RE: Double Micro (nano) Ampere meter

      Awsome!

      I'd like to compare your impressive array of measurement devices against my Agilent U1273A. Actually to decide if I need a ยตCurrent.... Maybe in an upcoming meetup in NL or BE this summer?

      posted in My Project
      DavidZH
      DavidZH
    • RE: MySensors weather station

      Can I make a suggestion? Reverse the placement of the nuts to the top part, and the little machine screws to the bottom part of the housing. That way it will be easier to keep the water out as it will not creep in to the gap between the ABS and the screw. That capillary action will also work upside down, but good old gravity counters that to a great degree.

      posted in Enclosures / 3D Printing
      DavidZH
      DavidZH
    • RE: ๐Ÿ’ฌ Wall Socket Insertable Node

      @Koresh Thanks for the explanation.

      I've been searching for a power solution for my nodes. And that's quite the task.... For now I'm working with the HLK, but that's a tight squeeze. And when I want to make a dimmer, I could use a zero cross circuit. I've been looking into Vigortronix, who have a supply similar to the HLK, but with an extra pulse output for the zero-X. Too bad they are WIDE. They won't leave any proper room for a relay or connection terminal.
      I'll take a look at your link and see if I can make that work in my case, and may come back to you for some magnetics.

      posted in OpenHardware.io
      DavidZH
      DavidZH
    • RE: ๐Ÿ’ฌ Wall Socket Insertable Node

      @Koresh I'd like to repeat the question @MiKa asked on Januari 10th; can you share details on the transformer you used? Or a hint on where you got the inspiration for the power supply for the board?

      posted in OpenHardware.io
      DavidZH
      DavidZH
    • RE: RFM69: Wireing DIO0

      If I recall correctly, the RFM is capable of a "listen mode" where the power requirements are very low, and the MCU is in sleep mode. When a message arrives, the RFM can wake the MCU with an interrupt DIO0 to process it further.

      For now, the MySensors library does not support this listen mode yet, but I know it is in the works for a future release.

      posted in Hardware
      DavidZH
      DavidZH
    • RE: Safe In-Wall AC to DC Transformers??

      @ferro I've looked into thos Vigortonix devices. Those are nice! Unfortunately they're bigger than the HLK's.

      But for the dimmer designers under us: they have miniature power supplies with built-in zero cross detectors! Looks very interesting!

      posted in Hardware
      DavidZH
      DavidZH
    • RE: Problem with RFM69 on Arduino nano...

      Ah! I never thought of that. Nice to see it's solved! And I think you're right, this kind of info should be made available for easy access.

      posted in Hardware
      DavidZH
      DavidZH
    • RE: Problem with RFM69 on Arduino nano...

      If the message says: TSP FAIL there is no communication between your Arduino and the RFM, you need to check your wires, which is strange as you have success with that other lib. Have you commented the right #defines before the include <mysensors.h>?

      posted in Hardware
      DavidZH
      DavidZH
    • RE: ๐Ÿ’ฌ jModule

      Clear! I will take a deeper look into your board.

      posted in OpenHardware.io
      DavidZH
      DavidZH
    • RE: ๐Ÿ’ฌ jModule

      Nice!

      One question: do you have a mechanism to swap pins on the breakout boards? I know not all manufacturers use the same pinout for their I2C boards. Unfortunately...

      posted in OpenHardware.io
      DavidZH
      DavidZH
    • RE: Low power light sensor to generate wakeup interrupt

      You could try the MAX44009 That is low power, and able to sent an interrupt (2actually; low and high) to your node. The only downside is that the Ebay/Aliexpress breakout boards do not have the interrupt pin broken out.

      posted in Hardware
      DavidZH
      DavidZH
    • RE: Sleep() with interrupt only works with level "LOW"

      I've been following that development. And I think it's good that MySensors follows the rules as set by Atmel.

      To be able to use more interrupt pins at the same time I have been looking into pin change interrupts. Those are triggered as the designated pin changes state, either LOW->HIGH or the other way round.

      I think by changing MyHWAVR.cpp (and the comparable files for other hardware) a little, my sensors is capable of using PCI's to wake the node. There is always a negative, and in this case I think its the amount of code needed to see what pin caused the interrupt. The work done by GreyGnome with the EnableInterrupt library shows that very well. The lib is also huge because of the way they use enabling and disabling of the pins with software to emulate the other modes(RISING, FALLING, HIGH and LOW).

      This is not THE solution. It's only one of the ways to be able to use the other modes with a pin.

      posted in Bug Reports
      DavidZH
      DavidZH
    • RE: ๐Ÿ’ฌ RFM69 Multisensor Node (CR2032)

      @scalz
      You also use coincells for timed nodes? As the watchdog timer uses 4,5uA that's quite a lot over 500 or 600 nA with only interrupts waking the MCU. I have some door sensors which I would like to have send a heartbeat every 12 hours or so, because these doors sometimes will not be opened for a few days. That TI chip would be nice to use as a heartbeat timer on an interrupt on only 55nA.
      But maybe I'm nitpicking now... ๐Ÿ˜

      posted in OpenHardware.io
      DavidZH
      DavidZH
    • RE: Pin Change Interrupt on "any" pin.

      Well I've had some success on my own. There's another thread from January where I've discussed a little bit withe the MySensors team.
      Your dirty hack is beautiful in it's simplicity! ๐Ÿ™‚ I have been roving a round in the library files and wound up in MyHWAVR.cpp to change a little bit. And I think I have found a way which is also simple. But I have to offer the change up for review to have it incorporated in a future version of MySensors. Only downside that it's tied to AVR for now. Needs testing to get it going on SAMD as well probably.
      For my tests I have been using the enableInterrupt library by the way. Found no trouble using that. And I have a little RC network on my switches to suppress bounce. Checked that on a scope and that worked like a charm.

      Keep you posted!

      posted in General Discussion
      DavidZH
      DavidZH
    • RE: Node to node communication fails if gateway is not reachable

      @Heizelmann The nodes are unreachable in that situation because the radio is powered down for a set amount of time before a new attempt to establish a connection is done. When you try to send something from a node, that radio will wake up. The receiving node on the other hand will be powered down so it will not do anything.

      Depending on the radio you use, a solution for the RFM69 might be to engage the listen mode. It uses just a bit more energy as power down, but it can generate an interrupt on the node to wake it up and receive the message. I'm not sure if this function is available in the library as of yet, but I know it's in the works.

      posted in Development
      DavidZH
      DavidZH
    • RE: ๐Ÿ’ฌ RFM69 Multisensor Node (CR2032)

      I too came across this last week. It's really neat!
      Another drawback I see is that the node resets every time when wired in this way. That means the whole finding-parent and presentation section is run every time. That eats a lot of power as the radio is powered for more than a second, especially when the node runs at 1MHz.
      I think that in a MyS application this IC should be used to trigger an interrupt to send the data to the controller and, in case of hungry sensor types, switch the power to the sensor.
      That does mean you will be running at about 600nA, but that is still 1/10th of what a watchdog-timed sensor will use.

      posted in OpenHardware.io
      DavidZH
      DavidZH
    • RE: Pin change interrupt not firing with MySensors

      @Yveaux

      It did! Thanks a bunch! I had a feeling it was to be found in that part of the code.

      Strange thing is: it still returns -1 as wake up reason. And that brings me back to my original problem.

      • When I want to add a timed sensor by setting a time as last argument, the node will not wake up when an interrupt takes place. It does register the interrupt, as the counter increases with every press. But it will only wake when the timer expires and only then display the updated counter.

      I do see use cases for this: like an alarm-base station. With multiple inputs for the various detector loops. When the power fails (either by accident or intentionally) the base should go in low power mode to save the battery. And send a periodical heartbeat.
      Or a scene controller in an inaccessible spot with a sensor attached.

      edit: I've been browsing around MyHwAVR.cpp for a while, but my coding is not at that high of a level at this moment, that I can provide any useful input.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Pin change interrupt not firing with MySensors

      Hi @Yveaux,

      I have stripped it to one button on a RC-net and one led to see what I am doing, without changing the basic flow of the sketch. Also the node has been stripped bare. I have used a DIP version with the same bootloader (8MHz internal, 1V8 BOD by GertSanders, 3V3 power source) and the outcome is exactly the same:

      • directly waking with 2.1.1, sleeping with 2.0.0.
      • In both tests, all button presses are registered without problems.
      • button library has nothing to do with it. When I use a simple digitalRead(), all remains the same.
      • when I comment out the library call for the Interrupt (line 48), nothing changes.
      /***************************************************************************/
      //                    MySensors definitions
      
      #define MY_DEBUG    
      #define MY_CORE_ONLY      
      
      #define MY_BAUD_RATE 57600       // Lower as max because of 8 MHz Arduino
      
      #define EI_NOTEXTERNAL               // Options for the EnableInterrupt library
      #define EI_NOTPORTB                  // to save flash space
      #define EI_NOTPORTD
      #define EI_ARDUINO_INTERRUPTED_PIN
      
      /**************************************************************************/
      
      #include <Button.h>
      #include <EnableInterrupt.h>
      #include <MySensors.h>
      
      #define buttonPin 14            //A0
      #define ledPin 8
      
      #define PULLUP true        
      #define INVERT true        
      #define bounceTime 20            // A debounce time of 20 milliseconds usually works well for tactile button switches.
      #define sleepWait 1000           // Time to wait in ms before node sleeps (to be able to receive notification messages).
      
      volatile uint8_t interruptCount = 0;
      volatile bool buttonChanged;
      volatile bool buttonState;
      long lastButton;
      
      Button BtnA(buttonPin, PULLUP, INVERT, bounceTime); 
      
      /**************************************************************************/
      
      void presentation(void)
      {
      
      }
      
      /**************************************************************************/
      
      void setup(void)
      {
        Serial.begin(57600);
        Serial.println("\nStarting test");
        enableInterrupt(buttonPin, interrupted, CHANGE);
        pinMode(ledPin, OUTPUT);
        //pinMode(buttonPin, INPUT_PULLUP);             //uncomment when testing without Button library
        lastButton = millis();
      }
      
      /**************************************************************************/
      
      void loop(void)
      {
        if (buttonChanged) {
          if (buttonState) {
            Serial.print("\nButton has changed "); Serial.print(interruptCount); Serial.println(" times.");
            digitalWrite(ledPin, HIGH);
          }
          else {
            Serial.println("\nButton is released.");
            digitalWrite(ledPin,LOW);
          }
          lastButton = millis();
          buttonChanged = false;
        }
      
        if (!buttonChanged) {
          if (millis() > (lastButton + sleepWait)) {
            sleepNode();
          }
        }
      }
      
      /**************************************************************************/
      
      void interrupted()
      {
        interruptCount++;
        buttonChanged = true;
        //buttonState = !digitalRead(buttonPin);
        buttonState = BtnA.read();                                      
      }
      
      /**************************************************************************/
      
      void sleepNode()
      {
        Serial.println("\nSleep...");
        wait(30);
        sleep(0xff, 0x00, 0xff, 0x00, 0);
        wait(30);
      }
      

      Two other things caught my attention:

      • In MY_CORE_ONLY there's no serial.begin(), makes one wait awfully long for debug output...
      • When the node is in PWR_DOWN, my (Chinesium) USB-serial converter is unable to wake the node to upload new code. I have to keep the node awake with the button, and if that fails, shoot the bootloader again. I know the DTS-pin is functional, as the node resets when I start a serial window.
      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Pin change interrupt not firing with MySensors

      No worries man! We're all learning as we're moving along with this project. And there's so much info in most of the posts that some parts will be missed. Inevitably.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Pin change interrupt not firing with MySensors

      I respectfully disagree: That states only INT_0 and INT_1, I am using PCI. Different mechanism and vectors.

      About the radio waking it up: you mean interference? Or the interrupt? I think those are not the case, as he wake reason states -1, by timer. And if I flash the exact same sketch using the 2.0 library, the node stays asleep properly and wakes with the press of a button.
      The thing I ran into when developing this node was that I could use PCI when using deep sleep, but when I wanted to add a timer to send a sensor value periodically as well, the node would only wake up with the timer, and only then register the interrupt events.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Pin change interrupt not firing with MySensors

      @tekka said in Pin change interrupt not firing with MySensors:

      @DavidZH IRQ triggers only on LOW level when sleeping (see at328 datasheet) - what happens if you substitute all enableInterrupt(xyz, CHANGE) to enableInterrupt(xyz, LOW)?

      That is not true! Chapter 13, page 70, second part, first line: The External Interrupts can be triggered by a falling or rising edge or a low level. For completeness I tried, but the outcome is the same; node wakes up immediately.

      The only funny thing I see is at 2549 !MCO:SND:NODE NOT REG

      this is because you set a 100ms timeout here:

      #define MY_TRANSPORT_WAIT_READY_MS 100 //Start the node even if no connection to the GW could be made
      

      set it to 0 or increase to e.g. 10000...

      You're right! My bad. I'll change that to 2700, that's the approximate time the node needs to start up.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Pin change interrupt not firing with MySensors

      Sure!

      ***************************************************************************
      **
      ** Light switch v1.0 with additional relay/power supply daughter board
      **
      ** Scraped together by D Hille. MySensors library by Henrik Ekblad et al.
      **    Button lib.:              github.com/JChristensen/Button
      **    PinChangeInterrupt lib.:  github.com/NicoHood/PinChangeInterrupt
      **    FastLED lib.:             github.com/FastLED
      **
      ***************************************************************************/
      //                    MySensors definitions
      
      #define MY_DEBUG                 // Comment out after finishing sketch (saves over 6kB flash)
      //#define MY_DEBUG_VERBOSE_SIGNING // Comment out when no signing is used or when everything is OK
      
      #define MY_BAUD_RATE 57600       // Lower as max because of 8 MHz Arduino
      
      #define MY_RADIO_RFM69
      #define MY_IS_RFM69HW
      
      #define MY_NODE_ID 85            // Delete to use automatic ID assignment
      
      #define MY_TRANSPORT_WAIT_READY_MS 100 //Start the node even if no connection to the GW could be made
      //#define MY_TRANSPORT_STATE_RETRIES 1
      //#define MY_TRANSPORT_MAX_TSM_FAILURES    (2u)                 //Uncomment these three when usung battery powered node
      //#define MY_TRANSPORT_TIMEOUT_EXT_FAILURE_STATE (5*60*1000ul)
      
      
      /**************************************************************************/
      //                        Security
      /**************************************************************************/
      
      //#define MY_SIGNING_SOFT
      //#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      //#define MY_SIGNING_REQUEST_SIGNATURES
      
      //#define MY_RFM69_ENABLE_ENCRYPTION
      
      
      /**************************************************************************/
      //                    Switch definitions
      /**************************************************************************/
      
      #define BATTERY_POWERED
      #define battUpdater 50            // Number of TX actions to count before a new battery status update is sent.
      
      #define LED_FUNCTION 2
      // LED functions:
      // 0.: no LED present
      // 1.: ACK                        (LED will flash briefly when ACK is received)
      // 2.: Notification               (RGB-LED wil display a function of the controller, or flash white when ACK is received)
      
      #define NODE_CHAN_A_FUNCTION 1
      
      #define NODE_CHAN_B_FUNCTION 3
      
      #define NODE_CHAN_C_FUNCTION 0
      
      #define NODE_CHAN_D_FUNCTION 0
      // Node functions:
      // 0.: channel off
      // 1.: button only - momentary   ("ON" while button pushed, "OFF" when released)
      // 2.: button only - toggle      (every button push toggles state)
      // 3.: normal                    (relay controlled via RF and local)
      // 4.: local relay               (no RF control, only button)
      
      //#define SAFETY_BUTTON_A          // When defined button needs to be pressed for a set time to activate the button.
      //#define SAFETY_BUTTON_B          // Comment out to deactivate.
      //#define SAFETY_BUTTON_C
      //#define SAFETY_BUTTON_D        
      
      #define SAFETY_PRESS_TIME 1      // time in seconds the button needs to be pressed.
      
      
      /**************************************************************************/
      //                  Debug and interrupt definitions
      /**************************************************************************/
      
      #define LOCAL_DEBUG                              // Comment out to switch all debug messages off (saves 1kb flash)
      
      /*#ifdef MY_DEBUG                                  // Differentiate between global debug including radio and local debug 
        #define LOCAL_DEBUG                            // for the sketch alone.
      #endif*/
      
      #ifdef LOCAL_DEBUG 
        #define Sprint(a) (Serial.print(a))            // Macro as substitute for serial debug. Will be an empty macro when
        #define Sprintln(a) (Serial.println(a))        // debug is switched off
      #else
        #define Sprint(a)                                       
        #define Sprintln(a)
      #endif
      
      #define EI_NOTEXTERNAL
      #define EI_NOTPORTB
      #define EI_NOTPORTD
      #define EI_ARDUINO_INTERRUPTED_PIN
      
      
      /**************************************************************************/
      
      #include <Button.h>
      #include <EnableInterrupt.h>
      #include <MySensors.h>
      #include <FastLED.h>
      #include <Vcc.h>
      
      
      #define BMEaddr 0x76
      #define Max44099Addr 0x4A
      #define sketchName "switchNode(Hal)"
      #define sketchVer "1.0" 
      
      #define buttApin  14              // Arduino Digital I/O pin numbers for connected buttons 
      #define buttBpin  15              // when connected to '`official' PCB.
      #define buttCpin  8
      #define buttDpin  9
      
      #define relayApin 16
      #define relayBpin 17
      
      #define LEDpinACK 5
      #define LEDpinWS 6
      #define WS_Power 9
      
      #define ChanA 0
      #define ChanB 1
      #define ChanC 2
      #define ChanD 3
                                
      #define PULLUP true        
      #define INVERT true        
      #define bounceTime 20             // A debounce time of 20 milliseconds usually works well for tactile button switches.
      #define sleepWait 2000           // Time to wait in ms before node sleeps (to be able to receive notification messages).
      
      volatile int pinChanged = 255;
      int indexButton = 255;
      int currDim = 255;                // Bright value of notificator at startup.
      int newDim = 0;
      int currLED = 30;                 // Hue value of notificator at startup.
      int newLED = 0;
      bool buttonPressed = false;
      bool changeLED = false;
      bool flashLED = false;
      int flashNumber = 1;
      bool flashWait = false;
      bool dimLED = false;
      bool flashOn = false;
      
      bool battPower = true;
      int inputPin[5] = {0, 0, 0, 0, 0};          // State machine registers
      int actuatorPin[2] = {0, 0};
      int function[4] = {0, 0, 0, 0};
      bool safetyBttn[4] = {0, 0, 0, 0};
      bool reqAck[4] = {0, 0, 0, 0};
      bool inState[5] = {0, 0, 0, 0, 0};
      bool longPr[5] = {0, 0, 0, 0, 0};
      bool outState[4] = {0, 0, 0, 0};
      bool longPress = false;
      
      unsigned long lastTimeButton;               // Timer registers
      unsigned long flashTime;
      unsigned long lightsOut;
      unsigned long buttonTime;
      unsigned long longPressTime;
      
      bool startUp = true;
      bool transportDown = false;
      bool metric = true; 
      
      int battStatCounter = 0;
      const float VccMin = 0.0;                   // Minimum expected Vcc level, in Volts.
      const float VccMax = 5.0;                   // Maximum expected Vcc level, in Volts.
      const float VccCorrection = 3.41/3.35;      // Measured Vcc by multimeter divided by reported Vcc
      
      
      /**************************************************************************/
      //                  Library declarations
      /**************************************************************************/
      
      Button BtnA(buttApin, PULLUP, INVERT, bounceTime);    
      Button BtnB(buttBpin, PULLUP, INVERT, bounceTime);
      Button BtnC(buttCpin, PULLUP, INVERT, bounceTime);
      Button BtnD(buttDpin, PULLUP, INVERT, bounceTime);
      
      CRGB notifier[1];                           // define notification LED
      
      MyMessage msgButton(0, V_TRIPPED);
      MyMessage msgToggle(0, V_STATUS);
      MyMessage msgLED(LEDpinWS, V_RGB);
      
      Vcc vcc(VccCorrection);
      
      
      /**************************************************************************/
      //                  Error messages
      /**************************************************************************/
      
      #if (NODE_CHAN_A_FUNCTION == 0)
      #error Channel A cannot be turned off. For single channel use turn off channel B.
      #endif
      #if (NODE_CHAN_C_FUNCTION >= 3 || NODE_CHAN_D_FUNCTION >= 3)
      #error Channels C and D do not have relays attached, can only be used as buttons.
      #endif
      
      
      /**************************************************************************/
      
      void before(void)
      {
        Sprintln("\nStarting up...");
        Sprintln("\nReading config...");
          
      //                  Fill state machine registers
      
        inputPin[ChanA] = buttApin;
        #ifdef SAFETY_BUTTON_A
          safetyBttn[ChanA] = true;
        #endif
        function[ChanA] = NODE_CHAN_A_FUNCTION;
        enableInterrupt(inputPin[ChanA], ChanA_ISR, CHANGE);
        if (function[ChanA] <= 2 && LED_FUNCTION >= 1) {
          reqAck[ChanA] = true;
        }
        else {
          actuatorPin[ChanA] = relayApin;
        }
          
        if (NODE_CHAN_B_FUNCTION >= 1) {
          inputPin[ChanB] = buttBpin;
          #ifdef SAFETY_BUTTON_B
            safetyBttn[ChanB] = true;
          #endif
          function[ChanB] = NODE_CHAN_B_FUNCTION;
          enableInterrupt(inputPin[ChanB], ChanB_ISR, CHANGE);
          if (function[ChanB] <= 2 && LED_FUNCTION >= 1) {
            reqAck[ChanB] = true;
          }
          else {
            actuatorPin[ChanB] = relayBpin;
          }
        }
        
        if (NODE_CHAN_C_FUNCTION >= 1) {
          inputPin[ChanC] = buttCpin;
          #ifdef SAFETY_BUTTON_C
            safetyBttn[ChanC] = true;
          #endif
          function[ChanC] = NODE_CHAN_C_FUNCTION;
          enableInterrupt(inputPin[ChanC], ChanC_ISR, CHANGE);
          if (function[ChanC] <= 2 && LED_FUNCTION >= 1) {
            reqAck[ChanC] = true;
          }    
        }
        
        if (NODE_CHAN_D_FUNCTION >= 1) {
          inputPin[ChanD] = buttDpin;
          #ifdef SAFETY_BUTTON_D
            safetyBttn[ChanD] = true;
          #endif
          function[ChanD] = NODE_CHAN_D_FUNCTION;
          enableInterrupt(inputPin[ChanD], ChanD_ISR, CHANGE);
          if (function[ChanD] <= 2 && LED_FUNCTION >= 1) {
            reqAck[ChanD] = true;
          }
        }
      
        longPressTime = SAFETY_PRESS_TIME * 1000;
      }
      
      
      /**************************************************************************/
      
      void presentation()  
      {
        Sprintln("Start radio and sensors");  
        Sprintln("Send node info. \n");
        
        sendSketchInfo(sketchName, sketchVer);
        
        for (int i = ChanA; i < ChanD+1; i++) {
          Sprint("\nPresent channel "); Sprint(i); Sprint(", function: "); Sprint(function[i]); Sprint(", safety: "); Sprintln(safetyBttn[i]);
          if (function[i] == 1) {
            present(i, S_BINARY);
          }
          else if (function[i] >= 2) { 
            present(i, S_LIGHT);
          }
        }
      
        if (LED_FUNCTION == 2) {
          Sprintln("\nPresent notifier.");   
          present(LEDpinWS, S_RGB_LIGHT);
        }
      
        synchronizeChannels();
      }
      
      
      /**************************************************************************/
      
      void setup(void)
      {  
        #ifndef BATTERY_POWERED
          battPower = false;
        #endif
      
        pinMode(LEDpinACK, OUTPUT);
      
        if (LED_FUNCTION == 2) {
          pinMode(WS_Power, OUTPUT);
          digitalWrite(WS_Power, HIGH);    
          FastLED.addLeds<WS2812B, LEDpinWS, GRB>(notifier, 1);
          wait(30);
          notifier[0] = CHSV(currLED, 255, currDim);    // give LED initial color
          FastLED.show();
        }
      
        if (function[ChanA] >= 3) {
          pinMode(actuatorPin[ChanA], OUTPUT);
        }
        if (function[ChanB] >= 3) {
          pinMode(actuatorPin[ChanB], OUTPUT);
        }
        
        Sprintln("\nDone. \nStarting program.");
        lastTimeButton = millis();
      
        checkTransportStatus();
      }
      
      
      /**************************************************************************/
      
      
      void loop(void)
      {
        if (indexButton <= 25) {                          // Measure time when safety feature is enabled.
          if (millis() >= buttonTime + longPressTime) {
            Sprint("\nChannel "); Sprint(indexButton); Sprintln(" long-pressed");
            flashLED = true;
            pinChanged = indexButton;
            longPr[indexButton] = true;
            indexButton = 255;
            wait(30);
          }
        }  
      
        //if (buttonPressed) {
        //  readInputs();
        //}
        
        switch (function[pinChanged]) {
          case 1:
            Sprint("\nChannel "); Sprint(pinChanged);       
            if (inState[pinChanged] && !buttonPressed) {
              Sprintln(" pressed.");
              if ((!safetyBttn[pinChanged]) || (longPr[pinChanged])){
                if (!transportDown) {
                  send(msgButton.setSensor(pinChanged).set(true));
                }
              }
              else {
                indexButton = pinChanged;
                buttonTime = millis();
              }
              pinChanged = 255;
              //buttonPressed = true;
              wait(30);
              break;
            }
            else if (!inState[pinChanged]) {
              lastTimeButton = millis();
              Sprintln(" released.");
              if ((!safetyBttn[pinChanged]) || (longPr[pinChanged])) {
                if (!transportDown) {
                  send(msgButton.setSensor(pinChanged).set(false),reqAck[pinChanged]);
                }
                else {
                  flashLED = true;
                  flashNumber = 3;
                }
              }
              longPr[pinChanged] = false;
              indexButton = 255;
              pinChanged = 255;
              wait(30);
              battStatCounter++;
            }
            break;
          case 2:
          case 3:
          case 4:
            lastTimeButton = millis();
            if (inState[pinChanged]) {
              if ((!safetyBttn[pinChanged]) || (longPr[pinChanged])) {
                Sprint("\nChannel "); Sprint(pinChanged); Sprint(" toggled");
                outState[pinChanged] = !outState[pinChanged]; 
                if (function[pinChanged] >= 3) {
                  digitalWrite(actuatorPin[pinChanged], outState[pinChanged]);
                  Sprint(", relay changed");
                }
                if (function[pinChanged] == 2 || function[pinChanged] == 3) {
                  if (!transportDown) {
                    send(msgToggle.setSensor(pinChanged).set(outState[pinChanged]),true);
                    Sprint(", sent"); 
                  }
                  else {
                    flashLED = true;
                    flashNumber = 3;
                  }
                }            
                Sprint(". State: "); Sprintln(outState[pinChanged]);
                longPr[pinChanged] = false;
              }  
              else {
                buttonTime = millis();
                indexButton = pinChanged;
              }
              pinChanged = 255;
              battStatCounter++;
            }
            else {
              pinChanged = 255;
            }        
          break;
        }
        
        if (battPower && (battStatCounter >= battUpdater)) {  
          batteryStats();
          battStatCounter = 0;
        }
      
        checkTransportStatus();
        
        if (pinChanged > 25) {  
          if ((battPower) && (millis() >= lastTimeButton + sleepWait)) {
            if (!dimLED) {
              newDim = 0;
            }
            dimLED = true;
            if (currDim <= 0) {
              lightsOUT();
              newDim = 255;
              dimLED = true;
            } 
          }
        }
        updateLED();
      }
      
      
      /**************************************************************************/
      
      void ChanA_ISR()                        
      {
         pinChanged = ChanA;
         inState[ChanA] = BtnA.read();
      }
      
      
      void ChanB_ISR()
      {
         pinChanged = ChanB;
         inState[ChanB] = BtnB.read();
      }
      
      
      void ChanC_ISR()
      {
        pinChanged = ChanC;
        inState[ChanC] = BtnC.read();
      }
      
      
      void ChanD_ISR()
      {
        pinChanged = ChanD;
        inState[ChanD] = BtnD.read();
      }
      
      
      /**************************************************************************/
      
      void readInputs()
      {
        inState[ChanA] = BtnA.read();
        inState[ChanB] = BtnB.read();
        inState[ChanC] = BtnC.read();
        inState[ChanD] = BtnD.read();
      }
      
      
      /**************************************************************************/
      
      void receive(const MyMessage &message) 
      {
        Sprintln("\nMessage received");
        if (message.isAck()) {
          Sprintln("ACK\n");
          flashLED = true;
        }
        
        if (message.type == V_VAR1) 
        {
          Sprint("Notifier value; ");
          if (message.sensor == LEDpinWS) {
            newLED = message.getInt();
            Sprint("received hue-value: "); Sprint(newLED); Sprintln("\n");
            changeLED = true;
          }
        }
        if (message.type == V_STATUS) {
          outState[message.sensor] = message.getBool();
          Sprint("Channel "); Sprint(message.sensor); Sprint(" switched to "); Sprintln(outState[message.sensor]); Sprintln("\n");
          digitalWrite(actuatorPin[message.sensor], outState[message.sensor]);
        }
      }
      
      
      /**************************************************************************/
      
      void lightsOUT()
      {
        Sprintln("\nSleep\n");
        digitalWrite(WS_Power, HIGH);
        pinMode(WS_Power, INPUT);
        wait(30);
        int testInt = sleep(0xff, 0x00, 0xff, 0x00, 0); 
        pinMode(WS_Power, OUTPUT);
        digitalWrite(WS_Power, HIGH);
        Sprintln(testInt);
        wait(30);
      }
      
      
      /**************************************************************************/
      
      void updateLED()
      {
        if ((millis() >= flashTime + 100) && flashWait)  {
          flashWait = false;
        }
        
        if (flashLED) {                         // Flash the LED white (or whatever color)as confirmation.
          if (!flashOn && !flashWait) {
            flashTime = millis();               // Use millis() to prevent blocking the code with wait() or delay().
            flashOn = true;
            if (LED_FUNCTION == 1) {
              digitalWrite(LEDpinACK, HIGH);
            }
            else if (LED_FUNCTION == 2) {
              notifier[0] = CHSV(currLED, 0, currDim);    // Set the saturation to 0 (no color, just light -> white).
            }
          }
          else if ((millis() >= flashTime + 50) && !flashWait) {
            if (LED_FUNCTION == 1) {
              digitalWrite(LEDpinACK, LOW);       
            }
            else if (LED_FUNCTION == 2) {
              notifier[0] = CHSV(currLED, 255, currDim);  // Set the saturation back to original.
            }
            flashOn = false;
            flashWait = true;
            flashNumber--;
            if (flashNumber <= 0) {
              flashNumber = 1;
              flashLED = false; 
              flashWait = false;
            }
          }
        }
        else if (changeLED) {                   // Morph the next color in the current for the notification LED.
          int deltaHSV = currLED - newLED;
          if (currLED != newLED) {
            if (deltaHSV < 0) {
              currLED += 1;
            }
            else if (deltaHSV > 0) {
              currLED -= 1;
            }
            notifier[0] = CHSV(currLED, 255, currDim);
            Sprintln(currLED);
          }
          else {
            changeLED = false;
          }
        }
        else if (dimLED) {                      // Dim the notification LED to 0 when battery powered.
          if (currDim != newDim) {
            if (currDim >= newDim) {
              currDim -= 1;                     // Slowly dim the indicator before sleep time and...
            }
            else if (currDim <= newDim) {
              currDim += 5;                     // ...bring it back up in a hurry.
            }
            notifier[0] = CHSV(currLED, 255, currDim);
          }
          else {
            dimLED = false;
          }
        }
        FastLED.show();                         
      }
      
      
      /**************************************************************************/
      
      void checkTransportStatus()
      {
        /*if (isTransportSearchingParent()) {
          if (!transportDown); {
            transportDown = true;
          }
        }
        else if (transportDown) {
          transportDown = false;
          synchronizeChannels();
        }*/
      }
      
      
      /**************************************************************************/
      
      void synchronizeChannels()
      {
        for (int i = ChanA; i < ChanD+1; i++) {             // Syncing switch states to controller.
          if ((function[i] == 2) || (function[i] == 3)) {
            Sprint("\nChannel "); Sprint(i); Sprintln(" sync.");
            send(msgToggle.setSensor(i).set(false));
          }
        }
      }
      
      
      /**************************************************************************/
      
      void indication(const indication_t)
      {
        
      }
      
      /**************************************************************************/
      
      void batteryStats()
      {
        if (battPower) {
          float battPct = vcc.Read_Perc();
          float battVolt = vcc.Read_Volts();
          wait(50);
          sendBatteryLevel(battPct);
          Sprint("Battery level: "); Sprintln(battVolt); Sprintln("V.\n");
        }  
      }
      
      0 MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.1.1
      6 MCO:BGN:BFR
      
      Starting up...
      
      Reading config...
      10 TSM:INIT
      16 TSF:WUR:MS=100
      22 TSM:INIT:TSP OK
      26 TSM:INIT:STATID=85
      28 TSF:SID:OK,ID=85
      32 TSM:FPAR
      165 TSF:MSG:SEND,85-85-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      178 MCO:BGN:STP
      
      Done. 
      Starting program.
      210 MCO:BGN:INIT OK,TSP=0
      985 TSF:MSG:READ,0-0-85,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      993 TSF:MSG:FPAR OK,ID=0,D=1
      2179 TSM:FPAR:OK
      2181 TSM:ID
      2185 TSM:ID:OK
      2187 TSM:UPL
      2197 TSF:MSG:SEND,85-85-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
      2246 TSF:MSG:READ,0-0-85,s=255,c=3,t=25,pt=1,l=1,sg=0:1
      2256 TSF:MSG:PONG RECV,HP=1
      2263 TSM:UPL:OK
      2265 TSM:READY:ID=85,PAR=0,DIS=1
      2277 TSF:MSG:SEND,85-85-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
      2326 TSF:MSG:READ,0-0-85,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      2344 TSF:MSG:SEND,85-85-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
      2367 TSF:MSG:SEND,85-85-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
      2422 TSF:MSG:READ,0-0-85,s=255,c=3,t=6,pt=0,l=1,sg=0:M
      Start radio and sensors
      Send node info. 
      
      2443 TSF:MSG:SEND,85-85-0-0,s=255,c=3,t=11,pt=0,l=15,sg=0,ft=0,st=OK:switchNode(Hal)
      2465 TSF:MSG:SEND,85-85-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
      
      Present channel 0, function: 1, safety: 0
      2488 TSF:MSG:SEND,85-85-0-0,s=0,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
      
      Present channel 1, function: 3, safety: 0
      2508 TSF:MSG:SEND,85-85-0-0,s=1,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
      
      Present channel 2, function: 0, safety: 0
      
      Present channel 3, function: 0, safety: 0
      
      Present notifier.
      2535 TSF:MSG:SEND,85-85-0-0,s=6,c=0,t=26,pt=0,l=0,sg=0,ft=0,st=OK:
      
      Channel 1 sync.
      2549 !MCO:SND:NODE NOT REG
      2557 MCO:REG:REQ
      2568 TSF:MSG:SEND,85-85-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
      2617 TSF:MSG:READ,0-0-85,s=255,c=3,t=27,pt=1,l=1,sg=0:1
      2627 MCO:PIM:NODE REG=1
      
      Sleep
      
      3268 MCO:SLP:MS=0,SMS=0,I1=255,M1=0,I2=255,M2=0
      3276 MCO:SLP:TPD
      3278 MCO:SLP:WUP=-1
      -1
      
      Sleep
      
      4112 MCO:SLP:MS=0,SMS=0,I1=255,M1=0,I2=255,M2=0
      4120 MCO:SLP:TPD
      4122 MCO:SLP:WUP=-1
      -1
      
      Sleep
      
      4956 MCO:SLP:MS=0,SMS=0,I1=255,M1=0,I2=255,M2=0
      4964 MCO:SLP:TPD
      4966 MCO:SLP:WUP=-1
      -1
      
      Sleep
      
      5799 MCO:SLP:MS=0,SMS=0,I1=255,M1=0,I2=255,M2=0
      5808 MCO:SLP:TPD
      5810 MCO:SLP:WUP=-1
      -1
      
      Sleep
      
      6643 MCO:SLP:MS=0,SMS=0,I1=255,M1=0,I2=255,M2=0
      6651 MCO:SLP:TPD
      6653 MCO:SLP:WUP=-1
      -1
      
      Sleep
      
      7487 MCO:SLP:MS=0,SMS=0,I1=255,M1=0,I2=255,M2=0
      7495 MCO:SLP:TPD
      7497 MCO:SLP:WUP=-1
      -1
      
      Sleep
      
      8331 MCO:SLP:MS=0,SMS=0,I1=255,M1=0,I2=255,M2=0
      8339 MCO:SLP:TPD
      8341 MCO:SLP:WUP=-1
      -1
      

      And so on...

      The only funny thing I see is at 2549 !MCO:SND:NODE NOT REG.

      ( I actually just noticed that the setupis run before the presentation. I thought that had been changed)

      edit: I forgot to mention my hardware!
      328p-AU on a custom board on the 8MHz internal clock. The interrupt pins are connected via a RC network (debounce) to the pins with the internal pullups. I used the button.h library because I'm lazy ๐Ÿ™‚ it also keeps the code a bit neater to look at.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Pin Change Interrupt on "any" pin.

      Well, that's embarrassing... I gave these tips last week, but it appears now that I have been surpassed by updates to the MyS library. The sleep command i issued here now leads to a loop, the node will not sleep. The changes to the library are intentional, as they make MySensors compliant with the designrules from Atmel/MicroChip.
      I have tried another library by the same author (EnableInterrupt) but to no avail.

      Back to the sketchboard...

      posted in General Discussion
      DavidZH
      DavidZH
    • RE: Pin change interrupt not firing with MySensors

      So I've returned to this thread after 2 months, as I finally found the time to test the workaround @Yveaux suggested on Januari 8th. In the mean time I had updated my library to the latest version (2.1.1).
      When I run my sketch now, it never goes to sleep. Actually it does, but wakes up immediately. I use int testInt = sleep(0xff, 0x00, 0xff, 0x00, 0);, testInt returns -1, as in; MCU woke by timer. That is both with and without the workaround, and I am not sure that it's caused by the interrupt definitions. Up to 2.0 that worked fine (I rolled back yesterday to try).

      Now I found this other thread where @tekka stated that he corrected some stuff that as out of line with the datasheet for the 328(p).

      So what would be the correct way to make a node sleep forever without using the ExternalInterrupts (INT_0 and INT_1)? I am in no rush to get this going, because my first nodes are going to be mains powered, so they will be happily looping along without sleeping. But as this node has 4 buttons, PinChange is a route I'd like to go.

      (Now I have to go and retract my statements in another thread, because they are null and void now.)

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: ๐Ÿ’ฌ Various bootloader files based on Optiboot 6.2

      I have tried with your bootloader on 16MHz and 8 MHz with crystal.

      8MHz, crystal, 1V8

      Warning: Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB
      Build options changed, rebuilding all
      
      Sketch uses 16,680 bytes (51%) of program storage space. Maximum is 32,256 bytes.
      Global variables use 942 bytes (45%) of dynamic memory, leaving 1,106 bytes for local variables. Maximum is 2,048 bytes.
      

      16MHz, crystal, 1V8

      Warning: Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB
      Build options changed, rebuilding all
      
      Sketch uses 16,694 bytes (51%) of program storage space. Maximum is 32,256 bytes.
      Global variables use 942 bytes (45%) of dynamic memory, leaving 1,106 bytes for local variables. Maximum is 2,048 bytes. 
      

      So the 16Mhz file is actally even a bit bigger. I also tried if changing the BOD voltage would change anything, but nope on that.

      Might be something to look into in a spare hour.

      posted in OpenHardware.io
      DavidZH
      DavidZH
    • RE: ๐Ÿ’ฌ Various bootloader files based on Optiboot 6.2

      @GertSanders

      I have been running your bootloader for all my nodes now and that works very well.
      But there is something that surprised me. When I compile the next sketch and compare that with the Moteino bootloader it's substantially larger.

      /***************************************************************************************
      **
      ** Outdoor sensor v1.0 Measuring temperature, humdity, pressure and light level
      **  Calculating a weather forecast with the height comensated air pressure.
      **      powered by a solar panel and a 1000mAh Li-Ion battery.
      **
      ** Scraped together by D Hille. MySensors library by Henrik Ekblad et al.
      **
      **      Heat index calculation from DHT library by Adafruit
      **      MAX44009 bij Rob Tillaart
      **      Weather forecast based on AN3914 by Freescale
      **
      ****************************************************************************************/
      //                    MySensors definitions
      
      //#define MY_DEBUG                      // Enable debug prints (6 kb flash space)
      //#define MY_DEBUG_VERBOSE_SIGNING      // Comment out when no signing is used or when everything is OK (3 kb flash space)
      
      #define MY_BAUD_RATE 57600            // Set serial baudrate
      
      #define MY_RADIO_RFM69                // Enable and select radio type attached
      //#define MY_IS_RFM69HW                 // Comment out when using standard RFM69W
      
      #define MY_NODE_ID 110                 // Delete to use automatic ID assignment
      
      //#define MY_CORE_ONLY
      
      /**************************************************************************/
      //                        Transport
      /**************************************************************************/
      
      //#define MY_TRANSPORT_WAIT_READY_MS 1000 //Start the node even if no connection to the GW could be made (disable for sensor nodes).
      #define MY_TRANSPORT_STATE_RETRIES 1
      #define MY_TRANSPORT_MAX_TSM_FAILURES    (2u)
      #define MY_TRANSPORT_TIMEOUT_EXT_FAILURE_STATE (60*1000ul)
      
      
      /**************************************************************************/
      //                        Security
      /**************************************************************************/
      
      //#define MY_SIGNING_ATSHA204
      //#define MY_SIGNING_SOFT
      //#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      //#define MY_SIGNING_REQUEST_SIGNATURES
      //#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = 0,.serial = {0xD0,0xB1,0x90,0x99,0xC3,0x03,0x08,0xD1,0x34}}}
      
      //#define MY_RFM69_ENABLE_ENCRYPTION
      
      
      /**************************************************************************/
      //                    Sensor definitions
      /**************************************************************************/
      
      #define BATTERY_POWERED
      #define battUpdater 300           //Number of TX actions to count before a new battery status update is sent.
      
      #define MY_DEFAULT_TX_LED_PIN 5   // Comment out when no LED is attached.
      #define MY_WITH_LEDS_BLINKING_INVERSE
      
      #define SENSOR_TYPE 3
      // Sensor types:
      // 0.: no climate sensor attached
      // 1.: RFM69 on-die               Temperature sensor on the RFM69 module (whole integers only)
      // 2.: DS18B20                    Dallas one-wire sensor(data pin D14)
      // 3.: HTU21D                     Temp/humidity (I2C)
      // 4.: BME280                     Temp/humidity/pressure (I2C) (node will wake every minute to keep up with trend measureing)
      #define SENSOR_UPDATE 2           // Time in minutes the sensor sends an update
      
      //#define LIGHT_SENSOR_PRESENT      // Comment out when not present. (I2C) (Light sensor will update every 60 seconds.)
      
      //#define INTERRUPT_SENSOR_PRESENT  // Comment out when not present (e. g. motion sensor connect to D3)
      
      #define alti 57                  //altitude offset to compensate the barometric pressure
      
      
      /**************************************************************************/
      //                  Debug definitions
      /**************************************************************************/
      
      //#define LOCAL_DEBUG                              //Comment out to switch all debug messages off (saves 2 kb flash)
      
      #ifdef MY_DEBUG                                  //Differentiate between global debug including radio and local debug 
        #define LOCAL_DEBUG                            //for the sketch alone.
      #endif 
      
      #ifdef LOCAL_DEBUG 
        #define Sprint(a) (Serial.print(a))            // Macro as substitute for serial debug. Will be an empty macro when
        #define Sprintln(a) (Serial.println(a))        // debug is switched off
      #else
        #define Sprint(a)                                       
        #define Sprintln(a)
      #endif
      
      
      /**************************************************************************/
      
      #include <Button.h>
      #include <SPI.h>
      #include <Wire.h>
      #include <MySensors.h>
      //#include <SparkFunBME280.h>
      //#include <MAX44009.h>                           // Uncomment library used in sketch
      #include <Adafruit_HTU21DF.h>
      //#include <OneWire.h>
      //#include <DallasTemperature.h>
      #include <Vcc.h>
      
      
      #define BMEaddr 0x76
      #define Max44099Addr 0x4A
      #define sketchName "sensorNode(living)"
      #define sketchVer "1.0" 
      
      #define sensorPowerPin 20
      
      #define digitalSensorPin 14
      #define analogSensorPin A0
      #define oneWireBusPin 14
      #define interruptPin 3
      #define altSensorPin 18
      #define altAnalogPin A4
      #define sensorPowerPin 6
      
      #define chanTemp 0
      #define chanHum 1
      #define chanHeat 2 
      #define chanBaro 3
      #define chanDelta 4
      #define chanLight 5
      #define chanRate 6
      #define chanInterrupt 8
      
      #define PULLUP false
      #define INVERT false
      #define bounceTime 20
      #define sleepWait 500           //Time to wait in ms before node sleeps (to be able to receive notification messages).
      
      bool battPower = true;
      
      unsigned long currTime = 0;
      unsigned long sleepTime = (60000 * SENSOR_UPDATE);
      unsigned long lastSensorUpdate;
      unsigned long nextSensor;
      unsigned long measureTime;
      int wakeReason = -1;
      int sendLoop = 0;
      bool updated = false;
      bool ACKed = false;
      
      int sensorFunc = 0;
      float sensorData = 0.0;
      float heatTemp = 0.0;
      float heatHum = 0.0;
      bool interruptState = false;
      bool lastInterrupt = false;
      bool sensorPresent = false;
      bool lightPresent = false;
      bool interruptPresent = false;
      
      int minuteCount = 0;
      bool firstRound = true;         
      float pressureAvg;               // average value is used in forecast algorithm. 
      float pressureAvg2;              // average after 2 hours is used as reference value for the next iteration.
      float dP_dt;
      const int LAST_SAMPLES_COUNT = 5;
      float lastPressureSamples[LAST_SAMPLES_COUNT];
      
      bool startUp = true;
      bool metric = true; 
      
      int battStatCounter = 0;
      const float VccMin = 1.8;                   // Minimum expected Vcc level, in Volts.
      const float VccMax = 3.0;                   // Maximum expected Vcc level, in Volts.
      const float VccCorrection = 1.0/1.0;      // Measured Vcc by multimeter divided by reported Vcc
      
      
      /**************************************************************************/
      //                  Library declarations
      /**************************************************************************/
      
      //  Uncomment necessary declarations.
      
      //RFM69 wireless;
      
      //OneWire OWB(oneWireBusPin);
      //DallasTemperature DS18(&OWB);
      //DeviceAddress DS18address;
      
      Adafruit_HTU21DF HTU = Adafruit_HTU21DF();
      
      //BME280 BME;
      
      //Max44009 lightMax(Max44099Addr);
      
      //Button reedContact(interruptPin, PULLUP, INVERT, bounceTime);
      
      MyMessage msgHum(chanHum, V_HUM);
      MyMessage msgTemp(chanTemp, V_TEMP);
      //MyMessage msgBaro(chanBaro, V_PRESSURE);
      //MyMessage msgTrend(chanUniversal, V_VAR5);
      //MyMessage msgLight(chanLight, V_LEVEL);
      //MyMessage msgIntr(chanInterrupt, V_TRIPPED);
      
      Vcc vcc(VccCorrection);
      
      /**************************************************************************/
      //                  Error messages
      /**************************************************************************/
      
        #if (defined INTERRUPT_SENSOR_PRESENT && defined LIGHT_SENSOR_PRESENT && SENSOR_TYPE >= 4)
          #error Motion sensor can anly be combined with either I2C OR one-wire sensors, not both.
        #endif
      
        #if (defined INTERRUPT_SENSOR_PRESENT && (defined LIGHT_SENSOR_PRESENT || SENSOR_TYPE == 4) && defined BATTERY_POWERED)
          #error Interrupt sensor is not compatible with trend sensors like 'baro' and 'light' because the timer will misalign.
        #endif
      
        #if (SENSOR_TYPE > 4)
          #error Not a valid sensor type!
        #endif
      
      
      /**************************************************************************/
      
      void before(void)
      {  
        Serial.println("\nReading config...");
      
        #ifndef BATTERY_POWERED
          battPower = false;
        #endif
      
        sensorFunc = SENSOR_TYPE;
      
        #ifdef LIGHT_SENSOR_PRESENT
          lightPresent = true;
        #endif
      
        #ifdef INTERRUPT_SENSOR_PRESENT
          interruptPresent = true;
          lastInterrupt = reedContact.read();
        #endif
      
        #if (defined MY_SIGNING_SOFT || defined MY_SIGNING_ATSHA204)
          #define sendPause 100
        #else
          #define sendPause 50
        #endif
      }
       
      /**************************************************************************/
      
      void setup(void)
      {  
        pinMode(sensorPowerPin, OUTPUT);       //switch on the sensor power
        digitalWrite(sensorPowerPin, HIGH);    
        wait(50);                              //wait 50 ms for the sensors to settle.
        
        switch (sensorFunc) {
          case 0:
          break;
          case 1:
            sensorPresent = true;
          break;
          case 2: 
            //DS18.begin();
            //DS18.getAddress(DS18address, 0);
            //DS18.setResolution(DS18address, 10);
            sensorPresent = true;
          break;
          case 3:
            HTU.begin();
            sensorPresent = true;
          break;
          case 4:
            //startBME();
            sleepTime = 60000;
            sensorPresent = true;
          break;    
        }
      
        #if (lightPresent)
          sleepTime = 60000;
          sensorPresent = true;
        #endif
      
        #ifdef MY_DEBUG                //Differentiate between global debug including radio and local debug          
          sleepTime = 30000;              //for the sketch alone.
        #endif
      
        batteryStats();
      
        Serial.println("\nDone. \n\nStarting program.\n");
        
        currTime = millis();
      }
      
      /**************************************************************************/
      
      void presentation()  
      {
        Serial.println("Start radio and sensors");  
        
        sendSketchInfo(sketchName, sketchVer);
      
        Sprint("\nPresent ");  
        
        if (sensorFunc >= 1) {
          wait(sendPause);
          present(chanTemp, S_TEMP, "Climate", true);
          Sprint("temperature");
        }
        if (sensorFunc >= 3) {
          wait(sendPause);
          present(chanHum, S_HUM);
          Sprint(", humidity");
          //wait(sendPause);
          //present(chanHeat ,S_TEMP);
          //Sprint(", heatindex");
        }
        if (sensorFunc == 4) {
          wait(sendPause);
          present(chanBaro, S_BARO);
          Sprint(", barometric");
          wait(sendPause);
          present(chanDelta, S_CUSTOM);
          Sprint(" and rate");
        }
        Sprintln(" sensor.");
        
        if (lightPresent) {
          wait(sendPause);   
          present(chanLight, S_LIGHT_LEVEL, "Light", true);
          Sprintln("\nLightsensor "); 
          if (sensorFunc < 4) {
            wait(sendPause);   
            present(chanRate, S_CUSTOM);
            Sprintln("with rate ");
          }
          Sprintln("presented.");     
        }
      
        if (interruptPresent) {
          wait(sendPause);
          present(chanInterrupt, S_MOTION, "Motion", true);
          Sprintln("Interrupt sensor presented.");
        }
      
        wait(sendPause);
      }
      
      
      /**************************************************************************/
      
      void loop(void)
      {
        if (wakeReason < 0) { 
          Serial.println("Reading sensors...");
          switch (sensorFunc) {
            case 0:
            break;
            case 1:
              updateRFM();
            break;
            case 2:
              updateDS18();
            break;
            case 3:
              updateHTU();
            break;  
            case 4:
              if (sendLoop <= 0) {
                updateBME();
                updated = true;
              }  
              else {
                Sprint("\nTrend: ");
                updateTrend();
                sendLoop--;
              }
            break;
          }
          if (lightPresent) {
            updateMAX();
            if (sensorFunc <= 3) {
              Sprint("\nTrend: ");
              updateTrend();
            }
          }
          wakeReason = 0;
          Sprintln("\nSensors updated...");
        }
        else if (wakeReason == 1) {
          updateInterrupt();
          wakeReason = 0;
        }
        
        if (battStatCounter >= battUpdater) {  
          batteryStats();
        }
        
        if (updated) {
          sendLoop = SENSOR_UPDATE;
          updated = false;
        }
        
        if (millis() >= currTime + sleepWait) {
          startUp = false;
          sleepSensor();
        }
      }
      
      
      /**************************************************************************/
      
      void updateInterrupt()
      {/*
        Sprintln("\nInterrupt: ");
        interruptState = reedContact.read();
        wait(50);
        if (interruptState == !lastInterrupt) {
          send(msgIntr.setSensor(chanInterrupt).set(interruptState),true);
          lastInterrupt = interruptState;
        }
        
        Sprint("Door/window is ");
        if (interruptState) {
          Sprintln("opened.");
        }
        else {
          Sprintln("closed");
        }*/
      }
      
      
      /**************************************************************************/
      
      void updateRFM()
      {/*
        Sprintln("\nRFM: ");
        sensorData = wireless.readTemperature();
        wait(20);
        send(msgTemp.set(sensorData, 0));
        Sprint("Temperature: \t"); Sprint(sensorData); Sprintln(" sent.");
        battStatCounter++;*/
      }
      
      /**************************************************************************/
      
      void updateDS18()
      {/*
        Sprintln("\nOne-wire: ");
        DS18.requestTemperatures();
        sensorData = DS18.getTempCByIndex(0);
        wait(20);
        send(msgTemp.set(sensorData, 2));
        battStatCounter++;
        Sprint("Temperature: "); Sprint(sensorData); Sprintln(" sent.");*/
      }
      
      
      /**************************************************************************/
      
      void updateHTU()
      {
        Sprintln("\nHTU: ");
        sensorData = HTU.readTemperature();
        heatTemp = sensorData;
        wait(20);
        send(msgTemp.set(sensorData, 1));
        Sprint("Temperature: \t"); Sprint(sensorData); Sprintln(" sent.");
        sensorData = HTU.readHumidity();
        heatHum = sensorData;
        wait(sendPause);
        send(msgHum.set(sensorData, 1));
        Sprint("Humidity: \t"); Sprint(sensorData); Sprintln(" sent.");
        //wait(sendPause);
        //send(msgHeat.set(computeHeatIndex(heatTemp, heatHum), 1));
        //Sprint("Heatindex sent.");  
        battStatCounter++;
      }
      
      
      /**************************************************************************/
      
      void updateBME()
      {
        /*Sprintln("\nBME: ");
        BME.begin();
        wait(100);
        sensorData = (BME.readFloatPressure()/pow(1-(alti/44330.0),5.255)/100);
        if (!startUp) {
          trend(sensorData);
          send(msgBaro.set(sensorData,1));
          Sprint("Pressure: \t"); Sprint(sensorData); Sprintln(" sent.");
        }
        if (!(minuteCount < 35 && firstRound)) {
          wait(sendPause);
          send(msgTrend.set(dP_dt,2));
          Sprint("Trend: \t\t"); Sprint(dP_dt); Sprintln(" sent.");
        }
        wait(sendPause);  
        sensorData = BME.readTempC();
        heatTemp = sensorData;
        send(msgTemp.set(sensorData,1));
        Sprint("Temperature: \t"); Sprint(sensorData); Sprintln(" sent.");
        wait(sendPause);
        sensorData = BME.readFloatHumidity();
        heatHum = sensorData;
        send(msgHum.set(sensorData,1));
        Sprint("Humidity: \t"); Sprint(sensorData); Sprintln(" sent.");
        wait(sendPause);
        send(msgHeat.set(computeHeatIndex(heatTemp, heatHum), 1));
        Sprint("Heatindex sent.");
        battStatCounter++;*/
      }
      
      
      /**************************************************************************/
      
      float computeHeatIndex(float tempInput, float humInput)       //Function derived from Adafruit DHT library
      {
        /*// Using both Rothfusz and Steadman's equations
        // http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml
        float hiFar;
      
        float tempFar = tempInput * 1.8 + 32;
      
        hiFar = 0.5 * (tempFar + 61.0 + ((tempFar - 68.0) * 1.2) + (humInput * 0.094));
      
        if (hiFar > 79) {
          hiFar = -42.379 +
                   2.04901523 * tempFar +
                  10.14333127 * humInput +
                  -0.22475541 * tempFar*humInput +
                  -0.00683783 * pow(tempFar, 2) +
                  -0.05481717 * pow(humInput, 2) +
                   0.00122874 * pow(tempFar, 2) * humInput +
                   0.00085282 * tempFar*pow(humInput, 2) +
                  -0.00000199 * pow(tempFar, 2) * pow(humInput, 2);
      
          if((humInput < 13) && (tempFar >= 80.0) && (tempFar <= 112.0))
            hiFar -= ((13.0 - humInput) * 0.25) * sqrt((17.0 - abs(tempFar - 95.0)) * 0.05882);
      
          else if((humInput > 85.0) && (tempFar >= 80.0) && (tempFar <= 87.0))
            hiFar += ((humInput - 85.0) * 0.1) * ((87.0 - tempFar) * 0.2);
        }
      
        return (hiFar - 32) * 0.55555;*/
      }
      
      
      /**************************************************************************/
      void updateTrend()
      {
        /*if (sensorFunc == 4) {
         * Sprint("BME -> ");
          BME.begin();
          wait(100);
          sensorData = (BME.readFloatPressure()/pow(1-(alti/44330.0),5.255)/100);
        }
        else if (lightPresent) {
          Sprint("MAX -> ");
          sensorData = lightMax.getLux();
        }
        trend(sensorData);*/
      }
      
      
      /**************************************************************************/
      
      void updateMAX()
      {
        /*Sprintln("\nLight: ");
        sensorData = lightMax.getLux();
        if (sensorFunc <= 3) {
          trend(sensorData);
        }
        send(msgLight.set(sensorData,1));
        Sprint("Light: \t"); Sprint(sensorData); Sprintln(" sent.");
        if (sensorFunc <= 3) {
          if (!(minuteCount < 35 && firstRound)) {
            wait(sendPause);
            send(msgTrend.set(dP_dt,2));
            Sprint("Trend: \t"); Sprint(dP_dt); Sprintln(" sent.");
          }
        }
        battStatCounter++;*/
      }
      
      
      /**************************************************************************/
      
      void sleepSensor()
      {
        if (battPower) {
          Serial.println("\nSleep the sensor.");
          wait(50); 
          unsigned long lightsOut = (sleepTime - (millis() - currTime));
          if (interruptPresent) {
            if (sensorPresent) {
              wakeReason = sleep(1, CHANGE, lightsOut);
            }
            else {
              wakeReason = sleep(1, CHANGE, 0);
            }
          }
          else {
            //digitalWrite(sensorPowerPin, LOW);      //Disabled because of the I2C pull ups on the HTU board
            sleep(lightsOut);                         //causing a 140uA load in sleep. Without, sleep drain is 5uA.
            wakeReason = -1;
            //digitalWrite(sensorPowerPin, HIGH);
            wait(50);
          }
          currTime = millis();
          Sprint("Wake reason: ");Sprintln(wakeReason);
        }
        else if (millis() >= currTime + sleepTime) {
          wakeReason = -1;
          currTime = millis();
        }
      }
      
      
      /**************************************************************************/
      
      /*void startBME()
      {
        BME.settings.commInterface = I2C_MODE;
        BME.settings.I2CAddress = BMEaddr;
        BME.settings.runMode = 1;            //  1, Single mode
        BME.settings.tStandby = 0;           //  0, 0.5ms
        BME.settings.filter = 0;             //  0, filter off
        BME.settings.tempOverSample = 1;
        BME.settings.pressOverSample = 1;
        BME.settings.humidOverSample = 1;  
        
        BME.begin();
      }
      
      
      /**************************************************************************/
      
      float getLastPressureSamplesAverage()
      {
        float lastPressureSamplesAverage = 0;
        for (int i = 0; i < LAST_SAMPLES_COUNT; i++)
        {
          lastPressureSamplesAverage += lastPressureSamples[i];
        }
        lastPressureSamplesAverage /= LAST_SAMPLES_COUNT;
      
        return lastPressureSamplesAverage;
      }
      
      
      /**************************************************************************/
      
      void trend(float pressure)
      {/*
        int index = minuteCount % LAST_SAMPLES_COUNT;                 // Calculate the average of the last 5 minutes.
        lastPressureSamples[index] = pressure;
      
        minuteCount++;
        if (minuteCount > 185)
        {
          minuteCount = 6;
        }
      
        if (minuteCount == 5)
        {
          pressureAvg = getLastPressureSamplesAverage();
          Sprint("First average: "); Sprint(pressureAvg);
        }
        else if (minuteCount == 35)
        {
          float lastPressureAvg = getLastPressureSamplesAverage();
          float change = (lastPressureAvg - pressureAvg);
          if (firstRound)                                             // first time initial 3 hour
          {
            dP_dt = change * 2;                                       // note this is for t = 0.5hour
          }
          else
          {
            dP_dt = change / 1.5;                                     // divide by 1.5 as this is the difference in time from 0 value.
          }
        }
        else if (minuteCount == 65)
        {
          float lastPressureAvg = getLastPressureSamplesAverage();
          float change = (lastPressureAvg - pressureAvg);
          if (firstRound)                                             //first time initial 3 hour
          {
            dP_dt = change;                                           //note this is for t = 1 hour
          }
          else
          {
            dP_dt = change / 2;                                       //divide by 2 as this is the difference in time from 0 value
          }
        }
        else if (minuteCount == 95)
        {
          float lastPressureAvg = getLastPressureSamplesAverage();
          float change = (lastPressureAvg - pressureAvg);
          if (firstRound)                                             // first time initial 3 hour
          {
            dP_dt = change / 1.5;                                     // note this is for t = 1.5 hour
          }
          else
          {
            dP_dt = change / 2.5;                                     // divide by 2.5 as this is the difference in time from 0 value
          }
        }
        else if (minuteCount == 125)
        {
          float lastPressureAvg = getLastPressureSamplesAverage();
          pressureAvg2 = lastPressureAvg;                             // store for later use.
          float change = (lastPressureAvg - pressureAvg);
          if (firstRound)                                             // first time initial 3 hour
          {
            dP_dt = change / 2;                                       // note this is for t = 2 hour
          }
          else
          {
            dP_dt = change / 3;                                       // divide by 3 as this is the difference in time from 0 value
          }
        }
        else if (minuteCount == 155)
        {
          float lastPressureAvg = getLastPressureSamplesAverage();
          float change = (lastPressureAvg - pressureAvg);
          if (firstRound)                                             // first time initial 3 hour
          {
            dP_dt = change / 2.5;                                     // note this is for t = 2.5 hour
          }
          else
          {
            dP_dt = change / 3.5;                                     // divide by 3.5 as this is the difference in time from 0 value
          }
        }
        else if (minuteCount == 185)
        {
          float lastPressureAvg = getLastPressureSamplesAverage();
          float change = (lastPressureAvg - pressureAvg);
          if (firstRound)                                             // first time initial 3 hour
          {
            dP_dt = change / 3;                                       // note this is for t = 3 hour
          }
          else
          {
            dP_dt = change / 4;                                       // divide by 4 as this is the difference in time from 0 value
          }
          pressureAvg = pressureAvg2;                                 // Equating the pressure at 0 to the pressure at 2 hour after 3 hours have past.
          firstRound = false;                                         // flag to let you know that this is on the past 3 hour mark. Initialized to 0 outside main loop.
        }
      
        Sprint(F("\tForecast at minute "));
        Sprint(minuteCount);
        Sprint(F(" dP/dt = "));
        Sprint(dP_dt);
        Sprint(F("hPa/h --> "));*/
      }
      
      
      /**************************************************************************/
      
      void batteryStats()
      {
        if (battPower) {
          float battPct = vcc.Read_Perc();
          float battVolt = vcc.Read_Volts();
          wait(50);
          sendBatteryLevel(battPct);
          Sprint("Battery level: "); Sprint(battVolt); Sprintln("V.\n");
          battStatCounter = 0;
          wait(50);
        }  
      }
      
      
      /**************************************************************************/
      
      void sendBattLevel()
      {
        /*Serial.println("\nBattery: ");
        int ADread = analogRead(batteryPin);
        int battPcnt = map(ADread, 570, 704, 0, 100);  //Usable voltage range from 3.4 to 4.2V
        battPcnt = constrain(battPcnt, 0, 100);        //Charging keeps it at 100%
        sendBatteryLevel(battPcnt);
        Sprint("\nADread\t"); Sprint(ADread); Sprint("\t"); Sprintln(battPcnt);
        battStatCounter = 0;*/
      }  
      

      GertSanders ATMega328p 32p TFQP, 8MHz, 38400baud

      Warning: Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB
      
      Sketch uses 16,680 bytes (51%) of program storage space. Maximum is 32,256 bytes.
      Global variables use 942 bytes (45%) of dynamic memory, leaving 1,106 bytes for local variables. Maximum is 2,048 bytes.
      

      LowPowerLab Moteino 16MHz

      Warning: Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB
      
      Sketch uses 14,264 bytes (44%) of program storage space. Maximum is 31,744 bytes.
      Global variables use 890 bytes of dynamic memory.
      

      In this sketch the size difference doesn't matter that much. But when I introduce signing it will get tight.
      Any thoughts?

      (This is a standard sketch which I adapt for every node by commenting out the parts I do not need. So it might seem large for a simple temperature node. It is...).

      posted in OpenHardware.io
      DavidZH
      DavidZH
    • RE: Pin Change Interrupt on "any" pin.

      @popunonkok

      Well here's the first example of some code that works for me. It's a house controller mounted on a pulse switch (for a standard NL/BE/FR/DE switch box). Own developed PCB that can handle 4 switches, so needed to find a way to be able to sens all our inputs.
      I used the "Button" library to de-clutter the code a bit, and I followed the MySensors way of setting up the program (with defines). That's because I want to deploy a whole bunch of these, so I can adjust some settings quick and then shoot the sketch in the MCU.
      At first I included a sensor function as well but as the standard sketch grew too big I axed that.
      I'll only give the relevant parts of my code now, as I'm not finished yet. Still working on the part where the connection with the GW is lost and reinstated. As this project can also be used as a light switch, it should ALWAYS work. So after the communication is restored the node has to send all the states to the GW again.

      #define PULLUP true        
      #define INVERT true        
      #define bounceTime 20             // A debounce time of 20 milliseconds usually works well for tactile button switches.
      
      #include <Button.h>
      #include <PinChangeInt.h>
      
      #define buttApin  14              // Arduino Digital I/O pin numbers for connected buttons 
      #define buttBpin  15              // when connected to '`official' PCB.
      #define buttCpin  8
      #define buttDpin  9
      
      bool battPower = true;
      int inputPin[5] = {0, 0, 0, 0, 0};          // State machine registers
      int actuatorPin[2] = {0, 0};
      int function[4] = {0, 0, 0, 0};
      bool safetyBttn[4] = {0, 0, 0, 0};
      bool reqAck[4] = {0, 0, 0, 0};
      bool inState[5] = {0, 0, 0, 0, 0};
      bool longPr[5] = {0, 0, 0, 0, 0};
      bool outState[4] = {0, 0, 0, 0};
      
      Button BtnA(buttApin, PULLUP, INVERT, bounceTime);    
      Button BtnB(buttBpin, PULLUP, INVERT, bounceTime);
      Button BtnC(buttCpin, PULLUP, INVERT, bounceTime);
      Button BtnD(buttDpin, PULLUP, INVERT, bounceTime);
      
      attachPinChangeInterrupt(inputPin[ChanA], ChanA_ISR, CHANGE);
      attachPinChangeInterrupt(inputPin[ChanB], ChanB_ISR, CHANGE);
      attachPinChangeInterrupt(inputPin[ChanC], ChanC_ISR, CHANGE);
      attachPinChangeInterrupt(inputPin[ChanD], ChanD_ISR, CHANGE);
      
      void ChanA_ISR()
      {
         pinChanged = ChanA;
         inState[ChanA] = BtnA.read();
      }
      
      
      void ChanB_ISR()
      {
         pinChanged = ChanB;
         inState[ChanB] = BtnB.read();
      }
      
      
      void ChanC_ISR()
      {
        pinChanged = ChanC;
        inState[ChanC] = BtnC.read();
      }
      
      
      void ChanD_ISR()
      {
        pinChanged = ChanD;
        inState[ChanD] = BtnC.read();
      }
      

      So when the node wakes up from sleep the variable pinChanged carries the number of the pin that has made it enter the ISR. That can be used to take action. After everything is handled pinChangedis set to the resting value (255 in this case).

      Depending on whether the circuit is powered by a battery or a 5V supply the node enters sleep state or simply loops without doing anything. When sleeping I use sleep(0xff,0x00, 0xff, 0x00, 0); When using any other call to sleep, it will not work (the node never wakes up). So I got a hint from one of the developers how to solve it, and I have yet to try that. But I'll keep you updated here (and the other thread).

      I hope this helps you a bit further.

      posted in General Discussion
      DavidZH
      DavidZH
    • RE: ๐Ÿ’ฌ Security & Signing

      I had exactly the same issue. This UK eBay store sells them per 5. Not sure what they'll ask for sending them across the ocean.
      I got them from here (4 days from UK to NL). Got one up in my gateway and that works with a soft signing node. Should be good.

      posted in Announcements
      DavidZH
      DavidZH
    • RE: Pin Change Interrupt on "any" pin.

      Yes, that is possible , but for now only when using only the interrupt pin to wake up the node. If you want to periodically send a sensor value you'll need to use another way. (Or be patient, as we are trying to find out what and why ๐Ÿ˜ )

      posted in General Discussion
      DavidZH
      DavidZH
    • RE: ๐Ÿ’ฌ 4-channel switcher/dimmer

      @scalz

      I agree with the comments about the varistor, it can certainly help with spikes. But only around 10 times. After that, the varistor will fail. Violently. In Europe, Australia and North America that will not be a big problem, but in countries with a little less reliable grid that could be within a year.
      When the MOV fails, it will become a short across the live and neutral, so ALWAYS put your varistor/MOV behind the primary fuse so that that will blow and stop the current across. Otherwise you'll have a nice fire inside the switchbox...

      little story: a friend of mine lives in the Carribean and they have a sketchy power grid there. One day the fridge was "tingly", so we start searching. Few minutes later: POOF!: magic smokes escapes from the power conditioner for the TV. OK. Something's really wrong here.
      So we suspected the wiring because of the corrosive nature of the air there (warm, humid sea breeze). Switch off the power, and start opening switchboxes and outlets (all US 120V system), we start finding all sorts of weird stuff like a circuit that is spliced off, goes into the floor and exits in another box, that is also fed directly from the panel.....

      So a few hours later we have checked everything, ripped out some unused wires and checked all connections and switch all back on. Still auchie on the fridge. So after a few minutes unplugging all appliances and socketstrips it was gone!

      It was a socket strip with net filter. The MOVS had blown and created a short to earth. And since the US system does not use RCDs on all circuits that could go on for a while.

      Moral of the story: MOVs can do good. And bad. Use them wisely!

      posted in OpenHardware.io
      DavidZH
      DavidZH
    • RE: In wall light switch node - Custom PCB

      @Samuel235
      As far as I know the power to the switches is AC. Only a simple transformer, and Bob your uncle. They do also work on DC, as they only use a short pulse to change state.
      Here in NL only a handful have an installation like that. I am most certainly not opposed to it, but most houses over here do not have room for a huge switch box needed for such an installation. And another plus is that those relays can stay and you only have to add your domotica controls to the panel. Only difficult thing is the feedback to the controller of the state. You'd have to add auxilary contacts, or measure the live wire.

      I do not have a system like this but was just explaining what Artipi has.

      And I think there are some other things in the UK electrical system that need te be dead and buried in a hurry. Like the 32A ring circuit.... ๐Ÿ˜ฃ

      posted in Hardware
      DavidZH
      DavidZH
    • RE: In wall light switch node - Custom PCB

      @Samuel235

      In Germany and also in Belgium a lot of house installations have been built with pulse relays and 0-10V dimmers in a central switch box and only 12V controls to the switches. Makes for a bit more work when building the home (conduit from the fusebox to all seperate switch boxes) but changes during the lifetime are a breeze.

      posted in Hardware
      DavidZH
      DavidZH
    • RE: [SOLVED] radio will connect to gateway with touch radio board with finger!!!

      And if you use wait(100); in stead of delay() you might have even less NACKs!

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: BME280 failing to initialize after spikes in readings

      Yes. Correct. call BME.begin() every time and the subroutine only at the beginning.

      And you are also correct about the library. I use the "blue" lib, from Sparkfun. As i can recall correct (it's been over a year since I built the damn thing) I have tried both, and found the Sparkfun more stable.

      And you CAN switch off power for this module, but after conversion it goes to sleep and uses less than 1uA. Hardly worth the effort, because the current can find a way over the data lines, and that's a pain in the behind to solve (I tried!).

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: BME280 failing to initialize after spikes in readings

      I have the same module, and I initially had issues to get it going.

      What I did: I set the BME to single measure mode in the setup with this subroutine:

      void startBME()
      {
        BME.settings.commInterface = I2C_MODE;
        BME.settings.I2CAddress = BMEaddr;
        BME.settings.runMode = 1;            //  1, Single mode
        BME.settings.tStandby = 0;           //  0, 0.5ms
        BME.settings.filter = 0;             //  0, filter off
        BME.settings.tempOverSample = 1;
        BME.settings.pressOverSample = 1;
        BME.settings.humidOverSample = 1;  
        
        BME.begin();
      }
      

      And next to that I call BME.begin(); every time the sensor is read.

      Nice and simple sketch by the way! ๐Ÿ™‚

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: MYS Library Startup Control ? After()? OnRegistration()?

      @tekka

      Found it! I added a #ifndef so I do not have to change it every time I program a node (and forget at what setting it is the next time....).

      posted in General Discussion
      DavidZH
      DavidZH
    • RE: MYS Library Startup Control ? After()? OnRegistration()?

      @tekka

      to follow up on this: I am trying to build a robust network so for my battery nodes I need to limit the parent finding to save some energy. These two defines work very well.
      #define MY_TRANSPORT_STATE_RETRIES 2 works also, but when I try to use #define MY_TRANSPORT_MAX_TSM_FAILURES 1 the counter still goes up to 7 before the extended failure mode is entered with the longer wait period.

      Am I doing something wrong, or is this broken in some way?

      posted in General Discussion
      DavidZH
      DavidZH
    • RE: MY_TRANSPORT_DONT_CARE_MODE

      @mfalkvidd said in MY_TRANSPORT_DONT_CARE_MODE:

      Could we collect some use cases on where controller availability is useful?

      I am changing my main light switches in the house for MySensorized ones to include extra's like notification of the house-state (at home, away, night), remote switching of some lights and the ceiling fan. If the controller (or just gateway for that matter) is down, the WAF would plummet like a boulder dropped from an airplane. Whatever happens, the light switches MUST ALWAYS FUNCTION!

      Then when the link returns, the control must be passed over to the controller without states changing. "Oh, I think Pimatic is working again because the light goes off...." <- bad for WAF...

      These light switches will be powered by the utility, so they can go search for a parent until hell freezes over, I dont care (as long as the switch function is working).
      Battery powered sensors on the other hand do not have that luxury, because of the battery drain. So they could benefit from knowing link status also by searching for a parent once, and if none is found, go back to sleep for their usual schedule in a hurry! Do not even try to read or send a sensor value.

      Now I have planned two magentic door sensors on battery. That will prove difficult because these will not have a schedule to send once every few minutes. So I will have to build something for that. These will be part of a personal alarm system (no sirens, just push messages), so lots of empty batteries and false messages will drive down the WAF as well.

      This has to be implemented in my controller (Pimatic in my case) as well. If Pimatic stops for some reason, the gateway has to stop as well. But that's something for another forum....

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Sleep function breaks code

      first of all you should change the delay(2000) right after the sleep to wait(2000). Effect is exactly the same, but this will not stop your Arduino from doing anything. For the rest I'm not sure why the communication between your Arduino and radio stops. TNR is indeed "Transport not ready"...

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Signing of messages is ignored. [2.1.1]

      OK. I have no problem with signing all my nodes. Does a whitelist on the GW make any difference (as in; link nodeID and serial together. No match -> not accepted)?

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Signing of messages is ignored. [2.1.1]

      Ah. I had missed that. I had in my mind that when I use whitelisting in my GW, nodes without a signature would be dismissed.
      So actually I can NOT assume my nodes are untouched when the GW receives a message. If I exchange a node that uses signing for one that doesn't with the same ID number, I'd be none the wiser, but could rely on fake info... I'd say that's not what's was originally intended. It makes the signing completely useless! Unless I set that flag that requires ALL nodes to sign their messages (which would be?).

      I personally think the GW should be very strict. If there is a whitelist, the GW should ignore unsigned messages from nodes, even if they are on the list. As it is now, signing is only useful between two nodes.

      I have added the verbose output for the signing: No mention of any signing action in the GW.

      0;255;3;0;9;MCO:BGN:INIT GW,CP=RRNGAS-,VER=2.1.1
      0;255;3;0;9;TSM:INIT
      0;255;3;0;9;TSF:WUR:MS=0
      0;255;3;0;9;TSM:INIT:TSP OK
      0;255;3;0;9;TSM:INIT:GW MODE
      0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
      0;255;3;0;9;MCO:REG:NOT NEEDED
      0;255;3;0;14;Gateway startup complete.
      0;255;0;0;18;2.1.1
      0;255;3;0;9;MCO:BGN:STP
      0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:21.2
      100;1;1;0;0;21.2
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=0,c=1,t=1,pt=7,l=5,sg=0:36.0
      100;0;1;0;1;36.0
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:21.1
      100;1;1;0;0;21.1
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=0,c=1,t=1,pt=7,l=5,sg=0:36.0
      100;0;1;0;1;36.0 
      

      And after rebooting the NODE:

      0;255;3;0;9;TSF:MSG:READ,100-100-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSF:MSG:BC
      0;255;3;0;9;TSF:MSG:FPAR REQ,ID=100
      0;255;3;0;9;TSF:PNG:SEND,TO=0
      0;255;3;0;9;TSF:CKU:OK
      0;255;3;0;9;TSF:MSG:GWL OK
      0;255;3;0;9;Will not sign message for destination 100 as it does not require it
      0;255;3;0;9;TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
      0;255;3;0;9;TSF:MSG:PINGED,ID=100,HP=1
      0;255;3;0;9;Will not sign message for destination 100 as it does not require it
      0;255;3;0;9;TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      0;255;3;0;9;Mark node 100 as one that do not require signed messages
      0;255;3;0;9;Mark node 100 as one that do not require whitelisting
      0;255;3;0;9;Informing node 100 that we do not require signatures
      0;255;3;0;9;Informing node 100 that we do not require whitelisting
      0;255;3;0;9;Will not sign message for destination 100 as it does not require it
      0;255;3;0;9;TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.1.1
      100;255;0;0;17;2.1.1
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.1.1
      100;255;0;0;17;2.1.1
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
      100;255;3;0;6;0
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=11,pt=0,l=17,sg=0:sys-clima-outside
      100;255;3;0;11;sys-clima-outside
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=12,pt=0,l=3,sg=0:2.0
      100;255;3;0;12;2.0
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=0,c=0,t=7,pt=0,l=0,sg=0:
      100;0;0;0;7;
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=0,t=6,pt=0,l=0,sg=0:
      100;1;0;0;6;
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=2,c=0,t=6,pt=0,l=0,sg=0:
      100;2;0;0;6;
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
      0;255;3;0;9;Will not sign message for destination 100 as it does not require it
      0;255;3;0;9;TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:21.2
      100;1;1;0;0;21.2
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=0,c=1,t=1,pt=7,l=5,sg=0:35.9
      100;0;1;0;1;35.9
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:21.2
      100;1;1;0;0;21.2
      

      That was with a whitelist of one node (#95) with a random serial.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Most reliable light switch

      I am working on such a node, but am still in the programming and testing stage. I will come back here when I have positive results!

      posted in Development
      DavidZH
      DavidZH
    • Signing of messages is ignored. [2.1.1]

      I had some trouble with the personalization of a 1 MHz node in this topic. That was resolved swiftly. I chose to abandon the 1MHz node because of a lot of "signing verification fail" in the debug. When I flashed a 8 MHz Optiboot those had vanished completely.

      Now the next one. I am testing the behavior of my nodes in different circumstances, like what happens when the GW concks out? Now I have tried to see what happens in the different signing modes.
      When both the node and gateway have keys and serials, these get exchanged and verified properly. Now I cleared the EEPROM of the node and reprogrammed a HTU21D sensor. When I have set

      #define MY_SIGNING_SOFT
      #define MY_SIGNING_REQUEST_SIGNATURES
      #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      #define MY_SIGNING_NODE_WHITELISTING {{.nodeId = 95,.serial = {0x39,0x5D,0xFB,0x7B,0x57,0xDF,0x90,0x70,0x22}}}
      

      in the gateway, I'd expect to see rejected messages, but none of that!

      gateway debug:

      0;255;3;0;9;MCO:BGN:INIT GW,CP=RRNGAS-,VER=2.1.1
      0;255;3;0;9;TSM:INIT
      0;255;3;0;9;TSF:WUR:MS=0
      0;255;3;0;9;TSM:INIT:TSP OK
      0;255;3;0;9;TSM:INIT:GW MODE
      0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
      0;255;3;0;9;MCO:REG:NOT NEEDED
      0;255;3;0;14;Gateway startup complete.
      0;255;0;0;18;2.1.1
      0;255;3;0;9;MCO:BGN:STP
      0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:20.9
      100;1;1;0;0;20.9
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=0,c=1,t=1,pt=7,l=5,sg=0:34.8
      100;0;1;0;1;34.8
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:20.9
      100;1;1;0;0;20.9
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=0,c=1,t=1,pt=7,l=5,sg=0:34.8
      100;0;1;0;1;34.8
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:20.9
      100;1;1;0;0;20.9
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=0,c=1,t=1,pt=7,l=5,sg=0:34.7
      100;0;1;0;1;34.7
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:21.0
      100;1;1;0;0;21.0
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=0,c=1,t=1,pt=7,l=5,sg=0:34.6
      100;0;1;0;1;34.6
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:20.9
      100;1;1;0;0;20.9
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=0,c=1,t=1,pt=7,l=5,sg=0:34.8
      100;0;1;0;1;34.8
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:20.9
      100;1;1;0;0;20.9
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=0,c=1,t=1,pt=7,l=5,sg=0:34.8
      100;0;1;0;1;34.8
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:20.9
      100;1;1;0;0;20.9
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=0,c=1,t=1,pt=7,l=5,sg=0:34.8
      100;0;1;0;1;34.8
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:20.9
      100;1;1;0;0;20.9
      0;255;3;0;9;TSF:MSG:READ,100-100-0,s=0,c=1,t=1,pt=7,l=5,sg=0:34.8
      100;0;1;0;1;34.8
      

      node debug:

      470882 TSF:MSG:SEND,100-100-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:21.0
      471005 TSF:MSG:SEND,100-100-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:34.6
      Messages sent. Sleep.
      
      471140 MCO:SLP:MS=9523,SMS=0,I1=255,M1=255,I2=255,M2=255
      471150 MCO:SLP:TPD
      471152 MCO:SLP:WUP=-1
      Wake up.
      
      Reading sensors
      Temperature read, humidity read, temperature:	21.01	21.01	0
      humidity:		34.58	34.59	0
      heartbeat:		1	sendBatt:	2
      batt voltage:	0.0
      
      Sending...
      471377 TSF:MSG:SEND,100-100-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:21.0
      471500 TSF:MSG:SEND,100-100-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:34.6
      Messages sent. Sleep.
      
      471635 MCO:SLP:MS=9523,SMS=0,I1=255,M1=255,I2=255,M2=255
      471646 MCO:SLP:TPD
      471648 MCO:SLP:WUP=-1
      Wake up.
      
      Reading sensors
      Temperature read, humidity read, temperature:	21.00	21.01	0
      humidity:		34.65	34.58	0
      heartbeat:		2	sendBatt:	2
      batt voltage:	0.0
      
      Sending...
      471873 TSF:MSG:SEND,100-100-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:21.0
      471996 TSF:MSG:SEND,100-100-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:34.7
      Messages sent. Sleep.
      
      472131 MCO:SLP:MS=9523,SMS=0,I1=255,M1=255,I2=255,M2=255
      472141 MCO:SLP:TPD
      472143 MCO:SLP:WUP=-1
      Wake up.
      
      Reading sensors
      Temperature read, humidity read, temperature:	20.99	21.00	0
      humidity:		34.63	34.65	0
      heartbeat:		3	sendBatt:	2
      batt voltage:	0.0
      
      Sending...
      472369 TSF:MSG:SEND,100-100-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:21.0
      472492 TSF:MSG:SEND,100-100-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:34.6
      Messages sent. Sleep.
      
      472627 MCO:SLP:MS=9523,SMS=0,I1=255,M1=255,I2=255,M2=255
      472637 MCO:SLP:TPD
      

      So, how do I proceed from here? Because there will be some nodes in my setup that I would like to be signed.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Signing ATSHA Key?

      Thanks a bunch! That did it! I always forget to use the "find" when I'm doing things like this. And the serial.begin was in line 881, I didn't expect it to be that far down.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Signing ATSHA Key?

      I had already tried that (I just did again, to be absolutely certain) but even at 4800 I still get garbage. I know 9600 baud works because of a test I had running before I tried the personalization sketch. I added the
      #define MY_BAUD_RATE 4800 before the inclusion of the MySensors.h file.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Signing ATSHA Key?

      I'd like to ask a follow up question to this old topic:

      I have been able to create a set of keys using my GW on a Moteino (16MHz).

      Now I'd like to program the keys into a some nodes. A few of these are running a bare 328p at 1MHz as a battery sensor, but a baudrate of 115k is a bit high. I only get garbage in the serial window, so no checking if the keys are stored properly.
      Wouldn't it be wise to lower the baudrate of that sketch to be able to accomodate slow battery sensors. I have looked to try to do it myself, but was unable to find where.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: ๐Ÿ’ฌ Atmospheric Pressure Sensor

      @Luc3as

      The forecast script is meant to be running every minute to collect the averaging data. If you run it every 5 minutes, you need to change the dividers in the script to come to a hPa/h value that actually makes sense.

      posted in Announcements
      DavidZH
      DavidZH
    • RE: Multiple gateways : Node ID unique per gateway or overall ?

      You need to give every node a unique address, otherwise Domoticz is unable to tell which of the gateways to access when you request an action.

      posted in General Discussion
      DavidZH
      DavidZH
    • RE: Pin change interrupt not firing with MySensors

      @Yveaux I will try that as soon as I'm back from my winter sports vacation (as far as you can call lush green Alpine meadows that. At least the slopes are well maintained!). I have no access to a node and gateway now.

      For me it worked for that sketch as it's main function is reading momentary switches, either on mains power or on battery. As soon as I want to add a sensor that needs to send it's info on a set interval I needed it to be on mains power.

      But like I said, I will convert the sketch to 2.1 this week, and next week I'll give the workaround a shot.
      Keep you posted!

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Pin change interrupt not firing with MySensors

      In one sketch I am using pin change interrupt. But that is a node I built from scratch. I have the feeling the issues arise with the MyS function "sleep()" in combination with a set time. As long as I call sleep(0xff,0x00, 0xff, 0x00, 0);
      pin change interrupts work. As soon as I change any of the parameters, the node will not wake up anymore.

      That was on 2.0 I have yet to convert and try it on 2.1.

      As soon as I have done that, I will post the code .

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: [2.1 Beta] Program 'chapter' order changed since 2.0

      @mfalkvidd

      Thanks! I should check Github moe often I guess. ๐Ÿ˜

      posted in Development
      DavidZH
      DavidZH
    • [2.1 Beta] Program 'chapter' order changed since 2.0

      Not sure if this is in the right category:

      Yesterday I changed my library to the latest Github Beta and the sketch I am finalising now ran in a different order!
      Previously, the "setup" runs before "presentation". In 2.1 its the other way round! It's not a big problem for me, I can program around that with a "before" function, but a lot of people could be very confused.

      In my setup the sketch reads some defines to find out what sensor to present, so that's why it matters for me here.

      Was this intended behaviour? Or a little oversight?

      Keep up the good work!

      posted in Development
      DavidZH
      DavidZH
    • RE: So many arduino and radio choices!

      Welcome to the club!

      Regarding radio's: The RFM69's with a C in the type have a smaller form factor (which is pin compatible with the predecessor RFM12B). The the 'W' and "HW' versions are larger in size and have more programmable pins (which MySensors does not use) but have exactly the same functionality within MyS.

      All the footprints on the boards available in OpenHardware.io are for the 'W' and 'HW' versions so I'd go with one of these.
      The 'W' uses way less power than the 'HW' which would be good the for the battery life of your nodes. Sensors powered by the grid can be 'HW', but usually, in the house a 'W' delivers enough TX power to get the message across. It might be a good idea to make your gateway with a 'HW'.

      Hope this gets you a bit further. Good luck and show us your results!

      posted in Hardware
      DavidZH
      DavidZH
    • RE: RFM69 range issues

      I find it very strange you experience these kind of problems. I have been using the RFM69 (both W and HW) since I started with MySensors a year ago.
      The only time I had trouble with the range (or any transmission at all..) was when I used double sided perf-board to build my circuits on. Somehow the extra exposed copper reflects the RF energy in an unpredictable way so the radio will not send at all.

      Can you post a picture of your setup? Maybe we spot a tiny little thing that eff's up your testing.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Farming flood light DIY - universe 720w flood light

      That's a tough one. There are LED replacement fixtures, but to cover the same area you'd need a very expensive one.
      MH lamps should not bust easily, so you have to make sure the lamp and the ballast are a match. If the ballast is for a bigger lamp, yours gets an ass whooping every time it starts, dramatically diminishing it's life.

      For large areas, MH will provide the most efficient way to light the lot up. But make sure the fixture and lamp are a perfect match. There are LED replacements, but those units cost an arm and a leg. Cheaper China alternatives will be more expensive in the long run, because they don't run efficient, and fry a lot because of poor thermal design.

      My 2ยข: get a replacement MH lamp. Maybe adjust your lighting schedule a little to keep the lamps to live longer; less starts per day, and keep lighting hours to a minimum.

      Good luck!

      posted in General Discussion
      DavidZH
      DavidZH
    • RE: PN532 NFC RFID module V3 kits : Didn't find PN53x board

      In your sketch, remove everything above, and including #else and also the line #endif. You only need the I2C declarations in your case.

      Good luck!

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Option non blocking registration at gateway

      @Heizelmann

      I've been thinking about his as well. Probably for different reasons though.

      I find myself with time to spare and my laptop at hand quite often, but I'm not home at those moments. I'd love to be able to write code and test sensors at those times, but that's impossible because there's no gateway.

      For that I'd like to propose a "Test Mode".

      • test port to Transport.
      • NO connection to gateway.
      • simulate the Transport calls in the sketch with just a line in the debug with ACK.
      • when possible: send "messages" to node with the Arduino serial monitor.

      I am aware that this might pose some biiiiiiig changes in the lib. So this might be something for the 2.5 or 3.0 release.
      Thoughts?

      posted in Feature Requests
      DavidZH
      DavidZH
    • RE: Sending multiple presentation request fails

      Replace the delay() with wait(). That function has the same outcome in your sketch but does not block the Duino from executing code in the background (witch is what MySensors is taking care of for you). In your case the acknowledgement from the controller is not processed by your node because you stopped the Duino for 100ms.

      A wait for about 20 to 50 ms should do the trick easily!

      And to answer your second question: yes, it is possible that it is a power related problem. Do you have a large-ish capacitor (4,7 - 10ยตF) neat the power pins for your radio?

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: ๐Ÿ’ฌ Various bootloader files based on Optiboot 6.2

      @GertSanders
      No worries! It just caught my eye and was wondering. I'll keep an eye on this as I'm finalising my node network and have to choose a bootloader about now.

      posted in OpenHardware.io
      DavidZH
      DavidZH
    • RE: ๐Ÿ’ฌ Various bootloader files based on Optiboot 6.2

      @GertSanders : Ive downloaded the files and boards.txt. I noticed you've made a distinction between the 28p DIP and the 32p TQFP. But in the boards.txt I can find no differences besides that the high fuse bits are global for the 28p version and individual (but all the same!) for the 32p version.
      Does that have a reason?

      posted in OpenHardware.io
      DavidZH
      DavidZH
    • RE: RFM69HW temp-humidity node

      Yesssss! A RFM "slim node". Way better than using an adapter board for the radio. Will you be sharing the designs for both the TH and SMD versions?

      posted in My Project
      DavidZH
      DavidZH
    • RE: Gateway freezes again

      I have the same setup; Moteino USB with RFM69HW, and mine has been running non stop for three weeks now.

      I'm using Pimatic as controller.

      I'm afraid the issue might be in your serial communication handling.

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: MySensors 2.0.0 Released

      @Yveaux

      I have now recompiled my node that was on 2.0DEV to 2.0Stable and it will not fly. So tomorrow I will recompile my gateway to see if that runs better.

      I really have to get used to the new debug output though. But it give a lot more info!

      posted in Announcements
      DavidZH
      DavidZH
    • RE: MySensors 2.0.0 Released

      I have just done as said above and works a treat! I was still running on Arduino 1.6.1 but this was enough reason to update!

      One question: my serial gateway is still running on 1.5, do I have to update that to 2.0?
      I have one node running on 2.0b and that talks just fine. New nodes will follow soon (PCBs are being printed now...) so they will be on 2.0 as well.

      posted in Announcements
      DavidZH
      DavidZH
    • RE: [SOLVED] Development branch: st=fails after node sleep

      Well, I DID do it wrong!
      Thanks to @Dirk_H in another topic I changed my call to sleep to sleep(0xff, 0x00, 0xff, 0x00, 0);, and presto, goin'....

      SOLVED!

      posted in Troubleshooting
      DavidZH
      DavidZH
    • RE: Slim Node Si7021 sensor example

      Thanx! Saves me a trip! ๐Ÿ˜

      posted in My Project
      DavidZH
      DavidZH
    • RE: Slim Node Si7021 sensor example

      I switch them off with a LOW write before the sensor goes to sleep and you're absolutely right about the wait time being very long. In this case I didn't mind because the sensor is powered by a solar panel.
      I can't really remember what the exact value but it was an order of magnitude... I also used the voltage divider way to measure voltage because the Moteino has a regulator on board, so that upped the sleep current a little (10M resistor to keep the current low).

      I went searching because the current went UP when I switched the power to the sensor off before sleep. Gammon.co.au is a very useful source, but I can't remember where I dug this hack up.
      I will be making other battery sensors for inside with a HTU21d and I will post more on those in a 'My Project' mega gallery including measurements. (And dig around in the HTU datasheet for the start up time....)

      posted in My Project
      DavidZH
      DavidZH
    • RE: Slim Node Si7021 sensor example

      You could also use the 328 pullups! I had an unwilling Chinese light sensor (MAX44099) that drew a lot of power either with the VCC on or off. Since it's battery powered that is undesireable.

      I used digitalWrite(SDA, LOW); digitalWrite(SCL, LOW); to tie the bus to ground. When the sensor wakes up, it writes HIGH to those pins and the bus is back online. Used a 500ms wait after this to let the sensors stabilise.

      That sensor is now on a 6ยตA sleep current and a average 128ยตA over 2 hours measured with a 2 minute sleep cycle.

      posted in My Project
      DavidZH
      DavidZH