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
carlekiC

carleki

@carleki
About
Posts
56
Topics
8
Shares
0
Groups
0
Followers
1
Following
4

Posts

Recent Best Controversial

  • coin-cell (CR2032) powered temperature sensor
    carlekiC carleki

    @fleinze
    Hi, do you think it's possible to connect de Dallas sensor to pin 7, 8 and 9 of the arduino ?

    Like this :

    #define ONE_WIRE_BUS 8 // Pin where dallase sensor is connected
    #define ONE_WIRE_GND 9
    #define ONE_WIRE_VCC 7
    

    I have tried, and the temperature is always 85°C ...

    My Project

  • Measuring battery
    carlekiC carleki

    Hello @mrc-core

    You can use the Vcc.h library, and mesure the voltage without any wire ;)

    https://github.com/Yveaux/Arduino_Vcc

    My Project

  • fail converting 1.5 sketch to 2.0
    carlekiC carleki

    Hi guys !

    I'm trying to convert a temperature sketch with CR2032 battery monitoring, and the OneWire without resistor lib (to avoid the 4.7k resistor attached to the Dallas)

    But, it seems I have not well followed the instructions to convert a sketch from 1.5.4 to 2.0, because it won't compile !

    Here is the original sketch (1.5) :

    // avec mesure de la batterie avec Vcc.h
    // ok avec pile CR2032 et docATmega328 8Mhz MYSBootloader et efuse 0x07
    // pour DS18B20 SANS resistance
    // nécessite la lib OneWire : OneWireNoResistor-master.zip
    //
    // boards.txt :
    //proMYSBL.name=docATmega328 8Mhz MYSBootloader
    
    //proMYSBL.upload.tool=avrdude
    //proMYSBL.upload.protocol=arduino
    //proMYSBL.upload.maximum_size=30720
    //proMYSBL.upload.maximum_data_size=2048
    //proMYSBL.upload.speed=115200
    
    //proMYSBL.bootloader.tool=avrdude
    //proMYSBL.bootloader.low_fuses=0xE2
    //proMYSBL.bootloader.high_fuses=0xDA
    //proMYSBL.bootloader.extended_fuses=0x07
    //proMYSBL.bootloader.unlock_bits=0x3F
    //proMYSBL.bootloader.lock_bits=0x0F
    //proMYSBL.bootloader.file=MySBootloader/MYSBootloader.hex
    
    //proMYSBL.build.mcu=atmega328p
    //proMYSBL.build.f_cpu=8000000L
    //proMYSBL.build.board=AVR_UNO
    //proMYSBL.build.core=arduino:arduino
    //proMYSBL.build.variant=arduino:standard
    #include <MySensor.h>
    #include <SPI.h>
    #include <DallasTemperature.h>
    #include <OneWire.h>
    #include <Vcc.h>
    
    #define ONE_WIRE_BUS 4 // Pin where dallase sensor is connected
    #define ONE_WIRE_GND 5
    #define ONE_WIRE_VCC 3
    #define ID_BatPcnt 1
    #define ID_Bat 2
    
    #define MAX_ATTACHED_DS18B20 16
    
    // 60000 = 1 minute
    // 12000 = 2 minutes
    // 300000 = 5 minutes
    // 600000 = 10 minutes
    #define SLEEP_TIME 300000  // Sleep time between reads (in milliseconds)
    
    
    
    
    const float VccMin   = 2.3;             // Vcc mini attendu, en Volts.
    const float VccMax   = 3;           // Vcc Maximum attendu, en Volts (2 piles AA neuves)
    const float VccCorrection = 2.52/2.6; // calibration : Vcc mesuré au multimètre / Vcc mesuré par l'Arduino par vcc.Read_Volts() dans sketch 1/2
    Vcc vcc(VccCorrection);
    
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);
    MySensor gw;
    MyMessage msgBAT_PCNT(ID_BatPcnt,V_VAR1); // on utilise le type V_VAR1 pour le % de charge des piles
    MyMessage msgBAT(ID_Bat,V_VAR2);          // on utilise le type V_VAR2 pour la tension des piles
    float lastTemperature[MAX_ATTACHED_DS18B20];
    uint8_t numSensors = 0;
    boolean receivedConfig = false;
    boolean metric = true;
    // Initialize temperature message
    MyMessage msg(0, V_TEMP);
    int oldvalue = 0;
    int node_id = 30; // on donne un ID au node
    
    void setup()
    {
      // Startup OneWire
    #ifdef ONE_WIRE_VCC
      pinMode(ONE_WIRE_VCC, OUTPUT);
      digitalWrite(ONE_WIRE_VCC, HIGH);
    #endif
    #ifdef ONE_WIRE_GND
      pinMode(ONE_WIRE_GND, OUTPUT);
      digitalWrite(ONE_WIRE_GND, LOW);
    #endif
    
      analogReference(INTERNAL);
      pinMode(BATT_IN_PIN, INPUT);
      pinMode(BATT_VCC_PIN, OUTPUT);
      digitalWrite(BATT_VCC_PIN, LOW);
    
      sensors.begin();
    
      // Startup and initialize MySensors library. Set callback for incoming messages.
     // gw.begin();
      gw.begin(NULL, node_id, true);
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("Temperature Sensor", "1.0");
    
      // Fetch the number of attached temperature sensors
      numSensors = sensors.getDeviceCount();
    
      sensors.setWaitForConversion(false);//saves a few mAs per read :-) to debug
    
      // Present all sensors to controller
      gw.present(ID_BatPcnt, S_CUSTOM);  // type S_CUSTOM pour le capteur "% de charge"
      gw.present(ID_Bat, S_CUSTOM);      // type S_CUSTOM pour le capteur "tension"
      for (int i = 0; i < numSensors && i < MAX_ATTACHED_DS18B20; i++) {
        gw.present(i, S_TEMP);  
      }
    }
    
    
    void loop()
    {
      // Process incoming messages (like config from server)
      //gw.process();
    // mesure de Vcc
          float v = vcc.Read_Volts();
          // calcul du % de charge batterie
          float p = 100 * ((v - VccMin) / (VccMax - VccMin));
          // On envoie les données des capteurs et de l'état de la batterie au Gateway
          //gw.sendBatteryLevel(p);  // Inutile...
          gw.send(msgBAT_PCNT.set(p, 1)); // 1 décimale
          gw.send(msgBAT.set(v, 3));      // 2 décimales
      // Fetch temperatures from Dallas sensors
      // Fetch temperatures from Dallas sensors
      sensors.requestTemperatures();
    
      gw.sleep(750);//wait for conversion in sleep mode
    
      // Read temperatures and send them to controller
      for (int i = 0; i < numSensors && i < MAX_ATTACHED_DS18B20; i++) {
    
        // Fetch and round temperature to one decimal
        float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric ? sensors.getTempCByIndex(i) : sensors.getTempFByIndex(i)) * 10.)) / 10.;
    
        // Only send data if temperature has changed and no error
        gw.send(msg.setSensor(i).set(temperature, 1));
          lastTemperature[i] = temperature;
        //if (lastTemperature[i] != temperature && temperature != -127.00) {
    
          // Send in the new temperature
          
        //}
      }
     
      gw.sleep(SLEEP_TIME);//wake on interrupt or after sleep-time
    }
    

    Here is my "converted" sketch :

    // avec mesure de la batterie avec Vcc.h
    // ok avec pile CR2032 et docATmega328 8Mhz MYSBootloader et efuse 0x07
    // pour DS18B20 SANS resistance
    // nécessite la lib OneWire : OneWireNoResistor-master.zip
    //
    // boards.txt :
    //proMYSBL.name=docATmega328 8Mhz MYSBootloader
    
    //proMYSBL.upload.tool=avrdude
    //proMYSBL.upload.protocol=arduino
    //proMYSBL.upload.maximum_size=30720
    //proMYSBL.upload.maximum_data_size=2048
    //proMYSBL.upload.speed=115200
    
    //proMYSBL.bootloader.tool=avrdude
    //proMYSBL.bootloader.low_fuses=0xE2
    //proMYSBL.bootloader.high_fuses=0xDA
    //proMYSBL.bootloader.extended_fuses=0x07
    //proMYSBL.bootloader.unlock_bits=0x3F
    //proMYSBL.bootloader.lock_bits=0x0F
    //proMYSBL.bootloader.file=MySBootloader/MYSBootloader.hex
    
    //proMYSBL.build.mcu=atmega328p
    //proMYSBL.build.f_cpu=8000000L
    //proMYSBL.build.board=AVR_UNO
    //proMYSBL.build.core=arduino:arduino
    //proMYSBL.build.variant=arduino:standard
    #include <MySensors.h>
    #include <SPI.h>
    #include <DallasTemperature.h>
    #include <OneWire.h>
    #include <Vcc.h>
    
    #define ONE_WIRE_BUS 4 // Pin where dallase sensor is connected
    #define ONE_WIRE_GND 5
    #define ONE_WIRE_VCC 3
    
    
    #define ID_BatPcnt 1
    #define ID_Bat 2
    
    #define MAX_ATTACHED_DS18B20 16
    #define MY_NODE_ID 123
    #define MY_RADIO_NRF24
    
    // 60000 = 1 minute
    // 12000 = 2 minutes
    // 300000 = 5 minutes
    // 600000 = 10 minutes
    #define SLEEP_TIME 300000  // Sleep time between reads (in milliseconds)
    
    
    const float VccMin   = 2.3;             // Vcc mini attendu, en Volts.
    const float VccMax   = 3;           // Vcc Maximum attendu, en Volts (2 piles AA neuves)
    const float VccCorrection = 2.52/2.6; // calibration : Vcc mesuré au multimètre / Vcc mesuré par l'Arduino par vcc.Read_Volts() dans sketch 1/2
    Vcc vcc(VccCorrection);
    
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);
    //MySensor gw;
    MyMessage msgBAT_PCNT(ID_BatPcnt,V_VAR1); // on utilise le type V_VAR1 pour le % de charge des piles
    MyMessage msgBAT(ID_Bat,V_VAR2);          // on utilise le type V_VAR2 pour la tension des piles
    float lastTemperature[MAX_ATTACHED_DS18B20];
    uint8_t numSensors = 0;
    boolean receivedConfig = false;
    boolean metric = true;
    // Initialize temperature message
    MyMessage msg(0, V_TEMP);
    int oldvalue = 0;
    
    void before()
    {
      // Startup up the OneWire library
      sensors.begin();
    }
    
    void setup()
    {
      // Startup OneWire
    #ifdef ONE_WIRE_VCC
      pinMode(ONE_WIRE_VCC, OUTPUT);
      digitalWrite(ONE_WIRE_VCC, HIGH);
    #endif
    #ifdef ONE_WIRE_GND
      pinMode(ONE_WIRE_GND, OUTPUT);
      digitalWrite(ONE_WIRE_GND, LOW);
    #endif
    
      analogReference(INTERNAL);
      pinMode(BATT_IN_PIN, INPUT);
      pinMode(BATT_VCC_PIN, OUTPUT);
      digitalWrite(BATT_VCC_PIN, LOW);
    
        
    }
    
    void presentation()
    {
      // Startup and initialize MySensors library. Set callback for incoming messages.
     // gw.begin();
      //gw.begin(NULL, node_id, true);
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("TS sR batt", "2.0");
    
      // Fetch the number of attached temperature sensors
      numSensors = sensors.getDeviceCount();
    
      sensors.setWaitForConversion(false);//saves a few mAs per read :-) to debug
    
      // Present all sensors to controller
      present(ID_BatPcnt, S_CUSTOM);  // type S_CUSTOM pour le capteur "% de charge"
      present(ID_Bat, S_CUSTOM);      // type S_CUSTOM pour le capteur "tension"
      for (int i = 0; i < numSensors && i < MAX_ATTACHED_DS18B20; i++) {
        present(i, S_TEMP);  
      }
    }
    
    void loop()
    {
      // Process incoming messages (like config from server)
      //gw.process();
    // mesure de Vcc
          float v = vcc.Read_Volts();
          // calcul du % de charge batterie
          float p = 100 * ((v - VccMin) / (VccMax - VccMin));
          // On envoie les données des capteurs et de l'état de la batterie au Gateway
          //gw.sendBatteryLevel(p);  // Inutile...
          send(msgBAT_PCNT.set(p, 1)); // 1 décimale
          send(msgBAT.set(v, 3));      // 2 décimales
      // Fetch temperatures from Dallas sensors
      // Fetch temperatures from Dallas sensors
      sensors.requestTemperatures();
    
      sleep(750);//wait for conversion in sleep mode
    
      // Read temperatures and send them to controller
      for (int i = 0; i < numSensors && i < MAX_ATTACHED_DS18B20; i++) {
    
        // Fetch and round temperature to one decimal
        float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric ? sensors.getTempCByIndex(i) : sensors.getTempFByIndex(i)) * 10.)) / 10.;
    
        // Only send data if temperature has changed and no error
        send(msg.setSensor(i).set(temperature, 1));
          lastTemperature[i] = temperature;
        //if (lastTemperature[i] != temperature && temperature != -127.00) {
    
          // Send in the new temperature
          
        //}
      }
     
      sleep(SLEEP_TIME);//wake on interrupt or after sleep-time
    }
    

    And the error given by the Arduino IDE :

    In file included from /home/carmelo/Arduino/tmp/tmp_tempbattv2/tmp_tempbattv2.ino:28:0:
    /home/carmelo/Arduino/libraries/MySensors/MySensors.h:332:2: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
     #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
      ^
    exit status 1
    Erreur de compilation pour la carte Arduino Pro or Pro Mini
    
    Troubleshooting

  • 4 doors sensors and 4 move sensors on the same node
    carlekiC carleki

    @gloob

    ok ! I will check the wires and signal output from the movement sensors ;)

    My Project

  • 4 doors sensors and 4 move sensors on the same node
    carlekiC carleki

    @gloob said:

    What type of sensors are they? Do they act like simple "switches" or what kind of signal do they offer on the output?

    For the door, I assume they are like reed switch (with magnet fixed on the door itself)
    For the movement ... I don't know !

    My Project

  • 4 doors sensors and 4 move sensors on the same node
    carlekiC carleki

    Hello,
    In my house, I have an old alarm system installed, with :

    • 4 doors sensors
    • 4 move sensors

    All the sensors are wired, and all the cables are going un a closet, where the old alarm system is installed.

    I don't want to use the old alarm because it is broken, but I want to reuse the sensors. I have electric power in the closet, so it will not be a batteries powered node, so is my idea realisable :

    • Arduino powered by USB, with at least 8 inputs (arduino uno ?)
    • I connect 1 cable of each sensor on each input
    • the other cables from the sensors connected to ground of the arduino

    is it correct ?

    My Project

  • Battery Operated Door Magnet Sensor
    carlekiC carleki

    Thanks a lot for your answer :)

    I must be an idiot but ... I can't compile your sketch ... Which version of MySensors lib are you using ? (I'm with 1.5.4)

    My Project

  • 1.5.4 and 2.0 on the same computer
    carlekiC carleki

    Hello,
    Is it possible to have 1.5.4 and 2.0 MySensors on the same computer ?

    Development

  • Battery Operated Door Magnet Sensor
    carlekiC carleki

    @sghazagh said:

    @m26872 Thank you very much mate.
    I just added the battery reporting part and it works like a charm.

    Many many thanks...
    Did you add 1MOhm resistor between the Input pin and the reed switch ?

    My Project

  • debug battery powered node
    carlekiC carleki

    @gloob said:

    Correct.

    thanks ;)

    Troubleshooting

  • debug battery powered node
    carlekiC carleki

    I didn't know it was possible !

    So : Vcc and GND from the battery, and TX, RX and GND to my usb serial adapter ?

    Troubleshooting

  • debug battery powered node
    carlekiC carleki

    Hello !

    I have sometimes tempertures nodes, powered by batteries, which are freezing ... If I reboot the node, all is working correctly ...

    How can I debug it ? If I connect the node to my computer, it will change the power input, so if it's a power related issue, I will not see it ...

    Do you have any idea ?

    Thanks !

    Troubleshooting

  • coin-cell (CR2032) powered temperature sensor
    carlekiC carleki

    @fleinze said:

    @carmelo42 sorry I somehow missed your post. I use the standard-bootloader as I did not get Optiboot to run on the 3.3V/8MHz pro minis. I set the extended fuse to 0x07 (BOD disabled) by editing boards.txt.
    thanks !

    is is a bit confusing for me :

    • we can burn the bootloader from the Arduino IDE : are the fuses written at this moment ?
    • we can upload a sketch with the arduino IDE : are the fuses written at this moment ?
    • with my researches, I found that for disabling BOD was possible with 0xFF value for efuse ?

    I have some lifetime issues with my CR2032 sensor .. and I suspect the fuses are not correctly set ...

    If you can light up my mind it will be perfect :)

    My Project

  • coin-cell (CR2032) powered temperature sensor
    carlekiC carleki

    @fleinze said:

    @carmelo42

    The no-resistor-library can be found here:
    https://wp.josh.com/2014/06/23/no-external-pull-up-needed-for-ds18b20-temp-sensor/

    The resistors (there are two but the other one is barely visible) are for voltage-measurement. In a later version I got rid of them using this resistor-less method of measurement:
    http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/

    great :)

    Did you change the bootloader ? Which one did you use ?

    My Project

  • coin-cell (CR2032) powered temperature sensor
    carlekiC carleki

    @fleinze said:

    @carmelo42 I just changed coin-cell on one of my sensors. It lasted since for 10 months, this is ok for me.

    10 months ? it's perfect :)

    Can you provide the modified version of the library to avoid using 4.7k resistor for the Dallas sensor ?

    What is for the resistor on the pic ? for the voltage mesurement ?

    My Project

  • coin-cell (CR2032) powered temperature sensor
    carlekiC carleki

    what about your nodes after several months ?

    My Project

  • My Slim 2AA Battery Node
    carlekiC carleki

    @siod said:

    @carmelo42 no, unfortunately I don´t have any logs, any idea how to create logs?

    maybe if you keep your node connected to your computer with USB to serial adapter ?

    My Project

  • My Slim 2AA Battery Node
    carlekiC carleki

    @siod my temperature nodes work good, but my relay one doesn't work :'(

    Do you have any logs when it freezes ?

    My Project

  • My Slim 2AA Battery Node
    carlekiC carleki

    @carmelo42 said:

    @jeti said:

    @carmelo42 yes

    I have this serial/usb adapter :
    https://img1.picload.org/image/ldrrddg/deekrobot-isp.png

    Can you tell me how I connect it to my node ? (noob question I guess ... but I don't want to burn my node :( )

    I have found the answer myself with the schematic ;)

    Have you ever tried to power the node with 1 x CR2032 battery ?

    I have tried, but the node doesn't send anything further than 5 meters ...

    My Project

  • need help with node not sending info
    carlekiC carleki

    I have added the C5 capacitor (on the "My Slim 2AA node"), and replaced the nrf24 from my GW with a NRF24L01+PA+LNA.

    It's way better :)

    So far, no problem .. I will keep you updated in the following days

    Anyway, thanks for your help :dancer:

    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