Nodemanage + EasyPCB Sleep



  • @user2684 @sundberg84

    I am currently using Nodemanager 1.8dev, MySensors 2.3.1. I have built a battery sensor using EasyPCB rev10 with SSD1306, DHT22, and motion sensor. By all accounts it appears to go to sleep according to debug logging, but at least the display does not turn off which leads me to believe the DHT and motion sensor are also consuming power. I have them wired to the 3.3v and GND rows on the EasyPCB. Below is my current sketch.

    /**********************************
     * MySensors node configuration
     */
    
    // General settings
    #define SKETCH_NAME "NodeManager TempHumMotionDisplayBatteryNode"
    #define SKETCH_VERSION "1.0"
    
    #define MY_DEBUG
    #define MY_DEBUG_VERBOSE_RFM69
    
    // Enable and select radio type attached
    #define MY_RADIO_RFM69
    
    // Define this to enable the improved RFM69 driver
    #define MY_RFM69_NEW_DRIVER
    
    // The frequency to use.
    #define MY_RFM69_FREQUENCY RFM69_915MHZ
    
    // Define this if you are using the RFM69HW
    #define MY_IS_RFM69HW
    
    // Advanced settings
    #define MY_BAUD_RATE 9600
    //#define MY_SMART_SLEEP_WAIT_DURATION_MS 500
    #define MY_SPLASH_SCREEN_DISABLED
    //#define MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
    //#define MY_SIGNAL_REPORT_ENABLED
    
    /***********************************
     * NodeManager configuration
     */
    
    #define NODEMANAGER_DEBUG ON
    #define NODEMANAGER_INTERRUPTS ON
    #define NODEMANAGER_SLEEP ON
    #define NODEMANAGER_RECEIVE ON
    #define NODEMANAGER_DEBUG_VERBOSE ON
    #define NODEMANAGER_POWER_MANAGER ON
    #define NODEMANAGER_CONDITIONAL_REPORT OFF
    #define NODEMANAGER_EEPROM OFF
    #define NODEMANAGER_TIME OFF
    #define NODEMANAGER_RTC OFF
    #define NODEMANAGER_SD OFF
    #define NODEMANAGER_HOOKING OFF
    #define NODEMANAGER_OTA_CONFIGURATION OFF
    #define NODEMANAGER_SERIAL_INPUT OFF
    
    // import NodeManager library (a nodeManager object will be then made available)
    #include <MySensors_NodeManager.h>
    
    /***********************************
     * Add your sensors
     */
    
    //PowerManager power(5,6);
     
    #include <sensors/SensorBattery.h>
    SensorBattery battery;
    
    #include <sensors/SensorDHT22.h>
    SensorDHT22 dht22(5);
    
    #include <sensors/SensorMotion.h>
    SensorMotion motion(3);
    
    #include <sensors/DisplaySSD1306.h>
    DisplaySSD1306 ssd1306;
    
    /***********************************
     * Main Sketch
     */
    
    // before
    void before() {
    	
      /***********************************
       * Configure your sensors
       */
       
      // EXAMPLES:
      // report measures of every attached sensors every 15 minutes
      nodeManager.setReportIntervalMinutes(15);
      // set the node to sleep in 15 minutes cycles
      nodeManager.setSleepMinutes(15);
      // report battery level every 60 minutes
      battery.setReportIntervalMinutes(60);
      // power all the nodes through dedicated pins
      //nodeManager.setPowerManager(power);
    
      // call NodeManager before routine
      nodeManager.before();
    }
    
    // presentation
    void presentation() {
      // call NodeManager presentation routine
      nodeManager.presentation();
    }
    
    // setup
    void setup() {
      // call NodeManager setup routine
      nodeManager.setup();
    }
    
    // loop
    void loop() {
      // call NodeManager loop routine
      nodeManager.loop();
    }
    
    #if NODEMANAGER_RECEIVE == ON
    // receive
    void receive(const MyMessage &message) {
      // call NodeManager receive routine
      nodeManager.receive(message);
    }
    #endif
    
    #if NODEMANAGER_TIME == ON
    // receiveTime
    void receiveTime(unsigned long ts) {
      // call NodeManager receiveTime routine
      nodeManager.receiveTime(ts);
    }
    #endif
    
    

    Do i need to uncomment the below and set to an available IO pin

    //PowerManager power(5,6);
    

    and connect the each sensor's VCC to said IO pin?


  • Hardware Contributor

    @ElCheekytico sorry - I do not know the software and how this works, but if you power a display and other sensors through VCC it will still consume power. One option (if the do not use to high current) is to power them through a digital pin and set this pin to high or low before sleep to make them shut down completley., Not sure if this is possible with a display since it maybe takes quite much current (???).



  • @sundberg84 said in Nodemanage + EasyPCB Sleep:

    @ElCheekytico sorry - I do not know the software and how this works, but if you power a display and other sensors through VCC it will still consume power. One option (if the do not use to high current) is to power them through a digital pin and set this pin to high or low before sleep to make them shut down completley., Not sure if this is possible with a display since it maybe takes quite much current (???).

    I wondered about that as well. My thinking has been going down the path of using a transistor and triggering it from the IO pin.


  • Hardware Contributor

    @ElCheekytico - even better with transistor if you know how, atleast for the higher current things



  • @sundberg84 said in Nodemanage + EasyPCB Sleep:

    @ElCheekytico - even better with transistor if you know how, atleast for the higher current things

    This is exactly what I'm trying to achieve these days with an Attiny. Found a way to toggle on/off with one button: http://www.technoblogy.com/show?VOO (scroll down). When OFF; ATtiny is is a 0.5uA (!) sleep.

    Now I want to swicth the full 10Amps on 40V with that aw..Tiny signal.
    @sundberg84 do you know how to boost the signal to a (couple of) transistor(s)?

    Any advice would be highly appreciated!


  • Hardware Contributor

    @bikerMark, not sure - 10A is quite the current, i think you need some sort of relay for this. Not sure - be sure to be careful and check the datasheets .


  • Contest Winner

    @ElCheekytico from the NodeManager's side, yes preferred option is to use PowerManager and connect vcc and gnd pins of the sensors to the configured two pins so that NodeManager can turn them on and off all sensors in between sleeping cycles. For these situations I usually solder a MCP1702 or similar on the prototyping area of the EasyPCB and connect sensors from there so to keep it small and self-contained.



  • @user2684 The MCP1702 appears to be a voltage regulator. Are you running a higher input voltage? I am running a pro mini on the easyPCB powered by 2xAA. All the DHT22, PIR, and SSD1306 are all powered at 3.3v. My idea was to use a 2n2222a with base to D6 and E to ground and C negative of sensors. Based on a forum post or issue on your github I saw that we can pass in -1 for the ground pin of the PowerManager constructor and of course 6 would be the power pin. Does this sound like it will work?



  • @ElCheekytico, I was asking myself the same question about @user2684 approach.

    For my power hungry sensors I'm experimenting using an 2n2222A Transistor with mixed success. (following this and that instructions ).

    All works OK with sensors as DHT22 and similar digital devices, but I can't make it work with Analog sensors as an soil moisture sensor. I need to test, but I believe is because the voltage drop disturbing the AREF.



  • @MatiasV to switch on/off power to sensors and oled displays it is best to use a logic level P-channel Fet, something like an Si2305, it is not good practice to switch power to sensors/displays by switching the ground, it's OK for a relay though.

    See this link
    https://www.avrfreaks.net/forum/hi-side-fet-switch-low-voltage


  • Contest Winner

    @ElCheekytico my bad sorry I was referring to a PNP2222a or similar and for some reason I wrote down MCP1702. Yes, this is the approach I'm using as well, just pass the vcc pin which is activating the transistor hence powering on the sensor. You should use also some resistors, for sure to drive the base, potentially on the collector/emitter depending on the transistor you are using



  • @user2684 Thanks for the confirmation. Now I'm just not sure if I have enough IO pins without wiring directly from pro mini.

    @sundberg84 how many IO pins are actually available on easypcb rev10 without wiring directly from pro mini? I'm using D3 for PIR, A4/A5 for oled i2c, and D5 for DHT22. I think A0 is for battery voltage and D2 for RFM69. Maybe D6 and A1?


  • Hardware Contributor

    @ElCheekytico correct, every pin you have on the mysx connector.



  • @user2684 Did you experience any problems reading analog sensors that are powered via a transistor? I can not get reliable measurements from Capacitive Soil moisture Sensors when they are switched by a transistor.



  • @MatiasV said in Nodemanage + EasyPCB Sleep:

    @user2684 Did you experience any problems reading analog sensors that are powered via a transistor? I can not get reliable measurements from Capacitive Soil moisture Sensors when they are switched by a transistor.

    @MatiasV - How are you wiring up your transistor?
    Can you see the Voltage to the Sensor switching?



  • @bikerMark said in Nodemanage + EasyPCB Sleep:

    @sundberg84 said in Nodemanage + EasyPCB Sleep:

    @ElCheekytico - even better with transistor if you know how, atleast for the higher current things

    This is exactly what I'm trying to achieve these days with an Attiny. Found a way to toggle on/off with one button: http://www.technoblogy.com/show?VOO (scroll down). When OFF; ATtiny is is a 0.5uA (!) sleep.

    Now I want to swicth the full 10Amps on 40V with that aw..Tiny signal.
    @sundberg84 do you know how to boost the signal to a (couple of) transistor(s)?

    Any advice would be highly appreciated!

    I would not take too much notice of that Web Page schematics, he has drawn the Fets the wrong way around - this is on all his examples (He has mixed up the drawing of the P & N Mosfets)


  • Contest Winner

    @MatiasV Probably you would also need to wait a bit before reading after powering on the sensor. You can try adding a delay (in millis) as third argument to setPowerPins() of PowerManager so before the reading would take place, the Power Manager will wait a bit after power on and before giving control back to the sensor.



  • @sundberg84 thanks, prudence is needed indeed. I abandoned this scenario and now only switch the lower energetic part of the bike.


Log in to reply
 

Suggested Topics

  • 2
  • 11
  • 2
  • 1
  • 2
  • 1

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts