Navigation

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

    Posts made by ybycode

    • RE: Radio stop emitting after a few hours...

      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 ?

      posted in Troubleshooting
      ybycode
      ybycode
    • RE: Radio stop emitting after a few hours...

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

      posted in Troubleshooting
      ybycode
      ybycode
    • RE: Radio stop emitting after a few hours...

      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 !

      posted in Troubleshooting
      ybycode
      ybycode
    • Radio stop emitting after a few hours...

      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

      posted in Troubleshooting
      ybycode
      ybycode
    • RE: API documentation not up to date

      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

      posted in Bug Reports
      ybycode
      ybycode
    • API documentation not up to date

      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

      posted in Bug Reports
      ybycode
      ybycode