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

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
S

smilvert

@smilvert
About
Posts
38
Topics
5
Shares
0
Groups
0
Followers
1
Following
0

Posts

Recent Best Controversial

  • Best IDE to use for MySensors projects
    S smilvert

    @ivankravets Thanks a lot!! :)

    Now I think that it works with the latest commit on github->dev-branch.
    I will try it to night and if I got time I will publish my node code/building structure as well.

    Here was my platformio.ini file that I tested with:

    [env:pro8MHzatmega328]
    platform = atmelavr
    framework = arduino
    board = pro8MHzatmega328
    build_flags = -I/(PATH_TO_MYSENSORS_GITHUB)/libraries/MySensors
    lib_ignore = MySensors
    
    
    Development atmel studio eclipse debug visualmicro ide

  • platformio and mysensors for atmega328p on breadboard?
    S smilvert

    @n8henrie

    I have installed the mysensors lib from platformio (platformio lib install xx, or something like that)

    And my platformio.ini file look like this:

    [env:pro8MHzatmega328]
    platform = atmelavr
    framework = arduino
    board = pro8MHzatmega328
    

    I think you could remove the build_flags and the lib_ignore

    Troubleshooting

  • Why do "passive nodes" need to set their Node ID manually?
    S smilvert

    @NeverDie

    I have started to test node-red (Which dont work yet...) so I have created a dummy sketch for parse the data to domoticz.

    // Enable debug prints
    #define MY_DEBUG
    #define MY_GATEWAY_SERIAL
    
    // Enable passive mode
    #define MY_PASSIVE_NODE
    #define MY_REPEATER_FEATURE
    
    // Passive mode requires static node ID
    #define MY_NODE_ID 0
    
    // Enable and select radio type attached
    // #define MY_RADIO_NRF24
    //#define MY_RF24_PA_LEVEL RF24_PA_HIGH
    
    //#define MY_RADIO_NRF5_ESB
    //#define MY_RADIO_RFM69
    //#define MY_RADIO_RFM95
    
    #include <MySensors.h>
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define CHILD_ID_BINARY 2
    
    // Initialize general message
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgBinary(CHILD_ID_BINARY, V_STATUS);
    int counter = 0;
    float temperature = 0;
    float humidity = 0;
    int binary = 0;
    void setup()
    {
    }
    
    void presentation()
    {
      // Send the sketch version information to the gateway and controller
      sendSketchInfo("Passive node", "1.0");
    
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID_TEMP, S_TEMP);
      present(CHILD_ID_HUM, S_HUM);
      present(CHILD_ID_BINARY, S_BINARY);
    }
    
    void loop()
    {
      // generate some random data
      counter ++;
      if (counter == 20 ){
        temperature = 0;
        humidity = 0;
        counter = 0;
      }
      else
      {
        temperature = 25.0 + random(0,30)/10.0;
        humidity = 55.0 + random(-20,20);
      }
    /*
      if (binary == 0){
        send(msgBinary.set(binary,2));
        binary = 1;
      }else {
        send(msgBinary.set(binary,2));
        binary = 0;
    
      }
    */
      send(msgTemp.set(temperature,2));
      send(msgHum.set(humidity,2));
      wait(1000);
    }
    
    General Discussion

  • NRF52 -> Will not wake after sleep
    S smilvert

    Hi

    Finally I have had time to solder my project, Temp_hum, and started to create the code for it. But I struggle with some bascis

    Code for the sensor:

    
    #define MY_NODE_ID 37
    
    // Enable debug prints
    #define MY_DEBUG
    
    // #define MY_DEBUG_VERBOSE_NRF5_ESB
    #define MY_BAUD_RATE 115200
    
    // Enable and select radio type attached
    //#define MY_RADIO_RF24
    //#define MY_RADIO_RFM69
    //#define MY_RS485
    #define MY_RADIO_NRF5_ESB
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define CHILD_ID_VOLT 2
    
    #define IS_NRF52
    // #define IS_NRF51
    
    #define SHORT_WAIT 100
    
    // Sleep time between sensor updates (in milliseconds)
    static const uint64_t UPDATE_INTERVAL = 6000;
    
    static bool metric = true;
    
    float batteryPcnt;
    float oldBatteryPcnt;
    
    #include <MySensors.h>
    #include <SI7021.h>
    
    static SI7021 sensor;
    
    void disableNfc()
    { //only applied to nRF52
    
    #ifdef IS_NRF52
      //Make pins 9 and 10 usable as GPIO pins.
      NRF_NFCT->TASKS_DISABLE = 1; //disable NFC
      NRF_NVMC->CONFIG = 1;        // Write enable the UICR
      NRF_UICR->NFCPINS = 0;       //Make pins 9 and 10 usable as GPIO pins.
      NRF_NVMC->CONFIG = 0;        // Put the UICR back into read-only mode.
    #endif
    }
    
    void turnOffRadio()
    {
      NRF_RADIO->TASKS_DISABLE = 1;
      while (!(NRF_RADIO->EVENTS_DISABLED))
      {
      } //until radio is confirmed disabled
    }
    
    void turnOffAdc()
    {
    #ifndef IS_NRF52
      if (NRF_SAADC->ENABLE)
      { //if enabled, then disable the SAADC
        NRF_SAADC->TASKS_STOP = 1;
        while (NRF_SAADC->EVENTS_STOPPED)
        {
        }                      //wait until stopping of SAADC is confirmed
        NRF_SAADC->ENABLE = 0; //disable the SAADC
        while (NRF_SAADC->ENABLE)
        {
        } //wait until the disable is confirmed
      }
    #endif
    }
    
    void turnOffUarte0()
    {
    #ifndef IS_NRF52
      NRF_UARTE0->TASKS_STOPRX = 1;
      NRF_UARTE0->TASKS_STOPTX = 1;
      NRF_UARTE0->TASKS_SUSPEND = 1;
      NRF_UARTE0->ENABLE = 0; //disable UART0
      while (NRF_UARTE0->ENABLE != 0)
      {
      }; //wait until UART0 is confirmed disabled.
    #endif
    
    #ifdef IS_NRF51
      NRF_UART0->TASKS_STOPRX = 1;
      NRF_UART0->TASKS_STOPTX = 1;
      NRF_UART0->TASKS_SUSPEND = 1;
      NRF_UART0->ENABLE = 0; //disable UART0
      while (NRF_UART0->ENABLE != 0)
      {
      }; //wait until UART0 is confirmed disabled.
    #endif
    }
    
    void turnOffHighFrequencyClock()
    {
      NRF_CLOCK->TASKS_HFCLKSTOP = 1;
      while ((NRF_CLOCK->HFCLKSTAT) & 0x0100)
      {
      } //wait as long as HF clock is still running.
    }
    
    void mySleepPrepare()
    { //turn-off energy drains prior to sleep
      turnOffHighFrequencyClock();
      turnOffRadio();
      //turnOffUarte0();
    }
    
    void presentation()
    {
      Serial.println("Presentation");
      // Send the sketch info to the gateway
      sendSketchInfo("TemperatureAndHumidity", "1.2");
    
      // Present sensors as children to gateway
      present(CHILD_ID_HUM, S_HUM, "Humidity");
      delay(SHORT_WAIT);
      present(CHILD_ID_TEMP, S_TEMP, "Temperature");
      delay(SHORT_WAIT);
      present(CHILD_ID_VOLT, S_MULTIMETER, "Battery");
    
      metric = getControllerConfig().isMetric;
      Serial.println("End presention");
    }
    
    void setup()
    {
      Serial.println("Setup");
      hwInit();
      
      disableNfc(); //remove unnecessary energy drains
      turnOffAdc(); //remove unnecessary energy drains
      while (not sensor.begin())
      {
        Serial.println(F("Sensor not detected!"));
        wait(5000);
      }
      Serial.println("End Setup");
    }
    
    void mySleep(uint32_t ms)
    {
      mySleepPrepare();  //Take steps to reduce drains on battery current prior to sleeping
      sleep(ms);
    }
    
    void loop()
    {
      // Read temperature & humidity from sensor.
      const float temperature = float(metric ? sensor.getCelsiusHundredths() : sensor.getFahrenheitHundredths()) / 100.0;
      const float humidity = float(sensor.getHumidityBasisPoints()) / 100.0;
    
    #ifdef MY_DEBUG
      Serial.print(F("Temp "));
      Serial.print(temperature);
      Serial.print(metric ? 'C' : 'F');
      Serial.print(F("\tHum "));
      Serial.println(humidity);
    #endif
    
      static MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      static MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      static MyMessage msgBattery(CHILD_ID_VOLT, V_VOLTAGE);
    
      send(msgTemp.set(temperature, 2));
    
      wait(SHORT_WAIT);
      send(msgHum.set(humidity, 2));
    
      float batteryVolt = getInternalVoltage();
      batteryPcnt =(batteryVolt / 3.3) * 100;
      if (batteryPcnt > 100)
      {
        batteryPcnt = 100;
      }
    #ifdef MY_DEBUG
      Serial.print(F("Vbat "));
      Serial.print(batteryVolt);
      Serial.print(F(" Battery percent "));
      Serial.println(batteryPcnt);
    #endif
    
      // Battery readout should only go down. So report only when new value is smaller than previous one.
      if (batteryPcnt < oldBatteryPcnt)
      {
    
        wait(SHORT_WAIT);
        send(msgBattery.set(batteryVolt, 3));
        wait(SHORT_WAIT);
        if (batteryPcnt < oldBatteryPcnt)
        {
          sendBatteryLevel(batteryPcnt);
          oldBatteryPcnt = batteryPcnt;
        }
    
        // Sleep until next update to save energy
        // 
        
      }
      //delay(5000);
      mySleep(UPDATE_INTERVAL);
    }
    
    float getInternalVoltage()
    {
      return ((float)hwCPUVoltage()) / 1000.0;
    }
    
    

    Have some problems.

    First and biggest: The sensor will not wake,

    2577 TSF:MSG:SEND,37-37-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:33.34
    Vbat 3.29 Battery percent 99.67
    2587 MCO:SLP:MS=6000,SMS=0,I1=255,M1=255,I2=255,M2=255
    2591 TSF:TDI:TPD
    8593 MCO:SLP:WUP=-1
    8595 TSF:TRI:TPU
    Temp 23.46C	Hum 33.85
    8626 TSF:MSG:SEND,37-37-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:23.46
    8733 TSF:MSG:SEND,37-37-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:33.85
    Vbat 3.29 Battery percent 99.67
    8743 MCO:SLP:MS=6000,SMS=0,I1=255,M1=255,I2=255,M2=255
    8748 TSF:TDI:TPD
    

    (Some times I got stuck at:

    5803 MCO:SLP:MS=6000,SMS=0,I1=255,M1=255,I2=255,M2=255
    5807 TSF:TDI:TPD
    11809 MCO:SLP:WUP=-1
    11811 TSF:TRI:TPU
    Temp 22.69C	Hum 31.08
    11842 TSF:MSG:SEND,37-37-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:22.69
    

    )

    Second when im trying to debug with

    #define MY_DEBUG_VERBOSE_NRF5_ESB
    

    the node will not pass presentation.

    153 NRF5:SND:END=1,ACK=1,RTRY=1,RSSI=-55,WAKE=5
    4158 TSF:MSG:SEND,37-37-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.2
    4164 NRF5:SND:TO=0,LEN=8,PID=1,NOACK=0
    4169 NRF5:SND:END=1,ACK=1,RTRY=1,RSSI=-55,WAKE=4
    4174 TSF:MSG:SEND,37-37-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    4180 NRF5:RX:LEN=9,NOACK=0,PID=2,RSSI=-74,RX=0
    4184 TSF:MSG:READ,0-0-37,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    4190 NRF5:RX:LEN=8,NOACK=0,PID=1,RSSI=-53,RX=0
    4194 TSF:MSG:READ,0-0-37,s=255,c=3,t=6,pt=0,l=1,sg=0:M
    Presentation
    4200 NRF5:SND:TO=0,LEN=29,PID=2,NOACK=0
    4206 NRF5:SND:END=1,ACK=1,RTRY=1,RSSI=-55,WAKE=5
    4210 TSF:MSG:SEND,37-37-0-0,s=255,c=3,t=11,pt=0,l=22,sg=0,ft=0,st=OK:TemperatureAndHumidity
    4218 NRF5:SND:TO=0,LEN=10,PID=3,NOACK=0
    4223 NRF5:SND:END=1,ACK=1,RTRY=1,RSSI=-55,WAKE=4
    4228 TSF:MSG:SEND,37-37-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.2
    4234 NRF5:SND:TO=0,LEN=15,PID=0,NOACK=0
    4239 NRF5:SND:END=1,ACK=1,RTRY=1,RSSI=-55,WAKE=4
    4244 TSF:MSG:SEND,37-37-0-0,s=0,c=0,t=7,pt=0,l=8,sg=0,ft=0,st=OK:Humidity
    

    Someone that can help me?

    Troubleshooting

  • Why do "passive nodes" need to set their Node ID manually?
    S smilvert

    @NeverDie

    Well I wanted to filter noise values and I also want to use influx/grafana as a complement to domoticz

    General Discussion

  • GWT:TPC:CONNECTING
    S smilvert

    @DenisJ I have the same problem. Works with

    #define MY_GATEWAY_ESP32
    

    but with

    #define MY_GATEWAY_ESP32
    #define MY_GATEWAY_MQTT_CLIENT
    

    it dosen't. But when I changed the delay to 3000

    bool gatewayTransportConnect(void)
    {
    #if defined(MY_GATEWAY_ESP8266) || defined(MY_GATEWAY_ESP32)
    	if (WiFi.status() != WL_CONNECTED) {
    		GATEWAY_DEBUG(PSTR("GWT:TPC:CONNECTING...\n"));
    		delay(3000); // Was 1000
    		return false;
    	}
    	GATEWAY_DEBUG(PSTR("GWT:TPC:IP=%s\n"), WiFi.localIP().toString().c_str());
    

    in MyGatewayTransportMQTTClient.cpp then it started to work! :)

    Troubleshooting

  • GWT:TPC:CONNECTING
    S smilvert

    No I have no idea. For me it seems to work.

    Currently I don't have any sensors conncted so its hard to see if it works.

    Troubleshooting

  • GWT:TPC:CONNECTING
    S smilvert

    @electrik A ticket is raised quite long time ago, https://github.com/mysensors/MySensors/issues/1376

    Troubleshooting
  • Login

  • Don't have an account? Register

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