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
ybycodeY

ybycode

@ybycode
About
Posts
6
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Radio stop emitting after a few hours...
    ybycodeY ybycode

    Changing the power supply didn't change anything. I'll try changing the radio today.

    In the meantime, I have a question. Everytime the problem has happened, the last temperature that was sent is always either the limit low, or the limit high temperature defined in my sketch, meaning when the relay is passed from close to open or from open to close, when the fridge compressor is turned on or off.
    This makes me think: could my problem be du to an inductive spike, like described in this thread http://electronics.stackexchange.com/questions/128310/arduino-crashes-switching-230v-relay-off ?

    Troubleshooting

  • Radio stop emitting after a few hours...
    ybycodeY ybycode

    @Yveaux sorry, correction: it's connected to 3V3

    Troubleshooting

  • Radio stop emitting after a few hours...
    ybycodeY ybycode

    The whole is powered with a 5V 1A power supply from an old phone, connected to the USB port of the arduino nano. The radio module is powered by the VCC port of teh arduino.

    I'll change the power supply this evening, see what happens. I'll try another radio module tomorrow if needed.

    I'll keep you posted.

    Thanks !

    Troubleshooting

  • Radio stop emitting after a few hours...
    ybycodeY ybycode

    Hi,

    I replaced the thermostat of my old fridge by an sensor made of arduino nano + nrf24l01+ DS18B20 temp sensor + relay.
    And it works great. Except that after a few hours, and although the temperature control works ok, the sensor stops emitting to the controller.

    If I reset the arduino the radio communication is good again, and then a few hours later, same thing, it does't send anything (no messages appear in the log of the controller).

    In the meantime I added a 47µF capacitor on the radio, but it didn't help.
    The arduino is not on battery..

    Today when I saw the radio didn't send data anymore I plugged the serial, and here's what I read (the T:X.XX comp:1 are the temperature and the boolean indicating if the compressor is on or off):

    T:6.70 comp:1
    !TSP:SEND:TNR
    !TSP:SEND:TNR
    T:6.70 comp:1
    !TSP:SEND:TNR
    !TSP:SEND:TNR
    T:6.70 comp:1
    !TSP:SEND:TNR
    !TSP:SEND:TNR
    T:6.70 comp:1
    !TSP:SEND:TNR
    !TSP:SEND:TNR
    T:6.60 comp:1
    !TSP:SEND:TNR
    !TSP:SEND:TNR
    T:6.60 comp:1
    !TSP:SEND:TNR
    !TSP:SEND:TNR
    T:6.60 comp:1
    !TSP:SEND:TNR
    !TSP:SEND:TNR
    T:6.50 comp:1
    TSM:FPAR
    TSP:MSG:SEND 142-142-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSP:SEND:TNR
    !TSP:SEND:TNR
    T:6.50 comp:1
    !TSP:SEND:TNR
    !TSP:SEND:TNR
    

    Reading a bit of the MySensors source code I understood that TNR means "Transport Not Ready", but... why ?

    In any case, here's the sketch I'm using:

    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    #include <SPI.h>
    #include <MySensors.h>  
    
    #include <DallasTemperature.h>
    #include <OneWire.h>
    #include "FridgeThermostat.h"
    
    #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected
    #define MAX_ATTACHED_DS18B20 16
    #define SLEEP_TIME 30000 // Sleep time between reads (in milliseconds)
    #define GPIO_THERMOSTAT 8
    #define TEMP_LOW 5.0
    #define TEMP_HIGH 6.0
    #define NB_HOT_READS_NO_ACTION 1
    
    OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
    DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature.
    // Initialize temperature message
    MyMessage msg(0, V_TEMP);
    MyMessage msgCompressorStatus(1, V_STATUS);
    FridgeThermostat thermostat(GPIO_THERMOSTAT, TEMP_LOW, TEMP_HIGH, NB_HOT_READS_NO_ACTION);
    
    // query conversion time and sleep until conversion completed
    int16_t conversionTime;
    
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Fridge thermostat", "0.4");
    
      // Register all sensors to gateway (they will be created as child devices)
      present(0, S_TEMP, "Temperature");
      present(1, S_BINARY, "Compressor on/off");
    }
    
    void setup() {
      // Startup up the OneWire library
      sensors.begin();
      // query conversion time
      conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
      // requestTemperatures() will not block current thread
      sensors.setWaitForConversion(false);
    }
    
    void loop()      
    {     
      // Fetch temperatures from Dallas sensors
      sensors.requestTemperatures();
    
      // sleep until conversion completed
      // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
      sleep(conversionTime);
    
      // Read temperatures and send them to controller
    
      // Fetch and round temperature to one decimal
      float temperature = static_cast<float>(static_cast<int>((getConfig().isMetric?sensors.getTempCByIndex(0):sensors.getTempFByIndex(0)) * 10.)) / 10.;
    
      // Send in the temperature to the controller even if error, to have a clue
      // something goes wrong:
      send(msg.set(temperature,1));
    
      boolean compressorIsOn;
      // Only tell the thermostat if no error:
      if (temperature != -127.00 && temperature != 85.00) {
        compressorIsOn = thermostat.act(temperature);
        send(msgCompressorStatus.set(compressorIsOn));
      }
    
      Serial.print("T:");
      Serial.print(temperature);
      Serial.print(" comp:");
      Serial.println(compressorIsOn);
    
      sleep(SLEEP_TIME);
    }
    

    Any help appreciated !

    Thanks,

    Yann

    Troubleshooting

  • API documentation not up to date
    ybycodeY ybycode

    I agree, that's what I read too. But the function call

    sleep(int interrupt, int mode, unsigned long ms=0)
    

    doesn't return a boolean anymore, but a uint8_t, but the interrupt number if it was triggered, or -1 if timeout, or -2 if not possible because of a firmware update.

    See https://github.com/mysensors/MySensors/blob/development/core/MySensorsCore.h#L252

    yann

    Bug Reports

  • API documentation not up to date
    ybycodeY ybycode

    Hi,

    It seems the v2.0.x documentation has not been updated since the signature of the sleep function has changed:

    In v1.5.x:

    bool sleep(int interrupt, int mode, unsigned long ms=0)
    

    Whereas in v2.0.x:

    uint8_t sleep(int interrupt, int mode, unsigned long ms=0);
    

    ++

    yann

    Bug Reports
  • Login

  • Don't have an account? Register

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