Navigation

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

    Best posts made by mfalkvidd

    • MySensors 2.2.0 released
      • Bug fixes - thanks to everyone who contributed in troubleshooting and tracking down problems
      • Improved documentation, available at https://www.mysensors.org/apidocs/index.html
      • NRF5 improvements
      • A lot more, the changelog is looong πŸ™‚ For full list, see https://github.com/mysensors/MySensors/releases/tag/2.2.0 and https://github.com/mysensors/MySensors/compare/2.1.1…2.2.0

      Big thanks to the following people who contributed to the release (151 commits in total):

            1 bilbolodz
           17 d00616
            2 Dustin
            3 Yveaux
            1 FotoFieber
            1 Frank Holtz
            1 FrΓ©dΓ©ric FRANCE
            1 freynder
            1 Krister W
            1 Lee Nelson
           20 Marcelo Aquino
           12 Mikael Falkvidd
           16 Patrick Fallberg
            1 per1234
            3 Rainer Clasen
            1 rejoe2
            1 Soef
           67 tekka
            1 Thomas MΓΈrch
      

      Mixing different 2.x versions in the same MySensors network is OK, so you can start deploying new nodes with 2.2.0 without re-flashing your existing nodes, and you can upgrade your gateway without upgrading the nodes.

      The new version should be available in the Arduino IDE within a few days now.

      posted in Announcements
      mfalkvidd
      mfalkvidd
    • Step-by-step procedure to connect the NRF24L01+ to the GPIO pins and use the Raspberry as a Serial Gateway (MySensors 1.x)

      Note: This guide is only applicable to MySensors 1.x. For MySensors 2, use this guide.

      I noticed that a step-by-step procedure to connect the NRF24L01 to the GPIO pins and use the Raspberry as a Serial Gateway was listed in the document for MySensors 1.6.

      Since I have three gateways configured this way, and I need to set up 3 more for covering different offices around the world, and I had already written the instructions in Swedish for Datormagazin, I thought I'd help out.

      This is the first draft. Any feedback is welcome.


      INTRODUCTION
      The radio module NRF24L01+ is cheap and power efficient, but it is unable to communicate with regular wifi. The bridge between NRF24L01+ nodes and the "computer world" is called a Gateway. You can use other types of gateways, but connecting the NRF24L01+ module directly to the Raspberry Pi is a simple and cheap alternative.

      Wiring Things Up
      Connect the NRF20L01+ radio module to the Raspberry Pi like this:
      raspi_mysensors[1].png

      Raspberry Pi NRF24L01+ Color
      6 / GND GND Black
      1 / 3.3V DC VCC Red
      22 / GPIO25 CE Orange
      24 / GPIO 8 CSN/CS Yellow
      23 / GPIO11 / SPI_CLK SCK Green
      19 / GPIO10 / SPI_MOSI MOSI Blue
      21 / GPIO9 / SPI_MISO MISO Violet

      The IRQ pin on NRF24L01 is not currently used.

      For a comprehensive view of the Raspberry Pi pins, see http://pinout.xyz/

      You should also connect a decoupling capacitor to the radio. See this guide.

      COMPILING THE GATEWAY
      Login to your Raspberry Pi (using SSH or open a terminal on the graphical console) and run these commands:

      git clone https://github.com/TMRh20/RF24.git
      cd RF24
      make all && sudo make install
      cd ..
      
      git clone https://github.com/mysensors/Raspberry.git
      cd Raspberry
      make all && sudo make install
      

      If you get the following error:

      pi@raspberrypi ~/RF24 $ make all && sudo make install
      g++ -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -mtune=arm1176jzf-s -march=armv7-a -D BCM2835_PERI_BASE=0x -c RF24.cpp
      gcc -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -mtune=arm1176jzf-s -march=armv7-a -D BCM2835_PERI_BASE=0x -c bcm2835.c
      bcm2835.c: In function β€˜bcm2835_init’:
      bcm2835.c:1207:28: error: invalid suffix "x" on integer constant
      
      

      You've probably run into the problem discussed in this thread. People have had luck with different solutions. The simplest is to make the following change to ~/Raspberry/librf24-bcm/Makefile

      #IOBASE := $(shell cat /proc/iomem | grep bcm2708_vcio | cut -f 1 -d "-")
      IOBASE := 3F000000
      

      VERIFY THE GATEWAY
      Run sudo /usr/local/sbin/PiGatewaySerial. The output should look like this:

      pi@raspberrypi ~/Raspberry $ sudo /usr/local/sbin/PiGatewaySerial
      Starting PiGatewaySerial...
      Protocol version - 1.4
      Created PTY '/dev/pts/1'
      Gateway tty: /dev/ttyMySensorsGateway
      ================ SPI Configuration ================
      CSN Pin          = CE0 (PI Hardware Driven)
      CE Pin           = Custom GPIO25
      Clock Speed      = 8 Mhz
      ================ NRF Configuration ================
      STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
      RX_ADDR_P0-1     = 0xe7e7e7e7e7 0xc2c2c2c2c2
      RX_ADDR_P2-5     = 0xff 0xc4 0xc5 0xc6
      TX_ADDR          = 0xe7e7e7e7e7
      RX_PW_P0-6       = 0x00 0x00 0x20 0x00 0x00 0x00
      EN_AA            = 0x3b
      EN_RXADDR        = 0x07
      RF_CH            = 0x4c
      RF_SETUP         = 0x23
      CONFIG           = 0x0e
      DYNPD/FEATURE    = 0x3f 0x06
      Data Rate        = 250KBPS
      Model            = nRF24L01+
      CRC Length       = 16 bits
      PA Power         = PA_LOW
      

      If the NRF24L01+ isn't correctly wired, the following error will be shown

      pi@raspberrypi ~ $ sudo /usr/local/sbin/PiGatewaySerial
      Starting PiGatewaySerial...
      Protocol version - 1.4
      Created PTY '/dev/pts/2'
      Gateway tty: /dev/ttyMySensorsGateway
      check wires
      

      If this happens, double-check your wiring and correct any problems. Press Ctrl+Z and type

      sudo killall PiGatewaySerial
      

      to get rid of the non-functioning Gateway. Then run sudo /usr/local/sbin/PiGatewaySerial again

      If all is well, exit PiGatewaySerial by pressing Ctrl+C. Then run

      sudo /etc/init.d/PiGatewaySerial start
      

      to start the gateway as a background process. Verify that it started correctly by running

      sudo cat /dev/ttyMySensorsGateway
      

      You should see the message "Gateway startup complete". Exit by typing Ctrl+C.

      MAKE THE GATEWAY AUTOSTART
      To make sure the Gateway is started when your Raspberry Pi boots up, run the following command:

      sudo make enable-gwserial
      

      Enable the gateway for use with Domoticz
      Domoticz (and maybe other home automation systems) has trouble reading from the default path created by PiGatewaySerial. You might need to run the following command:

      sudo ln -s /dev/ttyMySensorsGateway /dev/ttyUSB20
      

      And change /etc/rc.local from this

      exit 0
      
      

      to this

      ln -s /dev/ttyMySensorsGateway /dev/ttyUSB20
      exit 0
      
      

      OTHER NOTES

      • The 3.3V power on the Raspberry Pi is rated for a maximum of 50mA. A regular NRF24L01+ only needs 15mA, but if you are using a power amplified version you might exceed what the Raspberry Pi can output. In that case, an external power supply might be required. If you use an external power source gnd must be connected to the Raspberry Pi's gnd.

      • Connecting the NRF24L01+ directly to your Raspberry Pi will prevent you from using the Raspberry Pi's gpio ports for other things, like a Z-wave board.

      • A user experienced slow data transfer compared to USB-to-Serial(ttl)<-->MySensors Gateway connection, especially on OTA firmware update. If you think this will cause a problem for you, an ethernet gateway might be a better alternative.

      As always, I stand on the shoulders of giants. Related posts:

      • http://forum.mysensors.org/topic/1151/tutorial-raspberry-pi-nrf24l01-direct-connection
      • http://forum.mysensors.org/topic/1974/domoticz-as-controller-and-a-gateway-for-mysensor-nodes-running-on-a-raspberry-pi-2

      TROUBLESHOOTING
      If you get this error

      pi@Domoticz3:~/Raspberry$ sudo /etc/init.d/PiGatewaySerial start
      [....] Starting PiGatewaySerial (via systemctl): PiGatewaySerial.serviceFailed to start PiGatewaySerial.service: Unit PiGatewaySerial.service failed to load: No such file or directory.
       failed!
      

      or this error

      pi@raspberrypi ~ $ sudo /usr/local/sbin/PiGatewaySerial
      sudo: /usr/local/sbin/PiGatewaySerial: command not found
      

      you have probably forgotten to run sudo make install. Read the instructions again, and follow them this time πŸ™‚ User @sineverba reported that a reboot of the Pi after running make install helped.

      posted in Hardware
      mfalkvidd
      mfalkvidd
    • MySensors-powered arcade game screen with wireless gamepad controller

      OK, I realize that I am abusing the MySensors library a bit here πŸ™‚

      I have built a 9x16 pixel, 22" led screen after my last failure. The screen was inspired by this instructable.

      I have also built a wireless gamepad controller:
      0_1481918125040_DSC02831.jpg
      I wanted a barebone look, so I decided to build it directly on a 5x7cm prototype board. On the back is a 2xAA battery holder that is glued to the board. Raw and simple πŸ™‚

      The gamepad uses a nrf24l01+ and a 3.3V Arduino Pro Mini. When powered up, it presents 6 switches to the "gateway", using MySensors.

      The "gateway" is a Wemos D1 Mini connected to the big screen seen below:
      0_1481919082873_DSC09768.jpg
      I merged the standard MySensors serial gateway sketch with a sketch for playing Tetris, and modified the game to read the status of the switches instead of using locally attached buttons.

      I am using the development branch of MySensors since v2.0 doesn't call receive() on the gateway.

      All kudos for the game should go to Aaron Liddiment, https://github.com/AaronLiddiment/LEDSprites - I did not write the game myself.

      Here is the result:
      ESP8266 and MySensors-powered Arduino Tetris game on big FASTLED WS2812B adressable RGB LED screen – 01:17
      β€” Mikael Falkvidd

      The wemos + screen draws less than 1 ampere, so a USB power pack can power it for hours. That means the game is portable and can be used anywhere. It would be fun to play it on the bus/train 😎
      Some thoughts for future development:

      • Add signing and see if that has a negative impact on the gaming experience. I don't want anyone sending fake button presses!
      • Figure out how to handle the screen flickering that happens sometimes. There is a very long thread about this on github: https://github.com/FastLED/FastLED/issues/306
      • Add more games. Snake, Pong, Sokoban, Breakout - ideas are very welcome πŸ‘‚
      • Build one more wireless controller for multiplayer games
      • Add the ability to use the screen as mood light when not playing.
      • Add the ability to show weather when not playing a game (temperature as text, yellow background when sunny, blue/gray "falling" background when raining, etc)
      • Use fadecandy
      • Spectrum analyzer
      posted in My Project
      mfalkvidd
      mfalkvidd
    • MySensors 2.3.1 released

      As an early holiday gift, MySensors 2.3.1 has been released.

      Highlights
      RF24: Add delay after power-up
      RFM69 frequency band support for India
      Improve transport function & debug messages
      Allow flash strings in present() to save RAM

      Release notes and changelog: https://github.com/mysensors/MySensors/releases/tag/2.3.1

      Important information:

      • The NRF24 defines have been renamed to RF24 to use naming that's consistent with the other transport defines.
      • ESP8266 board definitions 2.4.2 or later are REQUIRED for use with this release. If you use ESP8266 board definitions 2.4.1 or earlier you will get an error saying fatal error: gdb_hooks.h: No such file or directory #include "gdb_hooks.h"

      Thanks to all GitHub users who contributed to this release:

      • freynder
      • Jeeva Kandasamy
      • Lee Nelson
      • tekka
      • Yveaux
      • Marcelo Aquino
      • Mikael Falkvidd
      • Patrick Fallberg
      posted in Announcements
      mfalkvidd
      mfalkvidd
    • Office plant monitoring

      I work as development team lead at a software company. We do server and network monitoring. Yesterday we hosted a customer event, and I presented my houseplant monitoring project based on MySensors and Domoticz. The presentation was a hit, and it has been decided that we'll use MySensors to monitor all plants at the office.

      There is not that much to tell from a technical perspective. I hooked up everything according to the MySensor build page and created a simple sketch.

      Thanks to everyone from the MySensors community for a great library, clear instructions and great suggestions for projects. And thanks for making me look like a hero πŸ˜„ Let's continue conquering the world.

      posted in My Project
      mfalkvidd
      mfalkvidd
    • Physical mood light color and brightness selector based on LCD touchscreen (with demo video)

      Alright. I have a project to tell you about. If there was an award for the most needlessly laborious project in the MySensors contest, I think I would have a good shot but since there is no such award I'll just post it here for fun πŸ™‚

      I don't remember where I got the idea from, but the basic idea is a physical color selector for a mood light. A LCD touch display can be mounted inside a regular switch/dimmer wall enclosure. The light level and the color of the mood light is set by touching the display. Physical light switches are conveniently located throughout the house and anyone can use them - you don't need a smartphone with an app.

      So I ordered a 3.2" lcd touch screen. It arrived from China, and I realized I had bought a screen with a 16-bit bus. 16 bit bus means I need to have 16 data pins to send data to the screen. And that is for the data bus only. More pins are needed (RSET, LCD_CS, WR and RS). With an Arduino Mega this would not be a problem, but I only have Pro Minis.

      I figured out how to connect the screen. If I used ALL available pins on the Pro Mini (including the serial RX/TX, so no debugging 😱 ) I could make it show what I wanted. The breadboard setup is really a mess:
      0_1458382025681_breadboard.jpg

      So now I have an Arduino connected to a screen, that can show anything pre-defined. But there is no room for a radio or anything else to use for telling the Arduino what to show on the screen. Or is there? I realized that the LCD_CS pin on the screen can be set to high always. So I connected that to Vcc instead of using one of my precious i/o pins. I now have 1 pin available ❗

      The Arduino Software Serial functions can use any pin for serial communication. 1 available pin means one-way communication. I hooked up another Pro Mini (the flash storage was getting pretty crowded on the first Pro Mini anyway so it was nice to start fresh). Using the Software Serial function I could now send characters from the second Pro mini (called "Touch Dimmer) to the first Pro Mini (called "screen driver"). I can't get any information back, but that's ok.

      Next step was to define a set of commands that the Touch Dimmer Arduino could send to the Screen Driver Arduino. As of now, they look like this:

      fillScr(r,g,b) // Fills the entire screen with the r,g,b color
      drawHSL        // Draws a HSL color picker on the screen
      

      So by sending the text

      fillScr(FF,00,00)
      

      to the Screen Driver, I will fill the entire screen with red. By sending

      drawHSL
      

      the Screen Driver will draw a HSL color palette on the screen like this:
      0_1458381416800_hsl_whitetop.png

      I connected the touch sensor to the Touch Dimmer Arduino and set it up so that when the screen is touched, a color is sent to the mood light.

      For the mood light I used a slightly modified version of @AWI's great mood light from this thread.

      As can be seen in this video, selecting color and brightness by pressing on the screen works pretty OK.
      LCD touchscreen mood light color selector – 01:05
      β€” Mikael Falkvidd

      The sketches I use:
      Screen Driver

      #include <UTFT.h>
      #define NUM_WHITE_PIXELS 20
      #define RED 0
      #define GREEN 1
      #define BLUE 2
      #define SCALE 1
      //unsigned int hsl[240 / SCALE];
      extern unsigned int hsl[0x2170];
      //#define DEBUG
      // Declare which fonts we will be using
      //extern uint8_t SmallFont[];
      
      UTFT screen(ILI9327, A5, A4, A6, A3);
      #include <SoftwareSerial.h>
      
      SoftwareSerial mySerial(A2, A7); // RX, TX. TX is not used in this sketch.
      const byte PRIMES[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71}; // Used to hash the commands
      String message;
      
      
      void setup()
      {
        // Setup the LCD
        screen.InitLCD();
        //  screen.setFont(SmallFont);
        screen.clrScr();
        screen.setBrightness(255);
        mySerial.begin(57600);
      #if defined (DEBUG)
        Serial.begin(115200);
        Serial.println("Ready");
      #endif
      }
      
      void loop()
      {
        byte current_char = 0;
        while (true) {
          while (mySerial.available() > 0) {
            char c = mySerial.read();
            if (c == '\r' || c == '\n') {
              // We got a newline. That means end of message.
              if (current_char == 0) {
                // Some systems use \n for newline. Some \r. Some \r\n. In case of the last, we filter out the second character.
                continue;
              }
              handle_message(message);
              message = "";
              current_char = 0;
              continue;
            }
            // We got another character. Add it to the buffer.
            message = String(message + c);
            current_char++;
          }
        }
      }
      
      void handle_message(String message) {
        // 1. Split the message into command + the rest
        // 2. Create a hash of the command to make a switch statement work
        // 3. Let each case-switch parse the rest of the string
      
        int command_next_pos = message.indexOf(',');
        String command = message.substring(0, command_next_pos);
      
        unsigned long command_hash = hash(command);
      
      #if defined (DEBUG)
        Serial.print("case ");
        Serial.print(command_hash);
        Serial.print(": // ");
        Serial.println(command);
        Serial.println("");
        Serial.println("break;");
      #endif
        byte r, g, b, next_pos, pos;
      
        switch (command_hash) {
          case 1922:
      #if defined (DEBUG)
            Serial.println("TEST");
      #endif
            break;
          case 25880: // setBrightness
            // setBrightness is not supported by my screen. Implement later.
      
            break;
          case 5953: // fillScr(r,g,b)
            pos = command_next_pos;
            next_pos = message.indexOf(',', pos + 1);
      #if defined (DEBUG)
            Serial.print("pos=");
            Serial.println(pos);
            Serial.print("next_pos=");
            Serial.println(next_pos);
            Serial.print("message_first_substring=");
            Serial.println(message.substring(pos + 1, next_pos));
      #endif
            r = message.substring(pos + 1, next_pos).toInt();
            pos = next_pos;
            next_pos = message.indexOf(',', pos + 1);
            g = message.substring(pos + 1, next_pos).toInt();
            pos = next_pos;
            next_pos = message.indexOf(',', pos + 1);
            b = message.substring(pos + 1, next_pos).toInt();
      #if defined (DEBUG)
            Serial.print("fillScr(");
            Serial.print(r);
            Serial.print(",");
            Serial.print(b);
            Serial.print(",");
            Serial.print(g);
            Serial.println(")");
      #endif
            screen.fillScr(r, g, b);
            break;
          case 8260: // setColor
      
            break;
          case 20365: // setBackColor
      
            break;
          case 10548: // drawPixel
      
            break;
          case 7850: // drawLine
      
            break;
          case 7962: // drawRect
      
            break;
          case 24512: // drawRoundRect
      
            break;
          case 7917: // fillRect
      
            break;
          case 24403: // FillRoundRect
      
            break;
          case 13194: // drawCircle
      
            break;
          case 13149: // fillCircle
      
            break;
          case 9890: // printNumI
      
            break;
          case 9821: // printNumF
      
            break;
          case 4014: // lcdOff
            // lcdOff is not supported by my screen, but let's issue the command anyway
            //screen.lcdOff();
            break;
          case 2776: // lcdOn
            // lcdOn is not supported by my screen, but let's issue the command anyway
            //screen.lcdOn();
            break;
          case 5023: // drawHSL
            drawHSL();
            break;
      
        }
      }
      /*
      void drawHSL() {
          screen.drawBitmap(0, 0, 107, 80, hsl, 3);
      }
      */
      void drawHSL() {
        screen.fillScr(0,0,0);
        float hue;
        float saturation = 1;
        float lightness;
        unsigned int height = screen.getDisplayYSize();
        unsigned int width = screen.getDisplayXSize();
        byte rgb[3] = {0};
        for (unsigned int x = 0; x < width; x += SCALE) {
          hue = ((float)x) / width;
          for (unsigned int y = 0; y < height; y += SCALE) {
            lightness = ((float)y) / (height - NUM_WHITE_PIXELS); // top NUM_WHITE_PIXELS pixels represent white, full power
            hslToRgb(hue, saturation, lightness, rgb);
            screen.setColor(rgb[RED], rgb[GREEN], rgb[BLUE]);
            screen.drawPixel(x, y);
          }
        }
      }
      
      unsigned long hash(String command) {
        unsigned long hash = 0;
        for (int i = 0; i < command.length(); i++) {
          hash += PRIMES[i] * command[i];
        }
        return hash;
      }
      
      /**
      * Adapted from http://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion
      * Converts an HSL color value to RGB. Conversion formula
       * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
      * Assumes h, s, and l are contained in the set [0, 1] and
      * returns r, g, and b in the set [0, 255].
      *
      * @param   Number  h       The hue
      * @param   Number  s       The saturation
      * @param   Number  l       The lightness
      * @return  Array           The RGB representation
      */
      void hslToRgb(float h, float s, float l, byte * rgbIn) {
        float r, g, b;
      
        if (s == 0) {
          r = g = b = l; // achromatic
        } else {
          float q = l < 0.5 ? l * (1 + s) : l + s - l * s;
          float p = 2 * l - q;
          r = hue2rgb(p, q, h + 1.0 / 3);
          g = hue2rgb(p, q, h);
          b = hue2rgb(p, q, h - 1.0 / 3);
        }
        rgbIn[0] = min(r * 255, 255);
        rgbIn[1] = min(g * 255, 255);
        rgbIn[2] = min(b * 255, 255);
      }
      
      float hue2rgb (float p, float q, float t) {
        if (t < 0) t += 1;
        if (t > 1) t -= 1;
        if (t < 1.0 / 6) return p + (q - p) * 6 * t;
        if (t < 1.0 / 2) return q;
        if (t < 2.0 / 3) return p + (q - p) * (2.0 / 3 - t) * 6;
        return p;
      }
      

      Touch Dimmer

      #include <UTouch.h>
      #include <SoftwareSerial.h>
      #define DEBUG
      #include <MySensor.h>
      #include <SPI.h>
      
      #define SAVE_LIGHT_R 0
      #define SAVE_LIGHT_G 1
      #define SAVE_LIGHT_B 2
      const char INITIALCOLOR[] = "FFAA55";
      const byte PRIMES[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71}; // Used to hash the commands
      
      SoftwareSerial screen(A7, A2); // RX, TX. RX is not used in this sketch.
      UTouch myTouch( 6, 5, 4, 3, 2);
      MySensor gw;
      MyMessage RGBMsg(0, V_RGB);
      MyMessage solidColorMsg(2, V_STATUS);
      MyMessage setColorMsg(3, V_TEXT);
      
      void setup() {
        solidColorMsg.setDestination(12);
        setColorMsg.setDestination(12);
        Serial.begin(115200);
        Serial.println("Starting setup");
        delay(10);
        myTouch.InitTouch();
        myTouch.setPrecision(PREC_HI); // We don't need speed so we might as well go for precision
        screen.begin(57600);
        Serial.println("gw begin starts");
        delay(10);
        gw.begin(incomingMessage, AUTO, false);
        Serial.println("gw begin finished");
        delay(10);
        gw.sendSketchInfo("Mood light touchscreen", "1.0");
        gw.present(0, S_RGB_LIGHT, "RGB");// present to controller
        Serial.println("Setup done");
        // TODO: Fetch current value from controller instead of using black
        String initialColorCmd = "drawHSL";
        screen.println(initialColorCmd);
      
      
      }
      
      void loop() {
        gw.process();
      
        long x, y;
        byte temp_R, temp_G, temp_B;
        while (myTouch.dataAvailable() == true)
        {
          myTouch.read();
          x = myTouch.getX();
          y = myTouch.getY();
          if ((x != -1) and (y != -1))
          {
            Serial.print(x);
            Serial.print(",");
            Serial.println(y);
            float hue = x / 320.0;
            float saturation = 1;
            float lightness = y / (240.0 - 20); // top 20 pixels represent white, full power
            byte rgb[3] = {0};
            hslToRgb(hue, saturation, lightness, rgb);
      
            String colorCommand = rgbarrayToString(rgb);
            String command = String("fillScr," + colorCommand);
            char colorMessage[7];
            rgbarrayToHexstring(rgb).toCharArray(colorMessage, 7);
            //gw.send(RGBMsg.set(colorMessage));
            //gw.send(updateColor.set(colorMessage));
            gw.send(solidColorMsg.set(true));
            gw.send(setColorMsg.set(colorMessage));
            //screen.println(command);
            //screen.flush();
            //Serial.println(command);
            gw.wait(100); // More frequent updates than this will just make the screen updates irratic
          }
        }
      }
      
      void incomingMessage(const MyMessage &message) {
      
        if (message.type == V_RGB) {
          String hexstring = message.getString();
          Serial.print("RGB command: ");
          Serial.println(hexstring);
          setColor(hexstring);
        }
      }
      
      void setColor(String hexstring) {
        byte r, g, b;
        unsigned long number = strtoul( &hexstring[0], NULL, 16);
        Serial.print("Color long: ");
        Serial.println(number);
        byte RValue = number >> 16;
        byte GValue = number >> 8 & 0xFF;
        byte BValue = number & 0xFF;
      
        Serial.print("Color: ");
        Serial.println(hexstring);
        Serial.print("Red: ");
        Serial.println(RValue);
        Serial.print("Green: ");
        Serial.println(GValue);
        Serial.print("Blue: ");
        Serial.println(BValue);
      
      }
      
      String rgbarrayToString(byte *rgb) {
        return String(String(rgb[0]) + "," + String(rgb[1]) + "," + String(rgb[2]));
      }
      String rgbarrayToHexstring(byte *rgb) {
        char hexString[7];
        for (byte i = 0; i < 3; i++) {
          sprintf(hexString + i * 2, "%02X", rgb[i]);
        }
        hexString[6] = '\0';
        return hexString;
      }
      
      /**
      * Adapted from http://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion
      * Converts an HSL color value to RGB. Conversion formula
       * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
      * Assumes h, s, and l are contained in the set [0, 1] and
      * returns r, g, and b in the set [0, 255].
      *
      * @param   Number  h       The hue
      * @param   Number  s       The saturation
      * @param   Number  l       The lightness
      * @return  Array           The RGB representation
      */
      void hslToRgb(float h, float s, float l, byte *rgbIn) {
        float r, g, b;
      
        if (s == 0) {
          r = g = b = l; // achromatic
        } else {
          float q = l < 0.5 ? l * (1 + s) : l + s - l * s;
          float p = 2 * l - q;
          r = hue2rgb(p, q, h + 1.0 / 3);
          g = hue2rgb(p, q, h);
          b = hue2rgb(p, q, h - 1.0 / 3);
        }
        rgbIn[0] = min(r * 255, 255);
        rgbIn[1] = min(g * 255, 255);
        rgbIn[2] = min(b * 255, 255);
      }
      
      float hue2rgb (float p, float q, float t) {
        if (t < 0) t += 1;
        if (t > 1) t -= 1;
        if (t < 1.0 / 6) return p + (q - p) * 6 * t;
        if (t < 1.0 / 2) return q;
        if (t < 2.0 / 3) return p + (q - p) * (2.0 / 3 - t) * 6;
        return p;
      }
      
      unsigned long hash(String command) {
        unsigned long hash = 0;
        for (int i = 0; i < command.length(); i++) {
          hash += PRIMES[i] * command[i];
        }
        return hash;
      }
      

      Mood Light

      /*
       PROJECT: MySensors / RGB light NEOPIXEL
       PROGRAMMER: AWI
       DATE: october 10, 2015/ last update: october 14, 2015
       FILE: AWI_RGB.ino
       LICENSE: Public domain
      
       Hardware: Nano and MySensors 1.5, Wall light 16 WS2812B leds (neopixel)
      
       Special:
          uses Fastled library with NeoPixel (great & fast RBG/HSV universal library)             https://github.com/FastLED/FastLED
      
       SUMMARY:
      
          Different patterns and brightness settings
      
          Button switches on/off and cycles through all Color patterns on long press
      
       Remarks:
          Fixed node-id
      
      */
      
      #include <MySensor.h>
      #include <SPI.h>
      #include <FastLED.h>                                        // https://github.com/FastLED/FastLED
      #include <Button.h>                                         // https://github.com/JChristensen/Button
      
      const int stripPin = 5 ;                                    // pin where 2812 LED strip is connected
      const int buttonPin = 4 ;                                   // push button
      const int numPixel = 12 ;                                   // set to number of pixels (x top / y bottom)
      
      const int NODE_ID = 12;                                    // fixed MySensors node id
      const int RGB_LightChild = 0 ;                              // Child Id's, standard light child on/off/ dim
      const int RGB_RGBChild = 1 ;                                // RGB light child (on/off/dim/color, if controller supports V_RBG))
      const int RGB_SolidColorChild = 2 ;                         // when set, node reads Color text from ColorTextChild
      const int RGB_TextColorChild = 3 ;                          // Holds Text value for color (custom colors from controller)
      const int RGB_AlarmPatternChild = 4 ;                       // Switches to alarm status
      const int RGB_NextPatternChild = 5 ;                        // Move to next pattern when set
      
      CRGB leds[numPixel];
      
      // Kelving colors: Light & daylight (in Fastled reference only)
      /// 1900 Kelvin Candle=0xFF9329 /* 1900 K, 255, 147, 41 */,
      /// 2600 Kelvin Tungsten40W=0xFFC58F /* 2600 K, 255, 197, 143 */,
      /// 2850 Kelvin Tungsten100W=0xFFD6AA /* 2850 K, 255, 214, 170 */,
      /// 3200 Kelvin Halogen=0xFFF1E0 /* 3200 K, 255, 241, 224 */,
      /// 5200 Kelvin CarbonArc=0xFFFAF4 /* 5200 K, 255, 250, 244 */,
      /// 5400 Kelvin HighNoonSun=0xFFFFFB /* 5400 K, 255, 255, 251 */,
      /// 6000 Kelvin DirectSunlight=0xFFFFFF /* 6000 K, 255, 255, 255 */,
      /// 7000 Kelvin OvercastSky=0xC9E2FF /* 7000 K, 201, 226, 255 */,
      /// 20000 Kelvin ClearBlueSky=0x409CFF /* 20000 K, 64, 156, 255 */
      
      char controllerRGBvalue[] = "FF9329";                       // Controller sent RGB value, default
      uint16_t curBrightness, actualBrightness, controllerRGBbrightness = 0x7F ;  // Brightness globals
      unsigned long updateBrightnessDelay, lastBrightnessUpdate ; // Brightness timers
      int RGBonoff ;                                              // OnOff flag
      
      enum { pSolid, pOff, pAlarm, pFire, pFire2, pCandle, pRainbow}  ;   // Pattern globals (stored in int for convenience)
      const int lastPatternIdx = pRainbow + 1 ;                   // use last pattern for patterncount
      int curPattern ;                                            // current pattern
      unsigned long updatePatternDelay, lastPatternUpdate ;       // Pattern timers
      
      #define RADIODELAY 250
      unsigned long idleTimer = millis() ;                        // return to idle timer
      int idleTime = 10000 ;                                      // return to idle after 10 secs
      
      // initialize MySensors (MySensors 1.5 style)
      MySensor gw;
      
      MyMessage lightRGBMsg(RGB_LightChild,  V_RGB);              // standard messages, light
      MyMessage lightdimmerMsG(RGB_LightChild , V_DIMMER);
      MyMessage lightOnOffMessage(RGB_LightChild, V_STATUS);
      
      Button myBtn(buttonPin, true, true, 20);                    //Declare the button (pin, pull_up, invert, debounce_ms)
      
      // Simple state machine for button state
      enum {sIdle, sBrightness, sPattern} ;                        // simple state machine for button press
      int State ;
      
      void setup() {
        FastLED.addLeds<WS2812, stripPin, GRB >(leds, numPixel) ;  // initialize led strip .setCorrection(TypicalLEDStrip);
      
        gw.begin(incomingMessage, NODE_ID, false);              // initialize MySensors
        gw.sendSketchInfo("AWI RGB Wall 0", "1.0");
        gw.wait(RADIODELAY);
        gw.present(RGB_RGBChild, S_RGB_LIGHT, "RGB Wall RGB 0");// present to controller
        gw.wait(RADIODELAY);
        gw.present(RGB_LightChild, S_LIGHT, "RGB Wall Light 0");
        gw.wait(RADIODELAY);
        gw.present(RGB_SolidColorChild, S_LIGHT, "RGB Set Solid color (text) 0");
        gw.wait(RADIODELAY);
        gw.present(RGB_TextColorChild, S_INFO, "RGB Wall textcolor 0");
        gw.wait(RADIODELAY);
        gw.present(RGB_AlarmPatternChild, S_BINARY, "RGB Wall Alarm 0");
        gw.wait(RADIODELAY);
        gw.present(RGB_NextPatternChild, S_BINARY, "RGB Wall Pattern 0");
      
        // initialize strip with color and show (strip expects long, so convert from String)
        for (int i = 0 ; i < 6 ; i++) {                         // get color value from EEPROM (6 char)
          controllerRGBvalue[i] = gw.loadState(i) ;
        }
        setLightPattern(pSolid, NULL) ;                         // default controller Solid
        FastLED.show();
        State = sIdle ;                                         // Initial state
        //randomSeed(analogRead(0));
      }
      
      // read button and act accordingly
      // short press: on/off
      // longer press: set patterns with following short press
      // long press: set brightness increase
      void loop() {
        gw.process();                                           // wait for incoming messages
        myBtn.read();                                           //Read the button (only read)
        unsigned long now = millis();                           // loop timer reference
        switch (State) {
          case sIdle:                                         // default state, browse through patterns
            if (myBtn.wasReleased()) {                      // light on/ off in idle
              RGBonoff = !RGBonoff ;                      // invert light state
              setLightPattern((RGBonoff == 1) ? pOff : pSolid, 100);
              gw.send(lightOnOffMessage.set(RGBonoff));   // and update controller
            } else if (myBtn.pressedFor(500)) {             // move to Pattern update state with long press
              idleTimer = now ;                           // return to idle after ...
              State = sPattern ;
            }
            break ;
          case sPattern:                                      // entered after long press
            if (myBtn.pressedFor(2000)) {                   // when press even longer move to Brightness update
              State = sBrightness ;
            } else if (myBtn.wasPressed()) {
              setLightPattern((curPattern + 1) % lastPatternIdx, 500 ); // increase pattern and wrap
              idleTimer = now ;
            } else if ( now > idleTime + idleTimer  ) {     // return to idle after ...
              State = sIdle ;
            }
            break ;
          case sBrightness:                                   // entered after looong press
            if (myBtn.wasPressed()) {                           // if pressed again increase brightness
              setLightBrightness((curBrightness + 1) % 0xFF, 0) ; // increase brightness and wrap (0..0xFF)
              idleTimer = now ;
            } else if ( now > idleTime + idleTimer  ) {     // return to idle after ...
              State = sIdle ;
            }
            break ;
          default :
            State = sIdle ;
            break ;
        }
        updateLightBrightness();                                // update Brightness if time
        updateLightPattern();                                   // update Pattern if time
      }
      
      // Sets the light brightness, takes value and time (ms) as input
      void setLightBrightness(int newBrightness, unsigned long updateTime) {
        // global: curBrightness, actualBrightness, updateBrightnessDelay
        updateBrightnessDelay = updateTime / 0xFF ;             // delay = time / max steps
        actualBrightness = curBrightness ;                      // assume curBrightness is actual
        curBrightness = newBrightness ;                         // set curBrightness to new value, rest is done in update
      }
      
      // Update the light brightness if time
      void updateLightBrightness() {
        // global: curBrightness, actualBrightness, updateBrightnessDelay, lastBrightnessUpdate ;
        unsigned long now = millis() ;
        if (now > lastBrightnessUpdate + updateBrightnessDelay) { // check if time for update
          if ( actualBrightness > curBrightness) {
            FastLED.setBrightness( actualBrightness-- );
            FastLED.show();
          } else if ( actualBrightness < curBrightness) {
            FastLED.setBrightness( actualBrightness++ );
            FastLED.show();
          }
          lastBrightnessUpdate = now ;
        }
      }
      
      // **** Pattern routines *****
      // Sets and initializes the light pattern if nescessary
      void setLightPattern( int newPattern, unsigned long updateDelay) {
        // global: curPattern, updatePatternDelay
        curPattern = newPattern ;
        updatePatternDelay = updateDelay ;                      // delay for next pattern update, can be changed in pattern
        switch (curPattern) {
          case pSolid:                                        //  solid is controller value in all pixels
            for (int i = 0 ; i < numPixel ; i++) leds[i] = strtol( controllerRGBvalue, NULL, 16);
            FastLED.show();
            break ;
          case pOff:                                          //  off state all pixels off
            for (int i = 0 ; i < numPixel ; i++) leds[i] = 0 ;
            FastLED.show();
            break ;
          default :
            break ;
        }
      }
      
      // Update the light pattern when time for it
      void updateLightPattern() {
        // global: curPattern, updatePatternDelay, lastPatternUpdate
        unsigned long now = millis() ;
        if (now > lastPatternUpdate + updatePatternDelay) {     // check if time for update
          switch (curPattern) {
            case pAlarm:                                    // flash light
              patternAlarm();
              break ;
            case pFire:                                     // wild fire
              patternFire();
              break ;
            case pFire2:                                    // cosy fire
              patternFire2();
              break ;
            case pCandle:                                   // flame
              patternCandle();
              break ;
            case pRainbow:                                  // rotating rainbow
              patternRainbow();
              break ;
            case pSolid:                                    // do nothing fall through
            case pOff:
            default :                                       // def
              break ;
          }
          lastPatternUpdate = now ;
        }
      }
      
      // Define the different patterns
      // Alarm - intermittent white and red color, full intensity, intermittent top & bottom half
      void patternAlarm() {
        static boolean topBot ;                         // indicates direction for next entry
        const CRGB colorTop = CRGB(0xFF, 0, 0 );                // red color
        const CRGB colorBottom = CRGB(0xFF, 0xFF, 0xFF );       // white color
        FastLED.setBrightness(0xFF);                            // set the strip brightness
        for (int i = 0; i <= (numPixel / 2 - 1) ; i++) {                // for half of strip size
          leds[i] = topBot ? colorTop : colorBottom ;
          leds[i + (numPixel / 2)] = topBot ? colorBottom : colorTop ;
        }
        topBot = !topBot ;                                      // switch direction
        FastLED.show();
      }
      
      // Simulate fire with red color, varying number of leds intensity & tempo
      void patternFire() {
        byte numberLeds = random(0, numPixel);                  // start number and end of led's for flickering
        byte lum = random(100, 255);                            // set brightness
        CRGB color = CRGB(200, 50 + random(1, 180), 0 );        // get red color with varying green
        for (int i = 0; i <= numberLeds; i++) {
          leds[i] = color ;
          FastLED.setBrightness(lum);                           // set the strip brightness
          FastLED.show();
          gw.wait(random(0, 10));
        }
        updatePatternDelay = 100 ;
      }
      
      // Simulate fire with red color and varying intensity & tempo
      void patternFire2() {
        CRGB color = CRGB(200, random(100, 150), 0);            // get red color with varying green
        for (byte p = 0; p < numPixel; p++) {
          leds[p] = color;
        }
        FastLED.setBrightness(random(50, 255));
        FastLED.show();
        updatePatternDelay = random(20, 300);                   // variable delay
      }
      
      // Simulate candle based on fire with red color, varying number of leds intensity & tempo
      void patternCandle() {
        byte numberLeds = random(0, numPixel);                  // start number and end of led's for flickering
        byte lum = random(60, 80);                              // set brightness
        CRGB color = CRGB(200, 50 + random(40, 100), 0 );       // get red color with varying green
        for (int i = 0; i <= numberLeds; i++) {
          leds[i] = color ;
          FastLED.setBrightness(lum);                           // set the strip brightness
          FastLED.show();
          gw.wait(random(5, 10));
        }
        updatePatternDelay = 100 ;
      }
      
      
      void patternRainbow() {
        static uint16_t hue ;                               // starting color
        FastLED.clear();
        // for(hue=10; hue<255*3; hue++) {
        hue = (hue + 1) % 0xFF ;                                // incerease hue and wrap
        fill_rainbow( leds, numPixel , hue /*static hue value */, 5);// set a rainbow from hue to last in stepsize 5
        FastLED.show();
        updatePatternDelay = 100 ;
      }
      
      // Incoming messages from MySensors
      void incomingMessage(const MyMessage &message) {
        int ID = message.sensor;
        Serial.print("Sensor: ");
        Serial.println(ID);
        switch (ID) {
          case RGB_LightChild:                                // same behaviour as RGB child/ fall through
          case RGB_RGBChild:                                  // if controller can handle V_RGB
            if (message.type == V_RGB) {                    // check for RGB type
              strcpy(controllerRGBvalue, message.getString());// get the payload
              setLightPattern(pSolid, NULL);              // and set solid pattern
            } else if (message.type == V_DIMMER) {          // if DIMMER type, adjust brightness
              controllerRGBbrightness = map(message.getLong(), 0, 100, 0, 255);
              setLightBrightness(controllerRGBbrightness, 2000) ;
            } else if (message.type == V_STATUS) {          // if on/off type, toggle brightness
              RGBonoff = message.getInt();
              setLightBrightness((RGBonoff == 1) ? controllerRGBbrightness : 0, 2000);
            }
            break ;
          case RGB_SolidColorChild:                           // request color from controller
            if (message.type == V_STATUS) {                 // if get color from text child
              //gw.request(RGB_TextColorChild, V_TEXT);
              setLightPattern(pSolid, NULL);                  // and set solid pattern (if not alre)
            }
            break ;
          case RGB_TextColorChild:                            // Text color from controller
            if (message.type == V_TEXT) {                   // if get color from text child
              //gw.request(RGB_TextColorChild, V_TEXT);
              strcpy(controllerRGBvalue, message.getString());// get the payload
              Serial.print(" RGB_TextColorChild Color: "); Serial.println(controllerRGBvalue);
              for (int i = 0 ; i < 6 ; i++) {             // save color value to EEPROM (6 char)
                gw.saveState(i, controllerRGBvalue[i]) ;
              }// Save to EEPROM
            }
            break ;
          case RGB_AlarmPatternChild:                         // set Alarm pattern
            if (message.type == V_STATUS) {                 // if get color from text child
              if (message.getInt() == 1) {
                setLightPattern(pAlarm, 500);           // set slow alarm pattern
              } else {
                setLightPattern(pSolid, NULL);          // and set solid pattern
                FastLED.setBrightness(curBrightness);
              }
            }
            break ;
          case RGB_NextPatternChild:                          // next pattern
            if (message.type == V_STATUS) {                 // if get color from text child
              if (message.getInt() == 1 ) {
                setLightPattern((curPattern + 1) % lastPatternIdx, 500 ); // increase pattern and wrap
              }
            }
            break ;
        }
        FastLED.show();
        dispRGBstat();
      }
      // debug
      // display the status of all RGB: controller, requested, real
      void dispRGBstat(void) {
        Serial.print(" Color: "); Serial.print(controllerRGBvalue);
        Serial.print(" Brightness: "); Serial.println(controllerRGBbrightness);
      }
      

      Things I learned:

      • Color palettes and color spaces are hard
      • Do NOT buy a screen with a 16-bit wide bus. There are lots of nice screens that use SPI, for example this http://www.aliexpress.com/item/2-4-240x320-SPI-TFT-LCD-Serial-Port-Module-5V-3-3V-PBC-Adapter-Micro-SD/2031285535.html
      • Hard problems are a lot of fun to crack
      • The Software Serial functions are very easy to work with and handle high speeds.

      Improvement ideas:

      • The HSL palette doesn't look very good when rendered on the screen. I don't know why, but I suspect some rounding problem.
      • With the current setup it is not possible to set the mood light to white and adjust brightness (without selecting a color).
      • It would be cool to add support for "gestures" - for example turn on the light at full brightness when swiping up, turn off the light when swiping down.
      • It would be possible to control several mood lights (or mood light in different rooms) from the same physical location by swiping left and right to select which room to control.
      • The String functions are not very good for memory-constrained environments like Arduinos so it would probably be wise to use something else. I haven't experiences any problems though.

      Special thanks to @m26872 for encouraging me to finish this crazy project and post about it

      posted in My Project
      mfalkvidd
      mfalkvidd
    • RE: What did you build today (Pictures) ?

      Top shelf is for network stuff
      0_1555446671813_IMG_1208_edit.jpg

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Dimmable LED kitchen light (Arduino, APDS-9960, RGBWW led)

      Today I learned that the APDS-9960 will detect steam. The kitchen went dark when I poured up boiling pasta and the steam ventured under the sensor. Exciting times πŸ˜‰

      posted in OpenHardware.io
      mfalkvidd
      mfalkvidd
    • New esp32 board with more io pins, compatible with d1 mini

      https://www.wemos.cc/en/latest/s2/s2_mini.html

      Seems like a very nice board

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

      0_1532633094874_File-2018-07-26,-20-56-31.jpg
      Today I soldered the Velleman EDU09 oscilloscope kit. The kit is quite cheap (~50 EUR in local store). The specs aren't impressive (max 200kHz and min 100mV/division) but hopefully it can help me learn how to use a scope before I buy a real one.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RGB night lamp

      My niece and I made a night light based on a halloween-themed candy jar. Color and brightness can be controlled by a mobile app. The app also has a "party mode".

      RGB night light controlled from mobile phone app – 00:23
      β€” Mikael Falkvidd

      RGB night light (esp32, BLE-controlled from mobile using Blynk) – 00:19
      β€” Mikael Falkvidd

      The app looks like this:
      Kalle Blynk_cropped.png

      Hardware-wise, we used:

      • plastic skull with candy (eating the candy was a tough job, but someone had to do it)
      • esp32
      • rgb led strip
      • capacitor

      Kalle esp32.JPG

      We put some fluffy cotton inside the skull to diffuse the light.

      Sketch:

      #include <FastLED.h>
      #define NUM_LEDS 60
      #define DATA_PIN 13
      CRGB leds[NUM_LEDS];
      
      // Blynk
      #define BLYNK_PRINT Serial
      #define BLYNK_USE_DIRECT_CONNECT
      //#define BLYNK_DEBUG
      #include <BlynkSimpleEsp32_BLE.h>
      #include <BLEDevice.h>
      #include <BLEServer.h>
      char auth[] = "YOUR-BLYNK-AUTH-HERE";
      
      byte mode = 0;
      byte r = 0;
      byte g = 0;
      byte b = 0;
      void setup() {
        Serial.begin(115200);
        Serial.println("Started");
        delay(2000); // sanity check delay - allows reprogramming if accidently blowing power w/leds
        FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS);
        Serial.println("Started");
        Blynk.setDeviceName("NIGHT_LIGHT");
        Serial.print("Blynk token: ");
        Serial.println(auth);
        Blynk.begin(auth);
      }
      
      void loop() {
        switch (mode) {
          case 0:
            FastLED[0].showColor(CRGB(r, g, b), NUM_LEDS, 255);
            break;
          case 1:
            pride();
            break;
        }
        FastLED.show();
        Blynk.run();
      }
      
      BLYNK_WRITE(V1) // zeRGBa assigned to V1
      {
        // get a RED channel value
        r = param[0].asInt();
        // get a GREEN channel value
        g = param[1].asInt();
        // get a BLUE channel value
        b = param[2].asInt();
      #ifdef DEBUG
        Serial.print("RGB: ");
        Serial.print(r);
        Serial.print(",");
        Serial.print(g);
        Serial.print(",");
        Serial.print(b);
      #endif
      
      }
      BLYNK_WRITE(V0) // On/off
      {
        mode = param.asInt();
        FastLED.clear();
      }
      void pride()
      {
        static uint16_t sPseudotime = 0;
        static uint16_t sLastMillis = 0;
        static uint16_t sHue16 = 0;
      
        uint8_t sat8 = beatsin88( 87, 220, 250);
        uint8_t brightdepth = beatsin88( 341, 96, 224);
        uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256));
        uint8_t msmultiplier = beatsin88(147, 23, 60);
      
        uint16_t hue16 = sHue16;//gHue * 256;
        uint16_t hueinc16 = beatsin88(113, 1, 3000);
      
        uint16_t ms = millis();
        uint16_t deltams = ms - sLastMillis ;
        sLastMillis  = ms;
        sPseudotime += deltams * msmultiplier;
        sHue16 += deltams * beatsin88( 400, 5, 9);
        uint16_t brightnesstheta16 = sPseudotime;
      
        for ( uint16_t i = 0 ; i < NUM_LEDS; i++) {
          hue16 += hueinc16;
          uint8_t hue8 = hue16 / 256;
      
          brightnesstheta16  += brightnessthetainc16;
          uint16_t b16 = sin16( brightnesstheta16  ) + 32768;
      
          uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536;
          uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
          bri8 += (255 - brightdepth);
      
          CRGB newcolor = CHSV( hue8, sat8, bri8);
      
          uint16_t pixelnumber = i;
          pixelnumber = (NUM_LEDS - 1) - pixelnumber;
      
          nblend( leds[pixelnumber], newcolor, 64);
        }
      }
      
      posted in My Project
      mfalkvidd
      mfalkvidd
    • Atmega328 internal temperature sensor (yes it exists!)

      I few days ago I learned something new about the atmega328: it has an internal temperature sensor.

      The specs are awful: +-10 degrees C! This is uncompensated though.

      Also, the internal temperature sensor will (of course) read a higher temperature when the mcu is running. But many MySensors nodes sleep almost all the time, and will not generate heat because if it did it would drain the battery pretty quickly.

      I decided to put the sensor to test, comparing it with a BME280.

      I first ran it with the "default" compensation using the code at http://www.netquote.it/nqmain/2011/04/arduino-nano-v3-internal-temperature-sensor/
      The BME280 said 23 degrees, the Atmega328 internal sensor said -9.6 degrees C. That's 73 vs 15F for our friends dominated by the imperialists.

      I added the (linear) compensation to bring it back to 23 and let it log data for almost 40 hours. This was the result:
      0_1535915778309_4a02e06b-2a5c-4219-aead-66c81038eb16-image.png

      The difference:
      0_1535915802088_0157ce8d-0180-4327-b66d-b9074f08b6fa-image.png

      After adjusting the compensation (not sure why the original compensation was so off):
      0_1535915973056_48c177ae-60f9-4e84-abad-f8b6469b5a6f-image.png

      Difference:
      0_1535916472461_aabc9c4d-def5-4f8b-8fa8-81f998588a98-image.png

      So for normal indoor temperatures, it seems like the internal temperature sensor can be quite OK, as long as it is compensated. I think I'll add this temperature reading to my plant monitor nodes. It is free, and it probably has the same level of accuracy as the DHT22.

      It would be interesting to see the difference over a larger temperature span, but that will have to wait for another day.

      Sketch:

      // Based on http://www.avdweb.nl/arduino/hardware-interfacing/temperature-measurement.html
      #include <avr/pgmspace.h>
      
      #include "ChipTemp.h"
      #define MY_DEBUG
      #define MY_GATEWAY_SERIAL
      
      #include <MySensors.h>
      #define CALIBRATION_TEMP 23
      
      ChipTemp chipTemp;
      
      void setup()
      {
        Serial.begin(115200);
      }
      
      void loop()
      {
        Serial.print(chipTemp.deciCelsius() / 10.0, 1); Serial.println(" ");
        Serial.print("New offset at CALIBRATION_TEMP degrees: "); Serial.println(chipTemp.deciCelsius() * gain / 10 + offset - gain * CALIBRATION_TEMP);
        sleep(60000);
      }
      

      Read more: https://playground.arduino.cc/Main/InternalTemperatureSensor (especially the links at the end)

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

      Great idea @sundberg84
      This prompted me to finally get started on something that I've put off for far too long, especially considering how little work it was.

      I'm still using dupont wires to connect my radios, despite better solutions such as the easypcb being available. But this quick little trick makes it easier to switch the radio modules.
      Building a NRF24L01+ 8-pin connector for MySensors – 04:46
      β€” Mikael Falkvidd

      You'll need:

      • Dupont female-female wires (I use 10cm), https://www.aliexpress.com/item/Free-Shipping-1lot-40pcs-lot-10cm-2-54mm-1pin-femal-to-femal-jumper-wire-Dupont-cable/32329983091.html
      • 4x2 jumper wire connector/header from a 620 pcs kit, https://www.aliexpress.com/item/620-Pcs-1-Set-Jumper-Wire-Cable-Pin-Header-Connector-Kit-Male-Crimp-Female-Pin-Terminal/32816829548.html
      • NRF24L01+ radio module, https://www.aliexpress.com/item/Free-shiping-best-prices-10pcs-lot-NRF24L01-NRF24L01-Wireless-Module-2-4G-Wireless-Communication-Module/674686536.html
      • Small screwdriver

      In the future, I plan to build the other end of the connector for Pro Mini and Rasbperry Pi.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • MySensors capabilities deciphering

      When a MySensors node starts, it outputs its capabilities, like this:
      MCO:BGN:INIT CP=RNNG--Q-

      If anyone needs to decipher them, you can use this google spreadsheet.

      There is a feature request to have the capabilities added to the official MySensors Doxygen documentation and the log parser, but until that's available you are welcome to use the spreadsheet.

      posted in Troubleshooting
      mfalkvidd
      mfalkvidd
    • RE: Discussion: Reliable delivery

      Very cool! Thanks a lot @hek! Can't believe I have read several hundred forum posts about the protocol design and ack problems the last two weeks without realizing that what I needed was already included in the library.

      From the discussions I've read it looks like almost no-one else has understood either.

      Some ideas to help people understand how to use the built-in features for reliable delivery:

      1. Add an example that has a complete implementation of end-to-end ack usage. This includes
      • setting up timer(s) for re-sending
      • storing sent messages so they can be re-sent
      • determining which message was acked when an ack message is received (there might be several messages that haven't been acked yet)
      • removing acked message from the sent message store and clearing the timer(s)
      • re-sending when the timers expire
      1. Update the documentation for bool send(MyMessage &msg, bool ack); (and similar functions) to explain that the bool returned is the result of the next-hop ack.
      2. Rename the bool ack parameter to bool end-to-end-ack or something similar to make it clear(er) that there are two types of acks
      3. In the documentation for send() (and similar functions), refer to the example in (1) for information on how to use end-to-end ack.
      4. When the example in (1) is good enough, add some of the required code to the MySensors library so people don't need to copy-paste a lot of code into their sketches. Surround the code with ifdefs to make it optional.

      (2) and (3) should be quite easy to do. Can it be done with a pull request or how are documentation improvements handled?

      I'm willing to do 1 (will post the sketch in the forum for public scrutiny/feedback of course).

      4 can be done when the community think the example is "good enough"

      5 can wait until the example has been thoroughly vetted.

      posted in Development
      mfalkvidd
      mfalkvidd
    • RE: 5v cable

      @dragon according to https://nextion.itead.cc/resources/datasheets/nx4024k032_011/ the screen uses 85mA at full power. According to the same page, the minimum voltage is 4.75V.

      From http://oberoninc.com/images/WebDocs/Partner_Resources/IEEE 802_3af PoE document.pdf I found this:

      Typical Cat5e UTP has a 10ohm/100m conductor resistance

      So 5m of cat5e utp network cable would have 0.5 ohm resistance one-way, so 1 ohm there and back.

      The voltage drop for 85mA through a 1 ohm cable is 1 * 0.085 = 0.085V.

      So if you feed 5V to the cable, 0.085V will be lost in the cable and 4.915V will be available to the screen. This is more than the minimum required for the screen, so the cable will work.

      If the wemos needs to be powered through the cable as well, you'll need to add the power usage for the wemos to the calculations above.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • Troubleshooting communication [solved]

      Almost three years ago, I asked my friend Oskar ( @d00wirre ) how to get started with Arduino. His answer was to check out MySensors and buy stuff to build a gateway and a node to start with. I did, and as many of you already know, I found out that I liked MySensors πŸ™‚

      Back to present day; last week I visited Oskar. He had built a node on a breadboard and it worked great, but when he soldered everything on a protoboard it started acting up so we decided to troubleshoot together.

      This is what the node looked like, neatly tucked into a box.
      0_1515780646558_IMG_6387.jpg

      We checked the node's own logs. It was able to initialize the radio. The ID was incorrectly set to 0. This was probably because the Pro Mini had been used as a serial gateway before. We decided to clear the eeprom and set a static ID.

      Now the node's own logs said it was repeatedly trying to find parent (FPAR), but got no reply. All outgoing messages were acked though (st=OK). We checked the gateway log. The gateway was receiving the FPAR, and dutifully answering them, but none of the answers were acked by the node (got ST=NACK). Strange.

      We switched the nrf24 module on the node. Same result. We added another capacitor. Same result.

      When I first saw the node, I had noticed that the space below the nrf antenna was a bit tight. Could this be causing the problem?
      0_1515781126928_IMG_6389.jpg

      We decided to get some extra clearance by temporarily stacking an extra header:
      0_1515781180679_IMG_6399.jpg

      The node performed flawlessly! Not a single NACK. And this node is designed to monitor moisture of 16 house plants, so it sends 16 messages in quick concession (no delay) every time it reports data.

      BUT: With the extra height, the node would no longer fit into the nice little box. Since Oskar likes to keep things nice and tidy, we checked out @petewill's great video on soldering an external antenna to the nrf24.

      0_1515781462561_IMG_6402.jpg

      But would this be sufficient? The antenna will still pass close to a lot of metal, including the battery.

      We powered up the node and it turned out to work without any problems.

      This is the final result (with one of 16 forks connected):
      0_1515781592734_IMG_6408.jpg

      All in all, we had a great afternoon and learned some new things:

      • Debug logs from both gateway and node are tremendously helpful when troubleshooting. Without them, troubleshooting would probably have taken at least 10x as much time.
      • Clearance around the antenna is very important.
      • The fact that a node can send messages and receive acks for them doesn't necessarily mean it can receive messages.
      • Soldering an external antenna on your nrf24 can do wonders
      posted in Troubleshooting
      mfalkvidd
      mfalkvidd
    • RE: What did you build today (Pictures) ?

      I've continued my quest to get all MySensors defines documented, by creating some pull requests
      https://github.com/mysensors/MySensors/pull/1111
      https://github.com/mysensors/MySensors/pull/1108
      https://github.com/mysensors/MySensors/pull/1106
      https://github.com/mysensors/MySensors/pull/1105

      The only keywords left new are ones that I don't understand good enough to document. These are tracked in
      https://github.com/mysensors/MySensors/issues/1107 and https://github.com/mysensors/MySensors/issues/1090

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Which are trustworthy brands for a simple USB wall charger?

      When I need multiple ports, I use the IKEA chargers. Reasons:

      • They are the cheapest per mA and port that I can buy locally
      • They are a big brand with a reputation to protect
      • bigclivedotcom has done a teardown and deemed it safe
      posted in Hardware
      mfalkvidd
      mfalkvidd
    • RE: Read this first - it could SAVE YOU A LOT OF TIME

      Troubleshoot the debug output

      (courtesy of @martinhjelmare from this thread)

      From the source code in the dev branch: link

      s = sensor id
      c = message type 0-4: presentation, set, req, internal or stream. See link
      t = value type: S_VALUE during presentation or V_VALUE during set/req
      pt = payload type: string, byte int, etc. See link
      l = message length
      sg = signed or unsigned message: 0 or 1 for false or true

      0;0;3;0;9 means node 0 , sensor 0, internal message (3), not an ack message (0), log message (9). This means that it's the gateway that prints this info as a log after already having received the message from a node.

      At the end you have the payload: 27

      Similarly for a sent message: link

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

      Today I built auto-detection of missing MySensors keywords. The build system will complain if someone adds a new keyword to the Doxygen documentation but forgets to add it to keywords.txt.

      This is what the output looks like on the current code base (we're missing a bunch of keywords):
      0_1521641921920_597e3648-8dea-4498-b481-39db99ce0569-image.png

      This is the code change:
      0_1521641576208_5485185b-9a6d-4eee-9079-e2de14d62d21-image.png

      I have also added those missing keywords to keywords.txt, so now they'll be highlighted properly in the Arduino IDE.

      Thanks to Anticimex for assisting me in working with the build system.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Still not going well for me.

      @Coffeesnob we try to add as much information as possible in the documentation, without overwhelming users with more information than they can handle. Too much information will make people cringe and go somewhere else.

      The Mega is big and relatively expensive. Therefore most people use Nano or Pro Mini. I'm hesitant to add a lot of information for non-common use cases because that information will not be relevant for most users and therefore will just be annoying when people try to create their first sensor.

      I have updated the connecting the radio page to include wiring information and the defines for Mega.

      Could you list the top 3-5 things that would have helped you the most, and where you would have expected to find that information? That would be great input.

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

      Today I finally got my thumbs out and upgraded my plant monitoring to MySensors 2.x (from 1.x).
      Updated sketch is available on Github: https://github.com/mfalkvidd/arduino-plantmoisture

      Result: I really need to water my plants πŸ˜‰ But the 2.5 year old batteries are still going strong.
      0_1521737262850_PlantMonitoringDomoticz-2018-03-22.png

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: What did you build today (Pictures) ?

      Today's work:

      1. Fixed https://github.com/mysensors/MySensors/issues/1096 (PR in progress)
      2. Fixed 60+ spelling mistakes in the example sketches https://github.com/mfalkvidd/MySensors/commit/6e7ee6ab30d503a6f288553689fdfbe645c931e6 (will submit PR when above PR is done)
      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: What did you build today (Pictures) ?

      A 3D printed hanger for dupont cables, mounted on the inside of the wardrobe that is my electronics lab.
      IMG_4639.jpg

      Found it on thingiverse, https://www.thingiverse.com/thing:3567126

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Best password manager?

      4479b6e3-0446-4768-9f4f-c02bce96f672-image.png

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Need help understanding a parity check with XOR

      Hi Niklas, welcome to MySensors!

      Just a note: It looks like your example data is missing 4 bits in byte 0. Byte 0 only has 4 bits in your example data, but it should have 8, like this:
      0_1466364738458_table.png

      XOR is actually really simple. Imagine a clicker counter, like this:0_1466363639069_clicker_small.jpg
      Every time you press the lever, the counter will increment by 1. When you reach 9999 it will roll over to 0.

      Now imagine a clicker counter with only one wheel/digit. The wheel will count 0...9 and the roll over to 0.

      Now imagine that the wheel only has two numbers: 0 and 1. It will count 0, 1 and then roll over to 0 again. That's XOR.

      The description of the upmp protocol says that bit 1 of the checksum is XOR of odd bits. Get your XOR clicker ready. Look at the first number in the first row (bit 7 in byte 0). It is a 1, so we press the clicker which goes from 0 to 1. We skip the second number (since 2 is even) and look at the third bit. The third bit is a 0 so we don't press the lever. The clicker stays at 1. We move on to bit 3, 1... until we reach the end of byte 3. Look at the number on the clicker. That's your first C number.

      Reset the XOR clicker to 0. Start over with the first row but now only look at the even positions. Click away until you reach the end of the third byte. Look at the number on the clicker. That's the second C number.

      When you check the integrity of the message, you do as described above. You then compare the two C bits you got from your XOR clicker to the two C bits that was in the message. If they don't match, you know there was an error in the transmission.

      posted in Development
      mfalkvidd
      mfalkvidd
    • RE: πŸ’¬ Building a Raspberry Pi Gateway

      @ricorico94 said in πŸ’¬ Building a Raspberry Pi Gateway:

      Hi,
      This seems a great job, but despite I had a look at many posts (yes, many out of the dozens of pages.. πŸ˜‰ ), I still can't figure out some questions..

      • Beyond the obvious advantage of saving an arduino (and power supply, space..), is there an advantage for having the gateway hosted by the raspberry PI hosting my Domoticz ? (like more CPU available for handling communications or for signing ? or on the opposite more risks to overload the PI CPU -despite only a couple persons have complained about high CPU load))

      Not really. Cpu usage is normally 0-2% so it doesn't affect either way.

      Switching between different gateway types (serial, ethernet, mqtt) can be easier since there is no need to re-wire anything, just reconfigure and recompile. But that could be done with a all-in-one Arduino setup as well.

      Remote debug might be a benefit, since logging in to the raspberry pi to view log files can be done remotely. Remote debug for Arduino is possible, but usually requires additional hardware.

      The raspberry pi has room for more logging, which can help troubleshooting.

      The biggest downside is that a raspberry pi environment is infinitely more complex than an Arduino, which could affect reliability and make troubleshooting harder. On the other hand, there are more debugging tools available which might make troubleshooting easier.

      • the default setup is Ethernet. What are the pros and cons of ethernet vs serial setup ? (speed? reliability ? possibility to move to other gateway?..)

      No difference in speed. No difference in reliability.

      Ethernet can easily be made accessible over the network. Doing that with serial can be done but is a bit tricky.

      Some controllers don't have support for all gateway types. See https://www.mysensors.org/controller for details.

      • Is signing now implemented in this setup ? I didn't see it explicitely described, but some posts seem related to signing.

      Yes. See the help text produced by running ./configure --help

      • if I want to use an external antenna and the high power NRF24, should I use an aother power source than raspberry PI ? (or maybe sharing the same USB charger, but diverting the power in parallel of the PI ?)

      Yes. See the note on https://www.mysensors.org/build/raspberry#wiring

      • is there a tutorial somewhere detailing how to uninstall and migrate to an external gateway ? During such migration, would I need to "touch" again my sensors and would I lose history logs of these sensors in Domoticz ?

      See my answer in the question you posted yesterday.

      Sorry for all these questions..

      No worries. Except for posting one of the questions again (which wastes people's time and confuses people when they read only one of the places), you are very welcome to post as many questions as you like. Asking questions is usually the next best way to learn.

      posted in Announcements
      mfalkvidd
      mfalkvidd
    • RE: Breakout boards - a plea for consistency!

      https://xkcd.com/927/

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • Use link time optimizations to save flash / program storage space (Sketch too big error)

      A friend of mine who is way more savvy in c/c++ programming than me mentioned that enabling link time optimizations (LTO) might save some flash space. I decided to do some research and it turns out that LTO is actually supported by the Arduino IDE toolchain, but it is not enabled by default.

      I did some digging and figured out how to activate it. These are the results:
      GatewaySerial on Atmega328 without LTO:

      Sketch uses 15,170 bytes (49%) of program storage space. Maximum is 30,720 bytes.
      Global variables use 711 bytes (34%) of dynamic memory, leaving 1,337 bytes for local variables. Maximum is 2,048 bytes.
      

      GatewaySerial on Atmega328 with LTO:

      Sketch uses 14,050 bytes (45%) of program storage space. Maximum is 30,720 bytes.
      Global variables use 712 bytes (34%) of dynamic memory, leaving 1,336 bytes for local variables. Maximum is 2,048 bytes.
      

      1,120 bytes flash saved (7.4%)!

      SecureActuator on Atmega328 without LTO:

      Sketch uses 23,572 bytes (76%) of program storage space. Maximum is 30,720 bytes.
      Global variables use 1,258 bytes (61%) of dynamic memory, leaving 790 bytes for local variables. Maximum is 2,048 bytes.
      

      SecureActuator on Atmega328 with LTO:

      Sketch uses 21,242 bytes (69%) of program storage space. Maximum is 30,720 bytes.
      Global variables use 1,241 bytes (60%) of dynamic memory, leaving 807 bytes for local variables. Maximum is 2,048 bytes.
      

      2,330 bytes flash saved (9.9%)!

      Pretty sweet!

      Here is how to enable it. Shut down the Arduino IDE. Put the following lines:

      compiler.c.extra_flags=-flto -fno-fat-lto-objects
      compiler.c.elf.extra_flags=-flto -fuse-linker-plugin
      compiler.S.extra_flags=-flto
      compiler.cpp.extra_flags=-flto
      compiler.ar.cmd=avr-gcc-ar
      

      into a new file at "C:\Program Files (x86)\Arduino\hardware\arduino\avr\platform.local.txt" (or the corresponding place on your OSX/Linux machine)

      This might help people trying to fit code into attiny85 or similar mcus with small flash size, or people who try to fit a lot of libraries and/or functionality (for example MY_DEBUG and MY_SIGNING_SOFT at the same time), getting the dreaded "Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it." error.

      Caveat: There might be some side-effects of the optimizations. I don't kow what they might be or how common they would be, so please try this and report your results.

      posted in Development
      mfalkvidd
      mfalkvidd
    • Merry Christmas and Happy New 2023

      Keeping up with the (slightly broken) tradition from earlier years (2016, 2017 and 2018) :

      Metric 2016 2017 2018 2023
      supported controllers 18 26 26 26
      registered forum users 2200 4700 6800 10800
      unique visitors/month on mysensors.org 45000 74000 72000
      code commits 1215 1711 1858 2109
      forks on github 368 544 675 891
      stars on github 726 1246
      open source hardware projects added on openhardware.io 129 272 521

      fc29d10d-7a08-4ae5-8351-bd23737b3d11-image.png

      6ca1c453-30aa-490d-984e-676e630923e5-image.png

      13869d95-ddd3-47c9-b49a-726428e8d995-image.png

      And as a bonus, a statistic on the number of spam users: Between 2021-11-12 and 2023-01-03 (so roughly the last year), we added a total of 946 users to the forum. In the same time, I banned 207 users for spam.

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

      0_1508591929860_ffmpeg_video_editing.png
      Today I learned how to cut and merge video clips on the command line using ffmpeg (and strip the audio which only contains my breathing), producing this video:
      Building an ESP8266/NodeMCU connector for NRF24L01+ (MySensors) – 04:01
      β€” Mikael Falkvidd

      I also learned that maybe I shouldn't recond at 50fps using the highest quality codec, because uploading videos take a lot of time.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • MySensors on Apple AirTags?

      https://twitter.com/ghidraninja/status/1391148503196438529?s=21

      Apparently, they are based on nrf52, and can be flashed.

      So we could run MySensors on them πŸ™‚ otoh, there are cheaper ways to get nrf52 devices.

      posted in Hardware
      mfalkvidd
      mfalkvidd
    • RE: DHT + Relay Sketch

      @mehrdad.silatani said:

      Also if you don't mind I would like to ask for your help to understand some of the functions used in my code. These are the functions I am not fully understanding;

      Great questions! I'll answer them here now and see if I can get the documentation page updated later.

      • "send(msgHum.set(humidity, 1))"
        What is the action of that number "1" after the payload (i.e. humidity)? can it be any number ?

      That number is the number of decimals to include in the message. So if the humidity is 57.5484, using 1 will send 57.5. Using 2 will send 57.55 (correctly rounded).

      • "send(msgRlay.set(state?RELAY_ON:RELAY_OFF),2)"
        I fully understand up to the part of "send(msgRlay.set" but what happens in "state?RELAY_ON:RELAY_OFF" and also again what is that number "2" at the end doing ?( I randomly typed 2) .... I suspect, in "state?RELAY_ON:RELAY_OFF" it asks the Arduino that which state is true and use that, is that correct?
      state?RELAY_ON:RELAY_OFF
      

      This is called a conditional operator. If state is true, the first value (RELAY_ON) will be used. If state is false, the second value (RELAY_OFF) will be used. This is shorthand for

      if(state)
          return RELAY_ON;
      else
          return RELAY_OFF;
      

      More information: http://www.tutorialspoint.com/cplusplus/cpp_conditional_operator.htm
      The number 2 is, just like before, the number of decimals. For a relay you can omit the number, just use

      send(msgRlay.set(state?RELAY_ON:RELAY_OFF))
      
      • "send(msgRlay.set(state?RELAY_ON:RELAY_OFF), true)"
        What is the "true" at the end of the line doing?

      From https://www.mysensors.org/download/sensor_api_20#sending-data :
      ack - Set this to true if you want destination node to send ack back to this node. Default is not to request any ack.

      The ack stuff has confused me immensely. MySensors has two types of ack. They are both called ack but they work very differently. https://forum.mysensors.org/topic/3346/discussion-reliable-delivery/ documents my road from confusion to clarity.

      • "wait(2000, C_SET, V_STATUS)"
        This is where I came across the "C_SET"

      https://www.mysensors.org/download/sensor_api_20#waiting describes the second parameter as
      cmd - The command type to wait for
      The commands are defined at https://github.com/mysensors/MySensors/blob/e1ccba22d8fe5b6604bc6428ca950e4336654784/core/MyMessage.h#L45 So waiting for C_SET means that you want for an incoming command (message) that wants to set a variable. In this case, set the value of the relay.

      • "state = (bool)message.getInt()"
        I can guess that this line is trying to extract the information of the relay state from the received msg, but I really don't know what is the breakdown of the logic in it (e.g. does adding (bool) at the front of the message.getInt() means only accept boolean type data ? .... )

      Not quite. It converts to integer to a bool. So if the integer is 0, the result will be false. If the integer is not zero, the result will be true. More details: http://stackoverflow.com/questions/31551888/casting-int-to-bool-in-c-c

      • "debouncer.update()"
        I really dont quite get what happens in this line ...

      This updates the value from a switch, avoiding contact bounces. More information: https://github.com/thomasfredericks/Bounce2/wiki

      Sorry for asking too many questions πŸ™‚ .. I am really loving to work with "mysensors" and I am trying to make sure I understand what happens in my codes πŸ™‚

      No worries, we're all here to learn πŸ™‚

      posted in Troubleshooting
      mfalkvidd
      mfalkvidd
    • RE: Using an 802.11g wifi transport

      @eveningstariot If you have wifi, the MySensors library adds almost nothing to your project. Connect your wifi devices directly to your controller, using mqtt or whatever protocols your controller supports.

      MySensors is designed to handle radio communication and routing. wifi/IP already has radio communication and routing built-in.

      posted in MyController.org
      mfalkvidd
      mfalkvidd
    • RE: What did you build today (Pictures) ?

      0_1508666084367_IMG_2021.JPG

      Today's build is a new raspberry pi gateway to assist troubleshooting in this thread. I use the connectors that I created earlier. Great to be able to switch radio module in the connector.

      The binder clips to the left are great for keeping network and power cables in place.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: I can't get it to work (Nano V3.0, NRF24L01+Z)

      @Maurice-Krijtenberg the wiring looks good (cant see the blue cable on the nrf but the rest look ok so the blue is probably ok as well.

      However, it looks like the header pins have not been soldered to the Nano. If that's the case, there is probably not a good connection. Try soldering the pins that are used to create a reliable connection.

      posted in Troubleshooting
      mfalkvidd
      mfalkvidd
    • RE: Office plant monitoring

      So my Bonsai tree humidity node just celebrated 1 year on battery! πŸŽ‰ πŸ’
      During the last year, the gateway has received 76,164 updates on humidity level (and an additional 13,996 updates on voltage level).

      The battery level has gone from 3.187V to 3.108V, which means an average drop of 0.0066V per month. Assuming I let it go down to 2.34V (limit for 8MHz according to the datasheet) and that the voltage drop is linear, I should get (3.187-2.34)/0.0066 = 128 months = ~10.7 years. There are several error sources in this calculation, but it looks like battery life will be quite good.

      Here are the voltage and humidity graphs for the last year
      0_1478891116569_chart.png
      0_1478891124165_humidity_bonsai.png

      posted in My Project
      mfalkvidd
      mfalkvidd
    • RE: What did you build today (Pictures) ?

      @NeverDie from what I've understood, the idea is that you pick the lowest revision that can support the features you want. So you can select 8, 10, 12, 14, 16, 20 or 22 pins.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Dimmable LED kitchen light (Arduino, APDS-9960, RGBWW led)

      Dimmable LED kitchen light using Arduino and APDS-9960 – 00:56
      β€” Mikael Falkvidd

      posted in OpenHardware.io
      mfalkvidd
      mfalkvidd
    • RE: I'm the Definition of a Newbie...

      @joedirt16 welcome to the MySensors community!

      Most of the members (including me!) started out as newbies, so you're in good company πŸ™‚

      At the top of this page is a link called "Getting started". Follow that guide. It is designed to explain how MySensors work, how to select a controller and how to build your first node.

      The most important thing: Don't try to do too much at once. Start simple, learn, and then build on that towards more advanced stuff.

      And if you get stuck, do a quick search in the forum. Threads here cover a lot of different cases. If you can't find anything, just post a reply here or create a new thread. We're happy to help.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Dimmable light for makeup mirror (battery powered)

      This is a simple, low-cost and quick project that can get a high spouse acceptance factor.

      Mirror

      • Remove the led strip from the aluminum profiles.
      • Cut the aluminum profiles and the covers to appropriate length. I used a hacksaw to cut profile+cover at the same time to ensure the got the same length.
      • Cut the led strips at one of the cut points using a side cutter.
      • Remove the old wires (they are too short to reach the box) and solder new wires.
      • Put the led strip back inside the aluminum profile. Note that there is a small grove at the back for the strip, this ensures that the strip is close to the profile to maximize cooling.
      • Glue the profiles to the mirror. I used slow-curing epoxy.

      Electronics box

      • Drill holes in the project box for the switch (6mm) and the potentiometer (6mm should be enough but was too tight so I used 8mm).
      • Drill a 4mm hole for the wires to the led strips.
      • Upload the sketch to the Arduino
      • Connect the Arduino and the battery packs and put them inside the project box.
      • Fasten the project box using double-sided tape.

      Big thanks to my wife for letting me use the action photo.
      Makeup mirror light
      0_1469907836978_DSC05706.jpg
      0_1469907849136_DSC05707.jpg
      0_1469907892736_DSC05691.jpg
      0_1469907883618_DSC05694.jpg
      0_1469907857393_DSC05698.jpg

      posted in OpenHardware.io
      mfalkvidd
      mfalkvidd
    • RE: What did you build today (Pictures) ?

      Today I have spent a few hours trying to eradicate the confusion between MySensors' different message acknowledgements. See https://github.com/mysensors/MySensors/issues/1103 and https://forum.mysensors.org/post/34263 for details.

       core/MyGatewayTransport.cpp                |  11 ++++++-----
       core/MyMessage.cpp                         |   8 +++++++-
       core/MyMessage.h                           |  31 ++++++++++++++++++------------
       core/MyOTALogging.cpp                      |   2 +-
       core/MyProtocol.cpp                        |  16 ++++++++--------
       core/MySensorsCore.cpp                     |  41 ++++++++++++++++++++-------------------
       core/MySensorsCore.h                       | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------
       core/MySigning.cpp                         |   4 ++--
       core/MySigning.h                           |   2 +-
       core/MyTransport.cpp                       |  20 +++++++++----------
       core/MyTransport.h                         |   4 ++--
       examples/SecureActuator/SecureActuator.ino |   2 +-
       12 files changed, 147 insertions(+), 108 deletions(-)
      

      I have also updated https://www.mysensors.org/download/sensor_api_20 to use echo instead of ack when describing the echo function. That page didn't have information on the return value for send, present, reqestTime, etc so I added info on the return value as well.

      Reference: https://github.com/mysensors/MySensors/pull/1292

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: πŸ’¬ Buck Energy Harvester

      Out of the 400, almost 10% are by neverdie πŸ˜„

      posted in OpenHardware.io
      mfalkvidd
      mfalkvidd
    • RE: What did you build today (Pictures) ?

      When doing the change above, i noticed that after I created https://github.com/mysensors/MySensors/issues/1107 the number of undocumented MySensors keywords has more than doubled!

      The plan was to let the MySensors butler check for missing keywords as soon as the few remaining keywords were documented. If I add the check on the existing code, the butler wouldn't allow any commits which would hinder development. But since no-one has documented the missing keywords in over a year, I decided to blacklist the missing keywords and add the check anyway. The new check will give developers a list of new missing keywords, if they add any, so they can be documented.

      Reference: https://github.com/mysensors/MySensors/pull/1293

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Started with MySensors and about to give up (some feedback)

      Welcome to the forum @alex28 and thanks for taking time to share your experience. I'll digest it a bit before writing any further, to make sure I subdue my emotional response so we can keep this constructive.

      To anyone else reading this feedback; please remember to not shoot the messenger. This is a great chance to make the MySensors project even better.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: to debug or not to debug

      If you do a lot of screen drawing, play sound or anything that requires precise timing, running with debug might have an effect. But if it did, you would have noticed it when you tested the node. So performance-wise you can probably leave it on.

      However, if your node is battery-powered, having the serial chip active might hurt battery life. Therefore I disable debug before deploying nodes.

      If you add your own debug statements in your sketch, this makes it easy to turn them off (I got the idea from here😞

      #ifdef DEBUG
        #define debuglogln(args...) Serial.println(args)
      #else
        #define debuglogln(args...)
      #endif
      
      void setup()
      {
      #ifdef DEBUG
        Serial.begin(BAUD_RATE);
      #endif
      
      debuglogln("hello");
      ...
      

      If you turn DEBUG off, debuglogln will do nothing. If DEBUG is on, all debuglogln statements will work as Serial.println. You can do the same for Serial.print (without ln) if you use that.

      posted in Development
      mfalkvidd
      mfalkvidd
    • RE: Dimmable LED kitchen light (Arduino, APDS-9960, RGBWW led)

      With the cost of the sensor down to $7.40 (from $15 when I first bought one) and even lower when buying multiple sensors I think it is better to just replace the sensor when it becomes too dirty.

      posted in OpenHardware.io
      mfalkvidd
      mfalkvidd
    • RE: gw.sleep on battery powered magnet door switch

      Pull request done for the development version: https://github.com/mysensors/Arduino/pull/441

      posted in My Project
      mfalkvidd
      mfalkvidd
    • RE: Your workshop :)

      What a great thread! Thanks for kicking it back into life, @TRS-80

      I don't have a workshop so I use the dinner table. Have bought a few assortment boxes to make it easy to hide away all the parts when I'm not using them.

      The mask is from a project I wore at scifiworld today. It is not (yet) MySensorized.

      0_1459697373266_IMG_0852.JPG

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Tool for static analysis of memory usage

      @TheoL yes, I think it might come out pretty cool. I have built a 22" 12x12 led matrix screen out of 5m ws2811 led strip, on which I plan to play Tetris.

      22" 12x12 RGB led matrix screen for Arduino based on 5m ws2811 led strip – 00:29
      β€” Mikael Falkvidd

      posted in Development
      mfalkvidd
      mfalkvidd
    • RE: Ethernet vs Serial gateway performance.

      @Yveaux Indeed. I've got requests from one partner in New York and one in California as well, will configure gw's for them and ship next week. Next up is Bangalore, India. It is a really fun project πŸ™‚
      Status for the plants can be seen live here if anyone is curious. Just click the big "PRESS HERE TO ACCESS THE DEMO SYSTEM" button and you'll be logged in.

      Screen dump:
      0_1457125970743_demo.png

      posted in Domoticz
      mfalkvidd
      mfalkvidd
    • Esp8266 wifi gateway with RSSI for RFM69 and Wifi

      As part of helping troubleshooting in this thread, I built a RFM69 gateway and a node.

      I decided to place the RFM69 node in a basement storage room. The room has been flooded a few times historically, so being able to monitor humidity in the room seems like a good idea.

      The room has thick brick walls, which the RFM69-433MHz radio is much more capable to handle than the nrf24. Still, I wanted to keep an eye on the signal strength. Because of this, I added code to the gateway to report RSSI from the node.

      I also added support for reporting the gateway's own perceived signal strength from my 2.4GHz wifi router.

      The result looks like this:
      0_1500919585335_Storage RSSI.png

      0_1500919591811_WifiRSSI.png

      Code is available on my Github,
      https://github.com/mfalkvidd/Arduino-MySensors-ESP8266-RFM69-Gateway
      https://github.com/mfalkvidd/Arduino-MySensors-RFM69StorageRoom

      posted in My Project
      mfalkvidd
      mfalkvidd
    • RE: Does mysensors needs wireless? Can I use ethernet?

      Hi @grzmrc
      Welcome to MySensors!

      Wireless is not required. Some users use RS485 for example.

      MySensors has something called a Gateway. The traditional use of a Gateway is to bridge the low-power world (with rfm/nrf radios and rs485 connections) to the more "computer-friendly" world of TCP/IP or USB/serial port.

      The 1.5.x stable version of MySensors does not support connecting local sensors to a Gateway. But in the development version, a Gateway can have local sensors. So a possible solution is to equip all your Arduinos with ethernet shields and make them Gateways. Domoticz support multiple gateways.

      Some threads to get you started:
      http://forum.mysensors.org/topic/2574/how-to-use-the-development-branch-for-sensor-and-gateway
      http://forum.mysensors.org/topic/2794/connect-sensors-directly-to-the-gateway-again/
      http://forum.mysensors.org/topic/3451/serial-gateway-with-several-sensors-connected-to-it
      http://forum.mysensors.org/topic/1338/gateway-and-sensor-node-on-same-arduino-is-it-possible/
      http://forum.mysensors.org/topic/624/combine-gateway-and-sensor/
      http://forum.mysensors.org/topic/2122/sensors-without-a-gateway/
      http://forum.mysensors.org/topic/1387/sensors-on-gateway/
      http://forum.mysensors.org/topic/3375/repeater-node-via-ethernet/
      http://forum.mysensors.org/topic/2893/solved-gateway-as-a-sensor-node-in-v1-6/
      http://forum.mysensors.org/topic/3332/replacing-radio-with-esp8266-on-nodes-and-gateway/

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: How do I get multiple different mock barometers?

      @NeverDie https://www.mysensors.org/build/pressure has an example on how to use two child IDs to report two values. Just use the same type for both, but different child ids.

      Multiple child ids is one of the basics of MySensors. I've actually never considered that people might not know how to use them πŸ™‚

      posted in Development
      mfalkvidd
      mfalkvidd
    • Domoticz version 4.9700 released (stable)

      Full details at https://www.domoticz.com/forum/viewtopic.php?t=23948

      MySensors-specific news:

      • support for smartSleep
      • support for inclusion
      posted in Domoticz
      mfalkvidd
      mfalkvidd
    • RE: MySensors-powered arcade game screen with wireless gamepad controller

      Update: I have updated the game code to include both Tetris and Snake. Press the the two extra buttons (the ones that would be called A+B on a classic 8-bit Nintendo controller) at the same time to switch between the games.

      posted in My Project
      mfalkvidd
      mfalkvidd
    • Humble book bundle for electronics

      The humble book bundle for electronics is a pay-whay-you-want ebook bundle with several nice books for anyone interested in electronics. Hopefully this is a good fit for some of the MySensors users.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Start sketch without gateway registration

      @heyjay82 I think you are looking for MY_TRANSPORT_WAIT_READY_MS
      The forum has some good threads on this, for example
      https://forum.mysensors.org/topic/5745/my_transport_dont_care_mode/
      https://forum.mysensors.org/topic/6413/node-to-node-communication-fails-if-gateway-is-not-reachable/
      https://forum.mysensors.org/topic/6557/switch-is-not-working-when-gateway-is-unavailable/

      posted in Development
      mfalkvidd
      mfalkvidd
    • RE: nRF5 action!

      @NeverDie not sure if you've already noticed, but 4294967295 is the maximum value for an unsigned 32-bit integer. So the value is 0xFFFFFFFF. That often means uninitialized. I don't know why it would be uninitialized though.

      posted in My Project
      mfalkvidd
      mfalkvidd
    • RE: how to search within a thread

      Go to your profile. Select Settings -> Browsing Settings and check Enable In-Topic Searching
      From the settings page:
      If enabled, in-topic searching will override the browser's default page search behaviour and allow you to search through the entire topic, instead of what is only shown on screen

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Battery: pro mini @ 1mhz vs booster

      @zboblamont my experience is that people quickly learn to ignore the pinned posts. We've had a pinned post in the Troubleshooting section for years, and most people don't read it before posting in that category. This might just be me being grumpy though.

      posted in Development
      mfalkvidd
      mfalkvidd
    • RE: Poolside Music Player

      0_1514843628282_IMG_2234.PNG

      posted in My Project
      mfalkvidd
      mfalkvidd
    • RE: The basics of MySensors? (continued)

      @marex after sleeping I think I understand your question. Start by writing nothing in the setup, presentation and loop. Just use the examples as they are, following the instructions on the links I have already posted. That will get you a working gateway and working temperature nodes.

      You can then add your own code for handling communication with your phone, or just use one of the available controllers which will handle that communication as well.

      With MySensors it really is that simple.

      Note: I am moving this discussion to a separate thread, since it really has nothing to do with the MySensors 2.0 release.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Waking up on timer AND interrupt

      Great clear example @BearWithBeard

      I took the liberty to add that example to the documentation.

      posted in Development
      mfalkvidd
      mfalkvidd
    • RE: RooDe - A "reliable" PeopleCounter

      @alowhum then it will cut them down with a frickin laser beam

      posted in My Project
      mfalkvidd
      mfalkvidd
    • RE: STM32?

      @alowhum a bit off topic, but I've bought a few micro usb connectors to be able to use the ubiquitous phone chargers to power Pro Minis.

      To try out the new functionality, order a few STM32. Then use the master MySensors branch from github. https://github.com/mysensors/MySensors/pull/795 will probably have been merged by the time your boards arrive πŸ™‚ If they haven't you can use tekka's branch.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Clean looking sensor node

      @NeverDie the lines will be more or less visible depending on layer height (which varies by 3d printer model) but can easily be made totally smooth. See this video

      Cold Acetone Vapor Finishing for 3D Printing – 03:02
      β€” doodaddoes

      posted in Enclosures / 3D Printing
      mfalkvidd
      mfalkvidd
    • RE: Something's cooking in the MySensors labs...

      Nice work @tekka
      I'm especially impressed that you have managed to add this support while keeping sketch size for nodes that don't use this feature as small (or even smaller) than before.

      This is the result from compiling the gatewaySerial sketch for Arduino Pro Mini on my system:

      development tekka branch relative size
      Standard sketch 13276 13262 99,89%
      Without debug 10504 10488 99,85%
      Without nrf24 8100 8100 100,00%

      A serial gateway with nrf24, rfm69, rfm95 and rs485 compiles with the following result (note that it might be hard to fit all transports to the available pins though):

      Sketch uses 19946 bytes (64%) of program storage space. Maximum is 30720 bytes.
      Global variables use 1527 bytes (74%) of dynamic memory, leaving 521 bytes for local variables. Maximum is 2048 bytes.
      
      posted in Announcements
      mfalkvidd
      mfalkvidd
    • RE: C.H.I.P.

      You mean storage, right? C.H.I.P only has 512MB memory.

      The Domoticz database for my system, which has been running for 6 months, is 1.2MB. The system uses a total of 2.8GB so if the database grows linearly with 2.4MB per year, 4GB will be full in (4-2.8)*1024/2.4=512 years. I would be surprised if my descendants haven't upgraded the controller by then...

      posted in Hardware
      mfalkvidd
      mfalkvidd
    • RE: RFM95 LoRa

      @Borodi-Adrian "not working" is not a problem description we can help you much with unfortunately.

      See https://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help/ for the most common problems and how to fix them. Also see the faq on that page for how to turn on the MySensors debug output and the "How to ask for help" section for the information that usually is needed to help troubleshooting.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • Very nice 3d-printed weather clock

      3D Printed RGB Display & Internet Connected Weather Forecast Clock – 09:46
      β€” HelloMakers

      I really like the solution for printing custom shapes, and larger 7-segment displays.

      posted in Enclosures / 3D Printing
      mfalkvidd
      mfalkvidd
    • RE: πŸ’¬ Battery Powered Sensors

      New section added

      posted in Announcements
      mfalkvidd
      mfalkvidd
    • RE: DHT 11 can report decimals?

      According to the data sheet, the accuracy of DHT11 is Β±2℃. So reporting with decimals doesn't make sense. If the sensor is reporting 22 degrees the temperature might be anywhere between 20 and 24.

      The accuracy of the DHT22 (again, from datasheet) is Β±0.2C. So for the DHT22 it makes sense to report one decimal, but be aware that if the sensor reports 22.4 degrees the real temperature can be anywhere between 22.2 and 22.6.

      See also http://forum.mysensors.org/topic/2686/improve-ds18b20-resolution

      posted in Hardware
      mfalkvidd
      mfalkvidd
    • RE: Why I quit using MySensors for actuators

      @parachutesj Thanks for your feedback. It would be great if you could share your experience of the new technology when you have moved on and gotten some experience with it (whatever technology you may choose). Maybe there can be some lessons to learn and solutions to be inspired by.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: RFM69CW Gateway and Nodes are not working with Api newer then 2.0.0

      @Floca I now have working nodes with 2.0.0. Unfortunately (at least for this troubleshooting) they also work with 2.2.0-beta.

      Sensor 2.0.0 and Gateway 2.0.0:

      Starting sensor (RRNNA-, 2.0.0)
      TSM:INIT
      TSM:RADIO:OK
      TSP:ASSIGNID:OK (ID=1)
      TSM:FPAR
      TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSP:MSG:READ 0-0-1 s=255,c=3,t=8,pt=1,l=1,sg=0:0
      TSP:MSG:FPAR RES (ID=0, dist=0)
      TSP:MSG:PAR OK (ID=0, dist=1)
      TSM:FPAR:OK
      TSM:ID
      TSM:CHKID:OK (ID=1)
      TSM:UPL
      TSP:PING:SEND (dest=0)
      TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
      TSP:MSG:READ 0-0-1 s=255,c=3,t=25,pt=1,l=1,sg=0:1
      TSP:MSG:PONG RECV (hops=1)
      TSP:CHKUPL:OK
      TSM:UPL:OK
      TSM:READY
      TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
      !TSP:MSG:SEND 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=fail:2.0.0
      TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=1,st=ok:0
      TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=11,pt=0,l=22,sg=0,ft=0,st=ok:TemperatureAndHumidity
      TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.1
      TSP:MSG:SEND 1-1-0-0 s=0,c=0,t=7,pt=0,l=0,sg=0,ft=0,st=ok:
      TSP:MSG:SEND 1-1-0-0 s=1,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=ok:
      Request registration...
      TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2
      TSP:MSG:READ 0-0-1 s=255,c=3,t=27,pt=1,l=1,sg=0:1
      Node registration=1
      Init complete, id=1, parent=0, distance=1, registration=1
      TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=ok:1.0
      T: 1.00
      TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=ok:35.0
      H: 35.00
      
      0;255;3;0;9;Starting gateway (RRNGE-, 2.0.0)
      0;255;3;0;9;TSM:INIT
      0;255;3;0;9;TSM:RADIO:OK
      0;255;3;0;9;TSM:GW MODE
      0;255;3;0;9;TSM:READY
      scandone
      state: 0 -> 2 (b0)
      state: 2 -> 3 (0)
      state: 3 -> 5 (10)
      add 0
      aid 1
      cnt 
      
      connected with Mr-IoT.com, channel 2
      dhcp client start...
      f r0, scandone
      ip:192.168.1.215,mask:255.255.255.0,gw:192.168.1.1
      .IP: 192.168.1.215
      0;255;3;0;9;No registration required
      0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
      pm open,type:2 0
      0;255;3;0;9;TSP:MSG:READ 1-1-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=1)
      0;255;3;0;9;TSP:CHKUPL:OK
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;!TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
      0;255;3;0;9;TSP:MSG:READ 1-1-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=1)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;!TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
      0;255;3;0;9;TSP:SANCHK:OK
      0;255;3;0;9;TSP:SANCHK:OK
      0;255;3;0;9;TSP:SANCHK:OK
      0;255;3;0;9;TSP:MSG:READ 1-1-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=1)
      0;255;3;0;9;TSP:CHKUPL:OK
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;!TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
      0;255;3;0;9;TSP:MSG:READ 1-1-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=1)
      0;255;3;0;9;TSP:CHKUPL:OK
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=24,pt=1,l=1,sg=0:1
      0;255;3;0;9;TSP:MSG:PINGED (ID=1, hops=1)
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      0;255;3;0;9;!TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=fail:0100
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=11,pt=0,l=22,sg=0:TemperatureAndHumidity
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.1
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=0,c=0,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=0,t=6,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=26,pt=1,l=1,sg=0:2
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:1.0
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:35.0
      0;255;3;0;9;TSP:SANCHK:OK
      0;255;3;0;9;TSP:MSG:READ 1-1-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=1)
      0;255;3;0;9;TSP:CHKUPL:OK
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=24,pt=1,l=1,sg=0:1
      0;255;3;0;9;TSP:MSG:PINGED (ID=1, hops=1)
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      0;255;3;0;9;!TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=fail:0100
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=11,pt=0,l=22,sg=0:TemperatureAndHumidity
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.1
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=0,c=0,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=0,t=6,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=26,pt=1,l=1,sg=0:2
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:1.0
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:35.0
      0;255;3;0;9;TSP:SANCHK:OK
      0;255;3;0;9;TSP:MSG:READ 1-1-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=1)
      0;255;3;0;9;TSP:CHKUPL:OK
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=24,pt=1,l=1,sg=0:1
      0;255;3;0;9;TSP:MSG:PINGED (ID=1, hops=1)
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      0;255;3;0;9;!TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=fail:0100
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
      0;255;3;0;9;TSP:SANCHK:OK
      0;255;3;0;9;TSP:MSG:READ 1-1-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=1)
      0;255;3;0;9;TSP:CHKUPL:OK
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=24,pt=1,l=1,sg=0:1
      0;255;3;0;9;TSP:MSG:PINGED (ID=1, hops=1)
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      0;255;3;0;9;!TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=fail:0100
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=11,pt=0,l=22,sg=0:TemperatureAndHumidity
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.1
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=0,c=0,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=0,t=6,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=26,pt=1,l=1,sg=0:2
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:1.0
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:35.0
      

      Sensor 2.2.0-beta and Gateway 2.0.0:

      0 MCO:BGN:INIT NODE,CP=RRNNA---,VER=2.2.0-beta
      4 TSM:INIT
      4 TSF:WUR:MS=0
      8 TSM:INIT:TSP OK
      10 TSM:INIT:STATID=1
      12 TSF:SID:OK,ID=1
      14 TSM:FPAR
      22 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      446 TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      452 TSF:MSG:FPAR OK,ID=0,D=1
      2031 TSM:FPAR:OK
      2031 TSM:ID
      2033 TSM:ID:OK
      2035 TSM:UPL
      2043 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
      2158 TSF:MSG:READ,0-0-1,s=255,c=3,t=25,pt=1,l=1,sg=0:1
      2164 TSF:MSG:PONG RECV,HP=1
      2166 TSM:UPL:OK
      2168 TSM:READY:ID=1,PAR=0,DIS=1
      2385 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
      2459 TSF:MSG:READ,0-0-1,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      2678 TSF:MSG:SEND,1-1-0-0,s=255,c=0,t=17,pt=0,l=10,sg=0,ft=0,st=OK:2.2.0-beta
      2899 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
      4919 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=11,pt=0,l=22,sg=0,ft=0,st=OK:TemperatureAndHumidity
      5140 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.1
      5359 TSF:MSG:SEND,1-1-0-0,s=0,c=0,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      5578 TSF:MSG:SEND,1-1-0-0,s=1,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=OK:
      5584 MCO:REG:REQ
      5799 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
      5869 TSF:MSG:READ,0-0-1,s=255,c=3,t=27,pt=1,l=1,sg=0:1
      5875 MCO:PIM:NODE REG=1
      5879 MCO:BGN:STP
      5881 MCO:BGN:INIT OK,TSP=1
      6098 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:1.0
      T: 1.00
      6318 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:35.0
      H: 35.00
      6326 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
      6332 TSF:TDI:TSL
      

      Gateway 2.0.0 (did not restart it from previous log):

      0;255;3;0;9;TSP:CHKUPL:OK
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=24,pt=1,l=1,sg=0:1
      0;255;3;0;9;TSP:MSG:PINGED (ID=1, hops=1)
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=0,t=17,pt=0,l=10,sg=0:2.2.0-beta
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=11,pt=0,l=22,sg=0:TemperatureAndHumidity
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.1
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=0,c=0,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=0,t=6,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=26,pt=1,l=1,sg=0:2
      0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:1.0
      0;255;3;0;9;TSP:MSG:READ 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:35.0
      0;255;3;0;9;TSP:SANCHK:OK
      

      Sensor 2.2.0-beta and gateway 2.2.0-beta:

      0 MCO:BGN:INIT NODE,CP=RRNNA---,VER=2.2.0-beta
      4 TSM:INIT
      4 TSF:WUR:MS=0
      8 TSM:INIT:TSP OK
      10 TSM:INIT:STATID=1
      12 TSF:SID:OK,ID=1
      14 TSM:FPAR
      1234 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      1540 TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      1546 TSF:MSG:FPAR OK,ID=0,D=1
      3244 TSM:FPAR:OK
      3244 TSM:ID
      3246 TSM:ID:OK
      3248 TSM:UPL
      3258 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
      3387 TSF:MSG:READ,0-0-1,s=255,c=3,t=25,pt=1,l=1,sg=0:1
      3393 TSF:MSG:PONG RECV,HP=1
      3395 TSM:UPL:OK
      3397 TSM:READY:ID=1,PAR=0,DIS=1
      3612 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
      3694 TSF:MSG:READ,0-0-1,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      3915 TSF:MSG:SEND,1-1-0-0,s=255,c=0,t=17,pt=0,l=10,sg=0,ft=0,st=OK:2.2.0-beta
      4136 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
      6154 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=11,pt=0,l=22,sg=0,ft=0,st=OK:TemperatureAndHumidity
      6377 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.1
      6594 TSF:MSG:SEND,1-1-0-0,s=0,c=0,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      6813 TSF:MSG:SEND,1-1-0-0,s=1,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=OK:
      6821 MCO:REG:REQ
      7034 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
      7118 TSF:MSG:READ,0-0-1,s=255,c=3,t=27,pt=1,l=1,sg=0:1
      7124 MCO:PIM:NODE REG=1
      7129 MCO:BGN:STP
      7131 MCO:BGN:INIT OK,TSP=1
      7348 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:1.0
      T: 1.00
      7569 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:35.0
      H: 35.00
      7577 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
      7583 TSF:TDI:TSL
      7585 MCO:SLP:WUP=-1
      7587 TSF:TRI:TSB
      8820 !TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=NACK:31.0
      T: 31.00
      10070 !TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=1,st=NACK:84.0
      H: 84.00
      10078 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
      10084 TSF:TDI:TSL
      10086 MCO:SLP:WUP=-1
      10088 TSF:TRI:TSB
      10100 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=2,st=OK:42.0
      T: 42.00
      10323 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:81.0
      H: 81.00
      10332 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
      10338 TSF:TDI:TSL
      10340 MCO:SLP:WUP=-1
      10342 TSF:TRI:TSB
      10354 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:31.0
      T: 31.00
      10577 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:45.0
      H: 45.00
      10586 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
      10592 TSF:TDI:TSL
      10594 MCO:SLP:WUP=-1
      10596 TSF:TRI:TSB
      10608 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:2.0
      T: 2.00
      10831 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:38.0
      H: 38.00
      10840 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
      10846 TSF:TDI:TSL
      10848 MCO:SLP:WUP=-1
      10852 TSF:TRI:TSB
      10862 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:28.0
      T: 28.00
      11085 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:18.0
      H: 18.00
      11094 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
      11100 TSF:TDI:TSL
      11102 MCO:SLP:WUP=-1
      11104 TSF:TRI:TSB
      11116 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:43.0
      T: 43.00
      11339 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:72.0
      H: 72.00
      11347 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
      11354 TSF:TDI:TSL
      11358 MCO:SLP:WUP=-1
      11360 TSF:TRI:TSB
      11372 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:8.0
      T: 8.00
      11593 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:30.0
      H: 30.00
      11601 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
      11608 TSF:TDI:TSL
      11610 MCO:SLP:WUP=-1
      11612 TSF:TRI:TSB
      11626 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:3.0
      T: 3.00
      11847 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:17.0
      H: 17.00
      11855 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
      11862 TSF:TDI:TSL
      11864 MCO:SLP:WUP=-1
      11868 TSF:TRI:TSB
      11878 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:40.0
      T: 40.00
      12101 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:38.0
      H: 38.00
      12109 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
      12115 TSF:TDI:TSL
      
      0;255;3;0;9;5695 MCO:BGN:INIT GW,CP=RRNGE---,VER=2.2.0-beta
      0;255;3;0;9;5757 TSF:LRT:OK
      0;255;3;0;9;5786 TSM:INIT
      0;255;3;0;9;5813 TSF:WUR:MS=0
      scandone
      state: 0 -> 2 (b0)
      state: 2 -> 3 (0)
      state: 3 -> 5 (10)
      add 0
      aid 1
      cnt 
      
      connected with Mr-IoT.com, channel 2
      dhcp client start...
      0;255;3;0;9;5993 TSM:INIT:TSP OK
      0;255;3;0;9;6027 TSM:INIT:GW MODE
      0;255;3;0;9;6062 TSM:READY:ID=0,PAR=0,DIS=0
      0;255;3;0;9;6108 MCO:REG:NOT NEEDED
      f r0, scandone
      ip:192.168.1.215,mask:255.255.255.0,gw:192.168.1.1
      .IP: 192.168.1.215
      0;255;3;0;9;6647 MCO:BGN:STP
      0;255;3;0;9;6698 MCO:BGN:INIT OK,TSP=1
      pm open,type:2 0
      0;255;3;0;9;40166 TSF:MSG:READ,1-1-0,s=1,c=1,t=0,pt=7,l=5,sg=0:42.0
      0;255;3;0;9;40388 TSF:MSG:READ,1-1-0,s=0,c=1,t=1,pt=7,l=5,sg=0:81.0
      0;255;3;0;9;99604 TSF:MSG:READ,1-1-0,s=1,c=1,t=0,pt=7,l=5,sg=0:31.0
      0;255;3;0;9;99826 TSF:MSG:READ,1-1-0,s=0,c=1,t=1,pt=7,l=5,sg=0:45.0
      0;255;3;0;9;159042 TSF:MSG:READ,1-1-0,s=1,c=1,t=0,pt=7,l=5,sg=0:2.0
      0;255;3;0;9;159264 TSF:MSG:READ,1-1-0,s=0,c=1,t=1,pt=7,l=5,sg=0:38.0
      0;255;3;0;9;218484 TSF:MSG:READ,1-1-0,s=1,c=1,t=0,pt=7,l=5,sg=0:28.0
      0;255;3;0;9;218706 TSF:MSG:READ,1-1-0,s=0,c=1,t=1,pt=7,l=5,sg=0:18.0
      0;255;3;0;9;277923 TSF:MSG:READ,1-1-0,s=1,c=1,t=0,pt=7,l=5,sg=0:43.0
      0;255;3;0;9;278146 TSF:MSG:READ,1-1-0,s=0,c=1,t=1,pt=7,l=5,sg=0:72.0
      0;255;3;0;9;337356 TSF:MSG:READ,1-1-0,s=1,c=1,t=0,pt=7,l=5,sg=0:8.0
      0;255;3;0;9;337577 TSF:MSG:READ,1-1-0,s=0,c=1,t=1,pt=7,l=5,sg=0:30.0
      0;255;3;0;9;396783 TSF:MSG:READ,1-1-0,s=1,c=1,t=0,pt=7,l=5,sg=0:3.0
      0;255;3;0;9;397005 TSF:MSG:READ,1-1-0,s=0,c=1,t=1,pt=7,l=5,sg=0:17.0
      

      These are the defines I used
      Node:

      #define MY_NODE_ID 1 // To avoid having to involve a controller
      #define MY_RADIO_RFM69
      #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
      

      Gateway:

      #define MY_RADIO_RFM69
      #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
      

      The only difference I see is that my radio modules are for 433MHz, while yours are for 868 (which is default). I don't see why it should matter, but it is a difference.

      I used this git commit

      commit 3e75b52c33b06c70d60eb691bd127e2f585a0c87
      Date:   Fri Jul 7 14:36:14 2017 +0200
      

      On the node I used

      float temperature = random(1,50);
      float humidity = random(1,100);
      

      to avoid involving the DHT

      posted in Bug Reports
      mfalkvidd
      mfalkvidd
    • RE: Nordic or HopeRF radio

      @jbjalling Hoperf have lots of radios, including 2.4GHz variants. But I guess you mean the sub-GHz ones (example rfm69hw) vs the NRF24L01+.

      As with all choices, it is about compromises.

      • The nrf is cheaper and it is more popular than rfm69.
      • Therefore, you will find much more information on this forum (and internet in general) about how to use and troubleshoot nrf.
      • The MySensors code for nrf is also better tested, since more people are using it.
      • Much of the hardware published on the forum is meant for nrf radios, but an adapter is available.
      • I think the Raspberry Pi direct io gateway only works with nrf, and maybe the mysbootloader as well. Edit: rpi gw now has support for rfm
      • There is a nice sniffer for nrf

      In theory, the rfm69 technology seems to have the upper hand:

      • It has support for measuring signal strength, which can be used to automatically adjust sending power to get better range when needed and better battery life when the signal strength is good enough.
      • hardware encryption. Not that encryption will hide what you do and when, but it is a nice feature.
      • The lower frequency generally means better range.

      See also
      https://forum.mysensors.org/topic/1723/which-is-better-rfm69-or-nrf24l01/
      https://forum.mysensors.org/topic/1918/what-radio-to-use-nrf24l01-rfm69-rfm73/
      https://forum.mysensors.org/topic/1664/which-are-the-best-nrf24l01-modules/

      posted in Hardware
      mfalkvidd
      mfalkvidd
    • RE: Can other sensors send data to my mysensors?

      @ahmedadelhosni since MY_RF24_BASE_RADIO_ID is mentioned in that thread we can probably safely assume that it was implemented before that time at least.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: NRF24L01+ problems in 2.1.1 and 2.2.0 Beta

      I have now tracked down the commit that makes the default raspberry pi gateway work: https://github.com/mysensors/MySensors/commit/4c31e22d6ff45c3a4f8aa70f915c5f10fe345f64

      When using the commit before this (26c237adadda9f79b07d862708d8471285a96905 ) the radio init fails.

      So now we at least know why development works and 2.1.1 does not.

      git checkout 26c237adadda9f79b07d862708d8471285a96905
      ...
      ./configure --extra-cxxflags="-DMY_DEBUG -DMY_DEBUG_VERBOSE_RF24" && make && sudo bin/mysgw -d
      ...
      mysgw: Starting gateway...
      mysgw: Protocol version - 2.2.0-beta
      mysgw: MCO:BGN:INIT GW,CP=RNNG----,VER=2.2.0-beta
      mysgw: TSF:LRT:OK
      mysgw: TSM:INIT
      mysgw: TSF:WUR:MS=0
      mysgw: RF24:INIT
      mysgw: RF24:INIT:PIN,CE=9,CS=24
      mysgw: RF24:WBR:REG=0,VAL=14
      mysgw: RF24:WBR:REG=3,VAL=3
      mysgw: RF24:WBR:REG=4,VAL=95
      mysgw: RF24:WBR:REG=5,VAL=76
      mysgw: RF24:WBR:REG=6,VAL=37
      mysgw: RF24:WBR:REG=16,VAL=115
      mysgw: RF24:WBR:REG=29,VAL=6
      mysgw: RF24:RBR:REG=6,VAL=0
      mysgw: RF24:RBR:REG=5,VAL=0
      mysgw: !RF24:INIT:SANCHK FAIL
      mysgw: !TSM:INIT:TSP FAIL
      
      git checkout 4c31e22d6ff45c3a4f8aa70f915c5f10fe345f64 #68
      ...
      ./configure --extra-cxxflags="-DMY_DEBUG -DMY_DEBUG_VERBOSE_RF24" && make && sudo bin/mysgw -d
      ...
      mysgw: Starting gateway...
      mysgw: Protocol version - 2.2.0-beta
      mysgw: MCO:BGN:INIT GW,CP=RNNG----,VER=2.2.0-beta
      mysgw: TSF:LRT:OK
      mysgw: TSM:INIT
      mysgw: TSF:WUR:MS=0
      mysgw: RF24:INIT
      mysgw: RF24:INIT:PIN,CE=22,CS=24
      mysgw: RF24:WBR:REG=0,VAL=14
      mysgw: RF24:WBR:REG=3,VAL=3
      mysgw: RF24:WBR:REG=4,VAL=95
      mysgw: RF24:WBR:REG=5,VAL=76
      mysgw: RF24:WBR:REG=6,VAL=37
      mysgw: RF24:WBR:REG=16,VAL=115
      mysgw: RF24:WBR:REG=29,VAL=6
      mysgw: RF24:RBR:REG=6,VAL=37
      mysgw: RF24:RBR:REG=5,VAL=76
      mysgw: RF24:WBR:REG=2,VAL=2
      mysgw: RF24:WBR:REG=1,VAL=0
      mysgw: RF24:WBR:REG=28,VAL=3
      mysgw: RF24:FRX
      mysgw: RF24:FTX
      mysgw: RF24:WBR:REG=7,VAL=112
      mysgw: TSM:INIT:TSP OK
      mysgw: TSM:INIT:GW MODE
      mysgw: RF24:WBR:REG=2,VAL=3
      mysgw: RF24:WBR:REG=1,VAL=1
      mysgw: RF24:STL
      mysgw: RF24:WBR:REG=0,VAL=15
      mysgw: RF24:WBR:REG=10,VAL=0
      mysgw: TSM:READY:ID=0,PAR=0,DIS=0
      mysgw: MCO:REG:NOT NEEDED
      mysgw: RF24:RBR:REG=23,VAL=17
      mysgw: Listening for connections on 0.0.0.0:5003
      
      
      
      posted in Bug Reports
      mfalkvidd
      mfalkvidd
    • RE: Benefits of using LoRa?

      @chbla for a home automation network, I don't think LoRa makes much sense.

      • The long send times cause a big burden on the battery (compared to RFM69).
      • The long send times cause devices to react slowly (1-3 seconds transmit time).
      • The long send times and the duty cycle limitations (1% on most bands at 868MHz and 10% on 433MHz, at least in the EU) results in either not being to operate within legal limits or having to wait long (1+ minute at 1%) before sending next message. This also makes signing impractical.

      LoRa does offer longer range and better handling of interference from other radio signals compared to RFM69, so if you have something that doesn't need quick response, doesn't need to send often, and you are OK with using more power, then setting up your own (MySensors-based) LoRa gateway might be a good solution.

      If you want city-wide coverage, using LoRaWAN can make a lot of sense, but then you would not be using MySensors (at least not for the LoRa communication).

      posted in Hardware
      mfalkvidd
      mfalkvidd
    • FOTA "appstore" for esp8266

      This video describes a pretty nice concept: upload esp8266 binaries to their "appstore" and make it easy for other people to deploy and keep them updated.

      I'm thinking that this could be useful for esp8266-based MySensors gateways, but unfortunately not for nodes since they normally don't have wifi.

      It would help people get their first MySensor gateway up and running, and updated whenever a new release is made available. But since a gateway on its own isn't very interesting, maybe this just adds complexity and maintenance?

      #157 Simple OTA Software Distribution for ESP8266 (IOTappStory.com) – 15:30
      β€” Andreas Spiess

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Need help for a project with RFduino and pressure sensor

      Hi @soso. Warm welcome to the MySensors community!

      MySensors is a fantastic project, but it might not be the right project for you. MySensors takes care of communication between sensors, and from sensors to a gateway which in turn connects to a Home Automation Controller. To me, it sounds you don't need any of that. The RFduino can use bluetooth to communicate directly with an iOS device. No need to communicate between sensors, no need for a gateway and no need for a Home Automation Controller.

      You might be better off asking in the rfduino forum.

      With that said, there might be some rfduino users who also use MySensors so hopefully someone is able to give some recommendations. If you want to read more about what can be done with MySensors, take a look at the getting started guide.

      posted in Troubleshooting
      mfalkvidd
      mfalkvidd
    • RE: Which are trustworthy brands for a simple USB wall charger?

      @NeverDie yes, as long as it doesn't send too much voltage on the 5V output (and fries whatever you have connected)

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

      0_1510006550606_IMG_6211.JPG

      Today I finally got to work on the nrf51822 that I bought some months ago. Using the Arduino IDE and my st-link v2 clone I was able to flash a softdevice and load an example sketch.

      It seems to have worked, but I don't know how to communicate with the device yet. Serial? Swd? Some app on my iphone? Will need to do some reading tomorrow. Recommendations are welcome.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Ethernet gateway compile error

      Two build pages (ethernet gateway and battery powered sensors) used the development version of sketches, instead of the master version. I have updated them now.

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

      Today's project:
      0_1510394552232_File 2017-11-11, 10 58 32.jpeg
      Time for the nrf24 to move over and my LoRa concentrator board to take its place on the lab RPi.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: How to check my soldering using a multimeter

      http://makezine.com/2016/03/08/beautiful-woman-soldering-stock-photo-wrong/

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

      0_1513970830836_File-2017-12-22,-20-22-39.jpg
      Reverse-engineering a bluetooth battery monitor from Conrad.

      The battery monitor has an Android and iOS app that displays voltage, but I wanted to read the data from an ESP32 (lower right corner of the pic).

      This hack is probably worth a thread on its own, will add that later.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Relay Actuator with momentary (pulse) action

      @drradkin change

              digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
      

      to

      if (message.getBool() == RELAY_ON) {
      digitalWrite(message.sensor-1+RELAY_1, RELAY_ON);
      wait(500);
      digitalWrite(message.sensor-1+RELAY_1, RELAY_OFF);
      }
      

      and

      digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
      

      to

      if (loadState(sensor) == RELAY_ON) {
      digitalWrite(pin, RELAY_ON);
      wait(500);
      digitalWrite(pin, RELAY_OFF);
      }
      
      posted in Troubleshooting
      mfalkvidd
      mfalkvidd
    • RE: What did you build today (Pictures) ?

      Holding the leg with a big pair of pliers is, in my experience, a good way to keep the temperature down. Something like this can absorb a lot of heat:

      alt text

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Let me understand signing/whitelisting

      @Sergio-Rius see MY_RF24_CHANNEL at https://www.mysensors.org/download/sensor_api_20#configuration if you are using the nrf24 radios.

      The nrf24 has 126 channels available, so you can have 126 networks in your house.

      You can also extend range in a single network by enabling the repeater function, see https://www.mysensors.org/download/sensor_api_20#create-repeating-nodes

      And see https://www.mysensors.org/about/network for a description of how the sensor network works.

      Technically, there is a way to let multiple networks use the same rf channel (by using MY_RF24_BASE_RADIO_ID), but there is no reason to use it before you have exhausted the 126 available channels and if you need that many networks MySensors might not be the best solution.

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

      @bjacobse or get redundant beer coolers πŸ™‚ Important to always have cool beer.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: PIR sensor and false positives

      @Mister_ik I had lots of false triggers on an esp8266 node. Almost every time the esp sent data, the pir was triggered. Since the nrf uses the same frequencies, you might be experiencing the same problem.

      I glued aluminium foil to a piece of regular printer paper to create a shield around the pir module. I connected the foil to gnd.

      That eliminated all false triggers.

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

      This evening I spent a few hours finding more MySensors keywords that exist but weren't highlighted.
      I found about 20 that were documented but not highlighted, so I added them.

      I also found 3 that weren't documented nor highlighted. I have created issues on github to document them. Help is welcome. Documenting the keywords is an easy way to contribute to the project.
      https://github.com/mysensors/MySensors/issues/1090
      https://github.com/mysensors/MySensors/issues/1089
      https://github.com/mysensors/MySensors/issues/1088

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: What did you build today (Pictures) ?

      I've also submitted documentation updates for clarifying MY_RX_MESSAGE_BUFFER_FEATURE limitiation on esp8266 and renaming RadioSetting to TransportSetting for https://www.mysensors.org/apidocs/group__RadioSettingGrpPub.html

      References:
      https://github.com/mysensors/MySensors/pull/1296
      https://github.com/mysensors/MySensors/pull/1295

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Which vector network analyzer should we buy?

      @skywatch said in Which vector network analyzer should we buy?:

      Your best bet might be to actually take the radio amatuer exam course at a local college. You don't need to do the exam at the end if you don't want to, but you will learn a lot about antenna theory and practical implemation. The lecturer will surely help you out and they might have equipment you can use for free.

      I did exactly this (and passed the exam). Unfortunately, I did not learn as much (of the things I hoped to learn) as I expected.

      Most HAMs focus on (what I would call) low frequencies. The equipment, priorities and trade-offs are completely different. For HAMs, "High frequency" is 3-30MHz. When 1/4 wavelength is measured in multiple meters (10's of feet for those suffering from imperial rule), your problems are very different from the frequencies we use.

      Also, the course focused a lot on passing the exam (naturally), and passing an exam does not have much to do with learning anything that is useful in practice. Not sure if this is different around the world, but here in Sweden, the exam questions are primarily around safety and regulations. Knowing those things is great, but does not help me when tuning an antenna.

      I guess what you can learn also depends a lot on what areas the lecturers are interested in, and what areas the other people taking the course are interested in.

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: Measuring battery voltage, which way is best?

      @skywatch I have added the "internal" measurement method to https://www.mysensors.org/build/battery#measuring-and-reporting-battery-level and created a new example sketch that uses the internal method, based on the code you provided above. The battery page did not cover the internal method before.

      I'll need to update the reference to the example sketch when the pull request has been vetted and merged. https://github.com/mysensors/MySensors/pull/1470

      posted in General Discussion
      mfalkvidd
      mfalkvidd
    • RE: I am not able to stop the blinds motor once the first command is sent.

      In addition to Suresh-Mali's suggestion, you could add

      #define OPEN 0
      #define CLOSE 1
      #define IDLE 2
      

      and use cover(OPEN) / cover(CLOSE) / cover(IDLE) instead. That would make it easier to understand the intention of the code and easier to spot small mistakes.

      posted in Troubleshooting
      mfalkvidd
      mfalkvidd
    • RE: Reflow Oven Selection

      I've added a warning at the top of the "review". I think we should keep this thread, better to inform people about the marketing methods used by this company than to silence it. Then people can make an informed decision whether they trust this company or not.

      Having this review publicly available for people searching for info on this oven is also good.

      posted in Hardware
      mfalkvidd
      mfalkvidd
    • RE: PCB and 3D print companies

      https://www.3dhubs.com lets you find 3d printer services.

      posted in Enclosures / 3D Printing
      mfalkvidd
      mfalkvidd