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
F

fleinze

@fleinze
About
Posts
79
Topics
11
Shares
0
Groups
0
Followers
1
Following
0

Posts

Recent Best Controversial

  • Chinese Arduino Nanos with Atmega328PB
    F fleinze

    I got two different boards from the same seller:
    https://de.aliexpress.com/item/2pcs-Nano-3-0-controller-compatible-with-for-arduino-nano-Atmega328P-CH340-USB-driver-NO-with/32828478049.html?spm=a2g0s.9042311.0.0.SGrO1Y
    and
    https://de.aliexpress.com/item/Freeshipping-2pcs-lot-Nano-3-0-controller-compatible-for-arduino-nano-CH340-USB-driver-NO-CABLE/32818556647.html?spm=a2g0s.9042311.0.0.SGrO1Y

    They are not advertised to contain the PB and the pictures also show a P so I guess there is no guarantee...

    Hardware

  • Chinese Arduino Nanos with Atmega328PB
    F fleinze

    Today I received some chinese Nanos which actually feature the Atmega328PB instead of the P variant.
    I did not yet test any of the extra features yet but at least the device signature checks out.
    The boards are standard layout so the pins 3 and 6 are not useable on this board.

    Hardware

  • 💬 Building a Raspberry Pi Gateway
    F fleinze

    I compiled the gateway for spi1 because I have a display using spi0. Two problems I came across:

    1. the master branch doesn't work. It compiles, it seems to work but it never receives anything.
    2. the development branch works but I needed to define the right cs-pin even if I redirected the pin in config.txt (with dtoverlay=spi1-1cs,cs0_pin=16)
      The following configure worked for me:
    ./configure --spi-driver=SPIDEV --spi-spidev-device=/dev/spidev1.0 --my-rf24-cs-pin=36 --my-rf24-ce-pin=33 --my-rf24-irq-pin=31
    
    Announcements

  • coin-cell (CR2032) powered temperature sensor
    F fleinze

    Hi,

    this is my code working with 2.1 version. The code is not tidied up, please excuse.

    /*
       MySensors-Node for DS18B20 Temperature-Sensors.
       Mysensors.Library-Version 1.6
    */
    
    #define MY_RADIO_NRF24
    
    #define MY_TRANSPORT_UPLINK_CHECK_DISABLED
    
    //#define MY_DEBUG
    
    
    #include <MySensors.h>
    #include <SPI.h>
    #include <Wire.h>
    #include <SI7021.h>
    
    #define BATT_SENSOR
    //#define VCCGND_PINS
    
    #ifdef VCCGND_PINS
    const uint8_t GND = A2;
    const uint8_t VCC = A3;
    #endif
    
    #ifdef BATT_SENSOR
    #define REPORT_VOLTAGE
    #endif
    
    const unsigned long SLEEP_TIME = 300000; // Sleep time between reads (in milliseconds)
    
    const uint8_t TEMP_TIME = 12; //at least every nth time battery is reported
    const uint8_t HUM_TIME = 12;
    const uint8_t BATT_TIME = 12; //when also BATT-LEVEL is reportet
    const float BATT_100 = 3; //3.3V for CR2032, 3V for 2xAA
    const float BATT_0 = 2.2;
    
    SI7021 sensor;
    
    float lastTemperature, lastHum;
    uint8_t lastTempSent = 0;//, lastHumSent = 0;
    uint8_t numSensors = 0;
    boolean receivedConfig = false;
    boolean metric = true;
    // Initialize temperature message
    MyMessage msgTemp(0, V_TEMP);
    MyMessage msgHum(0, V_HUM);
    #ifdef REPORT_VOLTAGE
    MyMessage msgBatt(1, V_VOLTAGE);
    #endif
    #ifdef BATT_SENSOR
    uint8_t battReport = BATT_TIME - 1; //First report at startup
    long oldvalue = 0;
    #endif
    
    
    void setup()
    {
    
      #ifdef VCCGND_PINS
      pinMode(VCC, OUTPUT);
      digitalWrite(VCC, HIGH);
      pinMode(GND, OUTPUT);
      digitalWrite(GND, LOW);
      #endif
      
      if (!sensor.begin()) {
        Serial.println("No Sensor found!");
        while (true);
      }
      
    
    }
    
    void presentation() {
    
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("TempHumSi7021", "0.1a");
    
      // Present all sensors to controller
      present(0, S_HUM);
      //present(1, S_HUM);
    #ifdef REPORT_VOLTAGE
      present(1, S_MULTIMETER);
    #endif
    }
    
    
    void loop()
    {
      //delay(2000);//for sensor to start up
      boolean tempsent = false;
    
      // Fetch temperatures from Dallas sensors
      si7021_thc temphum = sensor.getTempAndRH();
    
      // Read temperatures and send them to controller
      // Fetch and round temperature to one decimal
      float temperature = (float)(temphum.celsiusHundredths) / 100.0;
      float humidity = (float)(temphum.humidityPercent);
      // Only send data if temperature has changed and no error
      if ((lastTemperature != temperature) || lastHum != humidity || (++lastTempSent >= TEMP_TIME)) {
        // Send in the new temperature
        send(msgTemp.set(temperature, 1));
        send(msgHum.set(humidity, 1));
        lastHum = humidity;
        lastTemperature = temperature;
        lastTempSent = 0;
        tempsent = true;
      }
    
    
    #ifdef BATT_SENSOR
      if (++battReport >= BATT_TIME && tempsent) {
    
        //gw.sleep(10);
        long value = readVcc();
    
    
        if (value != oldvalue) {
          int percent = (( (float)(value) / 1000 ) - BATT_0) / (BATT_100 - BATT_0) * 100;
          percent = (percent > 100) ? 100 : percent;
          percent = (percent < 0) ? 0 : percent;
          sendBatteryLevel(percent);
    #ifdef REPORT_VOLTAGE
          send(msgBatt.set((float)(value) / 1000, 2));
    #endif
        }
        oldvalue = value;
        battReport = 0;
      }
    #endif
      sleep(SLEEP_TIME);//wake on interrupt or after sleep-time
      //delay(2000);//for sensor to start up
    }
    
    long readVcc() {
      // Read 1.1V reference against AVcc
      // set the reference to Vcc and the measurement to the internal 1.1V reference
    #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
      ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
    #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
      ADMUX = _BV(MUX5) | _BV(MUX0);
    #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
      ADMUX = _BV(MUX3) | _BV(MUX2);
    #else
      ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
    #endif
    
      delay(2); // Wait for Vref to settle
      ADCSRA |= _BV(ADSC); // Start conversion
      while (bit_is_set(ADCSRA, ADSC)); // measuring
    
      uint8_t low  = ADCL; // must read ADCL first - it then locks ADCH
      uint8_t high = ADCH; // unlocks both
    
      long result = (high << 8) | low;
    
      result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000
      return result; // Vcc in millivolts
    }```
    My Project

  • Defective pro mini and the solution
    F fleinze

    Hi!
    I had a pro mini which stopped working with the following symptoms:

    • No communication
    • not even a flicker on Pin 13 LED
    • not responding to programming attempts, not even with ISP.
    • RST pin has a voltage of ca. 100mV

    The pro mini started working again without me doing anything and then after a few months stopped working again.

    After a lot of soldering (replacing most components including the atmega) it turned out that the board had a ca. 100 Ohm short between RST and GND...

    So if you experience the above symptoms just measure resistance between RST and GND.

    Hardware

  • NRF24L01+PA+LNA distance problem
    F fleinze

    Sometimes we get shitty modules from china:
    https://forum.mysensors.org/topic/1153/we-are-mostly-using-fake-nrf24l01-s-but-worse-fakes-are-emerging
    I made good experiance with these rather expensive ones:
    https://de.aliexpress.com/item/2pcs-RF2401F20-2-4G-high-integrated-RF-module-with-Nordic-s-RF-chip-nRF24L01-For-Free/32302870943.html
    But even with these I had to be very careful about antenna placement

    Troubleshooting

  • coin-cell (CR2032) powered temperature sensor
    F fleinze

    I put the arduino to sleep during the conversion time, so this is not a big issue. But I agree that the DS18B20 is not the best, but it is widely available. For newer nodes I try to use the Si7021 where possible.

    My Project

  • NRF24L01+PA+LNA distance problem
    F fleinze

    @yd-kim In my case I added an extra wire-connection fromm the 5V-side of the LDO-module to the 3.3V-side.

    Troubleshooting

  • Multiple Gateways for redundancy
    F fleinze

    @David I think it can work as long as you sure that only one Gateway is able to send and the others are mute. Kind of the same as with redundant hot standby server systems.

    Hardware

  • NRF24L01+PA+LNA distance problem
    F fleinze

    I had some issues with pa+lna modules. The solution was a better ground connection.

    Troubleshooting

  • coin-cell (CR2032) powered temperature sensor
    F fleinze

    @flopp I added the capacitor and put the old battery in. By old battery I mean the one I had replaced a week earlier for a new one. Sensor running smooth since, so great success!

    My Project

  • coin-cell (CR2032) powered temperature sensor
    F fleinze

    I just added an 100uF capacitor to one of my sensors and put an old battery in. Let's see how much more life I can get out of this battery now.

    My Project

  • coin-cell (CR2032) powered temperature sensor
    F fleinze

    @carmelo42 The fuses only are written when you burn the bootloader, not when uploading the sketch. The Arduino IDE takes the fuse bytes from the boards.txt files.
    It would also be possible to just set the fuse bytes by using the avrdude-program from a command line, but you will still need to use a programmer.
    The extended-fuse setting 0xFF is the same as 0x07 as only the last 3 bits of this bytes are used. Both values will give you BOD disabled.

    My Project

  • coin-cell (CR2032) powered temperature sensor
    F fleinze

    @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.

    My Project

  • coin-cell (CR2032) powered temperature sensor
    F fleinze

    @Nca78 said:

    add a capacitor of 100-200µF

    I will try this, thanks! Currently I use the 10uF capacitor which is on the arduino pro minis on the raw pin side.

    in your code, add a sleep command between message sending

    How long do you sleep? In normal operation there is only one send command per loop, I only send battery level once every hour. I try to read vcc after sending the temperature so the battery is under some load when measuring.

    use a better sensor that can accept a lower voltage

    I already built one with a Si7021 sensor. But I ran out of CR2032 so I powered it using two AA cells. I should solder it back to coin cell now I got some.

    you can just get Vcc from the A0 pin

    I don't know this method do you have a link or can you explain it?

    My Project

  • coin-cell (CR2032) powered temperature sensor
    F fleinze

    @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/

    My Project

  • coin-cell (CR2032) powered temperature sensor
    F fleinze

    Measuring the voltage proofed to be worthless for this kind of battery. It is more dependent of the temperature than from anything else.

    My Project

  • coin-cell (CR2032) powered temperature sensor
    F fleinze

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

    My Project

  • How to control four relays
    F fleinze

    @NotTooTechy
    I think you can do this with a lua script on domoticz:
    https://www.domoticz.com/wiki/Scripts

    Domoticz

  • How to: set your power/watermeter for domoticz on rpi
    F fleinze

    Well actually i didn't. Thanks a lot!

    Domoticz
  • Login

  • Don't have an account? Register

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