• RE: Request Value from Node

    @soloam looks like you should be able to use mGetCommand and check for C_SET / C_REQ.

    posted in Development
  • RE: Request Value from Node

    I am using the pulse power meter but I didn't use any dummy variable. Also the controller plays a role too.

    posted in Development
  • RE: What did you build today (Pictures) ?

    @neverdie that is a nice pattern. I found that these things need time to draw. If anyone has a DXF file, I would love to try it.

    posted in General Discussion
  • RE: Request Value from Node

    It is checking if it is a V_VAR1 message, the other messages use different variable types

    posted in Development
  • RE: Soft WDT reset on ESP8266 RFM69 gateway after find parent

    About 35 minutes after I reset the node, it started reporting again (without any other changes). I have no idea what caused it to start working.

    posted in Troubleshooting
  • RE: ToF for scanning doesnt work as desired

    @isaac-ng said in ToF for scanning doesnt work as desired:

    vl6180x

    I've not used this particular sensor, but judging from the datasheet it uses IR led illumination and has a 42 degree field-of-view (http://www.st.com/content/ccc/resource/technical/document/datasheet/c4/11/28/86/e6/26/44/b3/DM00112632.pdf/files/DM00112632.pdf/jcr:content/translations/en.DM00112632.pdf, chapter 2.10.1).
    It probably 'averages' the distances measured withing its field-of-view, causing a gradual transition from distance 1 to distance 2.

    If you really need a step response in the measured distance you'd likely need a sensor with a very small field-of-view, e.g. a laser bundle.
    On the other hand, the point with the maximum slope in the transition from 1 to 2 will probably be very close to the actual step in your shape.

    posted in Hardware
  • RE: Request Value from Node posted in Development
  • RE: Soft WDT reset on ESP8266 RFM69 gateway after find parent

    Alright. I'll add a ceramic capacitor.

    For compleeness, here is my complete sketch for the node:

    // Enable debug prints
    #define MY_DEBUG
    #define MY_NODE_ID 1
    
    // Enable and select radio type attached
    #define MY_RADIO_RFM69
    #define MY_IS_RFM69HW
    #define MY_RFM69_FREQUENCY RFM69_433MHZ // RFM69_433MHZ for development branch, RF69_433MHZ for master
    #define MY_RF69_IRQ_PIN 2
    #define MY_RF69_SPI_CS 10
    
    #include <MySensors.h> // From Library Manager
    
    #include <BME280I2C.h> // From Library Manager
    BME280I2C bme;
    
    static const uint64_t UPDATE_INTERVAL = 300000;
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define CHILD_ID_VCC_BEFORE 2
    #define CHILD_ID_VCC_AFTER 3
    
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    MyMessage msgVccBefore(CHILD_ID_VCC_BEFORE, V_VOLTAGE);
    MyMessage msgVccAfter(CHILD_ID_VCC_AFTER, V_VOLTAGE);
    //TODO: Add pressure from BME280?
    //TODO: Add light detection (irq-based, LDR)
    //TODO: Add flooding detection
    
    void presentation()
    {
      // Send the sketch version information to the gateway
      sendSketchInfo("StorageRoom", "1.1");
    
      present(CHILD_ID_HUM, S_HUM);
      wait(100);
      present(CHILD_ID_TEMP, S_TEMP);
      wait(100);
      present(CHILD_ID_VCC_BEFORE, S_CUSTOM);
      wait(100);
      present(CHILD_ID_VCC_AFTER, S_CUSTOM);
    }
    
    void setup()
    {
      if (! bme.begin()) {
        Serial.println("Could not find a valid BME280 sensor, check wiring! Continuing without sensor...");
      }
    }
    
    
    void loop()
    {
      static float lastTemp;
      static float lastHum;
      send(msgVccBefore.set(readVcc() / 1000.0, 3));
      float temperature = bme.temp();
      if (isnan(temperature)) {
        Serial.println("Failed reading temperature");
      } else if (temperature != lastTemp) {
        // Only send temperature if it changed since the last measurement
        lastTemp = temperature;
        send(msgTemp.set(temperature, 1));
      }
    #ifdef MY_DEBUG
      Serial.print("T: ");
      Serial.println(temperature);
    #endif
    
      float humidity = bme.hum();
      if (isnan(humidity)) {
        Serial.println("Failed reading humidity");
      } else if (humidity != lastHum) {
        // Only send humidity if it changed since the last measurement
        lastHum = humidity;
        send(msgHum.set(humidity, 1));
      }
    #ifdef MY_DEBUG
      Serial.print("H: ");
      Serial.println(humidity);
    #endif
    
      send(msgVccAfter.set(readVcc() / 1000.0, 3));
      // Sleep for a while to save energy
      sleep(UPDATE_INTERVAL);
    }
    
    long readVcc() {
      // From http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/
      // 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
    }
    

    and for the gateway:

    // Based on https://github.com/mysensors/MySensors/tree/master/examples/GatewayESP8266OTA
    
    #include <ArduinoOTA.h>
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    #define MY_BAUD_RATE 74880 // To be able to see reset messages
    
    #define WIFI_REPORT_INTERVAL 300000
    
    // Enables and select radio type (if attached)
    #define MY_RADIO_RFM69
    #define MY_IS_RFM69HW
    #define MY_RF69_IRQ_PIN D2
    #define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
    #define MY_RF69_SPI_CS D8
    #define MY_RFM69_FREQUENCY RFM69_433MHZ // RFM69_433MHZ for development branch, RF69_433MHZ for master
    
    #define MY_GATEWAY_ESP8266
    
    #define MY_WIFI_SSID "Mr-IoT.com"
    #include "settings.h"
    
    // Set the hostname for the WiFi Client. This is the hostname
    // it will pass to the DHCP server if not static.
    #define MY_HOSTNAME "RFM69-Gateway"
    
    // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
    //#define MY_IP_ADDRESS 192,168,178,87
    
    // If using static ip you can define Gateway and Subnet address as well
    //#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
    //#define MY_IP_SUBNET_ADDRESS 255,255,255,0
    
    // The port to keep open on node server mode
    #define MY_PORT 5003
    
    // How many clients should be able to connect to this gateway (default 1)
    #define MY_GATEWAY_MAX_CLIENTS 2
    
    // Controller ip address. Enables client mode (default is "server" mode).
    // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
    //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
    
    #if defined(MY_USE_UDP)
    #include <WiFiUDP.h>
    #else
    #include <ESP8266WiFi.h>
    #endif
    
    #include <MySensors.h>
    #define CHILD_ID_WIFI_RSSI 0
    MyMessage msgWifiRssi(CHILD_ID_WIFI_RSSI, V_LEVEL);
    #define CHILD_ID_RSSI1 1
    MyMessage msgRssi1(CHILD_ID_RSSI1, V_LEVEL);
    bool sendRssi = false;
    int16_t rssi;
    
    void setup()
    {
      // Setup locally attached sensors
      ArduinoOTA.onStart([]() {
        DEBUG_OUTPUT("ArduinoOTA start\n");
      });
      ArduinoOTA.onEnd([]() {
        DEBUG_OUTPUT("\nArduinoOTA end\n");
      });
      ArduinoOTA.setPassword((const char *)OTA_PASSWORD);
      ArduinoOTA.setHostname(MY_HOSTNAME);
      ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
        DEBUG_OUTPUT("OTA Progress: %u%%\r", (progress / (total / 100)));
      });
      ArduinoOTA.onError([](ota_error_t error) {
        DEBUG_OUTPUT("Error[%u]: ", error);
        if (error == OTA_AUTH_ERROR) {
          DEBUG_OUTPUT("Auth Failed\n");
        } else if (error == OTA_BEGIN_ERROR) {
          DEBUG_OUTPUT("Begin Failed\n");
        } else if (error == OTA_CONNECT_ERROR) {
          DEBUG_OUTPUT("Connect Failed\n");
        } else if (error == OTA_RECEIVE_ERROR) {
          DEBUG_OUTPUT("Receive Failed\n");
        } else if (error == OTA_END_ERROR) {
          DEBUG_OUTPUT("End Failed\n");
        }
      });
      ArduinoOTA.begin();
    }
    
    void presentation()
    {
      // Present locally attached sensors here
      present(CHILD_ID_WIFI_RSSI, S_SOUND);
      wait(100);
      present(CHILD_ID_RSSI1, S_SOUND);
    }
    
    long lastSend = 0;
    void loop()
    {
      // Send locally attech sensors data here
      ArduinoOTA.handle();
      if (millis() - lastSend > WIFI_REPORT_INTERVAL) {
        send(msgWifiRssi.set(WiFi.RSSI(), 1));
        lastSend = millis();
      }
      if (sendRssi) {
        sendRssi = false;
        send(msgRssi1.set(rssi, 0));
      }
    }
    
    void receive(const MyMessage &message)
    {
      rssi = _radio.RSSI;
      if (message.sender == 1) {
        sendRssi = true;
      }
    }
    
    
    posted in Troubleshooting
  • RE: Soft WDT reset on ESP8266 RFM69 gateway after find parent

    Well... kind of. Noise on power rail could also cause other problems too. I suggested the ceramic as it helps filtering the high frequencies in case your phone charger voltage is not very clean

    posted in Troubleshooting
  • RE: What did you build today (Pictures) ?

    @mickecarlsson except I have not yet tested the new things on the back (signing and extra flash) the boards are working. I will try to test the last things before May is over and the publish.

    If you want to order I can offcourse email you the Gerber's but on your own risk.

    My first experience with the board is that it's performing better than Rev 9 with the new position if the hardware. Also the ground plane helps.

    posted in General Discussion

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.