Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. LCD Clock and Text sensor node with new V_TEXT

LCD Clock and Text sensor node with new V_TEXT

Scheduled Pinned Locked Moved My Project
39 Posts 11 Posters 30.2k Views 21 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • AWIA AWI

    @TheoL I don't see a reason why not. V_TEXT is a generic variable. It will depend mainly on the controllers abilities.

    TheoLT Online
    TheoLT Online
    TheoL
    Contest Winner
    wrote on last edited by TheoL
    #9

    @AWI Thank you for your reply. I have thought about it a bit on my way home from work. When My guests will be leaving again - the weekend after this weekend - I'll start with a simple scene controller for Domoticz. It'll be an easy play ground for the v_text, just an arduino sketch which you and @GizMoCuz already made and some simple bash and lua scripts. Shouldn't take long.

    When that works I'll start the proof of concept for sending valid RFID codes over MySensors to an RFID reader node. I ordered an RFID reader yesterday which was really cheap, about 5 dollar. So not sure if it'll work great.

    My plan is to use an RFID reader as an replacement for the numeric keypad for turning on/off the alarm. I figured that RFID will be easier to use and remember than a pin code.

    In the beginning I will store my valid RFID codes in an file on the filesystem of Domoticz. But maybe in the future I'll create a Node js application with a decent database for that. It's not very wise to store delegate keys like that not encrypted or decoded in a file on a fs.

    1 Reply Last reply
    0
    • TheoLT Online
      TheoLT Online
      TheoL
      Contest Winner
      wrote on last edited by
      #10

      @AWI I'm trying to register the sensor to domoticz. Here's the report in the serial monitor

      send: 7-7-0-0 s=255,c=0,t=17,pt=0,l=3,sg=0,st=ok:1.5
      send: 7-7-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
      read: 0-0-7 s=255,c=3,t=6,pt=0,l=1,sg=0:M
      sensor started, id=7, parent=0, distance=1
      send: 7-7-0-0 s=255,c=3,t=11,pt=0,l=16,sg=0,st=ok:Domotica Monitor
      send: 7-7-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
      send: 7-7-0-0 s=0,c=0,t=36,pt=0,l=10,sg=0,st=ok:Databridge
      send: 7-7-0-0 s=0,c=1,t=47,pt=0,l=1,sg=0,st=ok:-
      send: 7-7-0-0 s=255,c=3,t=1,pt=0,l=0,sg=0,st=ok:
      

      But I can't see the sensor in Domoticz - it's update to the latest stable release. I'm trying to get this to work with a Nokia 5110 LCD display. This sketch will tell me the date/time and outside and inside weather conditions. Did I miss something? Here's the sketch.

      /**
       * Room condition display. 
       *
       * This sketch is the Prototype Sketch for testing if we can combine a Nokia 5110 LCD display and MySensors.
       * The goal we're trying to achieve is to use the Nokia 5110 as a display for showing sensor values like:
       * - the current date and time (if we've some I2C pins left we'll hook up an I2C RTC)
       * - the current room temperature
       * - the current room hummidity
       * - the barometric pressure
       * - the outside temperature
       * - etc
       **/
      
      #include <SPI.h>
      #include <Adafruit_GFX.h>
      #include <Adafruit_PCD8544.h>
      #include <MySensor.h> // Mysensor network
      #include <Time.h>
      
      #define TEXT_NODE_CHILD_ID 0
      #define NODE_ID 7 // use a static nodeID for this sensor.
      
      // uncomment if you are using the DEVELOPMENT version with V_TEXT & V_INFO defined (better to use development MyMessage.h)
      const byte V_TEXT = 47;                  // values taken from development edition MyMessage.h
      const byte S_INFO = 36;
      
      // Software SPI (slower updates, more flexible pin options):
      // pin 7 - Serial clock out (SCLK)
      // pin 6 - Serial data out (DIN)
      // pin 5 - Data/Command select (D/C)
      // pin 4 - LCD chip select (CS)
      // pin 3 - LCD reset (RST)
      Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
      
      MySensor gw;
      
      // Initialize messages for sensor network
      MyMessage textMsg( 0, V_TEXT );
      
      boolean timeReceived = false ;
      
      void setup() {
        Serial.begin( 115200 );
      
        // initialize 5110 LCD
        display.begin();
        
        // initialize MySensor communication
        gw.begin(incomingMessage, NODE_ID);
        //Send the sensor node sketch version information to the gateway
        gw.sendSketchInfo("Domotica Monitor", "1.0");
        gw.present(TEXT_NODE_CHILD_ID, S_INFO, "Databridge"); 
        gw.send(textMsg.setSensor(TEXT_NODE_CHILD_ID).set("-"));
       
        // Initializations
        gw.requestTime(receiveTime);     
        
        // you can change the contrast around to adapt the display
        // for the best viewing!
        display.setContrast(50);
      
        displayDateAndTime();
      }
      
      void displayDateAndTime() {
        display.clearDisplay();
        // text display tests
        display.setTextSize(1);
        // display.setTextColor( WHITE, BLACK ); // 'inverted' text
        display.setTextColor( BLACK ); // 'inverted' text
        display.setCursor(0,0);
        display.println("Zo 20-09-2015");
        display.setTextColor( BLACK ); // 'inverted' text
        display.setTextSize(2);
        display.setCursor(10,18);
        display.println("10:43");
        display.display();
        delay(2000);
      }
      
      void loop() {
       // do nothing yet
      }
      
      // This is called when a new time value was received
      void receiveTime(unsigned long controllerTime) {
        Serial.print("Time value received: ");
        Serial.println(controllerTime);
        timeReceived = true;
      }
      
      // This is called when a message is received 
      void incomingMessage(const MyMessage &message) {
        if (message.type==V_TEXT) { 
          // Write some debug info
          Serial.print("Message: "); Serial.print(message.sensor); Serial.print(", Message: "); Serial.println(message.getString());
        } 
      }
      
      AWIA 1 Reply Last reply
      0
      • TheoLT TheoL

        @AWI I'm trying to register the sensor to domoticz. Here's the report in the serial monitor

        send: 7-7-0-0 s=255,c=0,t=17,pt=0,l=3,sg=0,st=ok:1.5
        send: 7-7-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
        read: 0-0-7 s=255,c=3,t=6,pt=0,l=1,sg=0:M
        sensor started, id=7, parent=0, distance=1
        send: 7-7-0-0 s=255,c=3,t=11,pt=0,l=16,sg=0,st=ok:Domotica Monitor
        send: 7-7-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
        send: 7-7-0-0 s=0,c=0,t=36,pt=0,l=10,sg=0,st=ok:Databridge
        send: 7-7-0-0 s=0,c=1,t=47,pt=0,l=1,sg=0,st=ok:-
        send: 7-7-0-0 s=255,c=3,t=1,pt=0,l=0,sg=0,st=ok:
        

        But I can't see the sensor in Domoticz - it's update to the latest stable release. I'm trying to get this to work with a Nokia 5110 LCD display. This sketch will tell me the date/time and outside and inside weather conditions. Did I miss something? Here's the sketch.

        /**
         * Room condition display. 
         *
         * This sketch is the Prototype Sketch for testing if we can combine a Nokia 5110 LCD display and MySensors.
         * The goal we're trying to achieve is to use the Nokia 5110 as a display for showing sensor values like:
         * - the current date and time (if we've some I2C pins left we'll hook up an I2C RTC)
         * - the current room temperature
         * - the current room hummidity
         * - the barometric pressure
         * - the outside temperature
         * - etc
         **/
        
        #include <SPI.h>
        #include <Adafruit_GFX.h>
        #include <Adafruit_PCD8544.h>
        #include <MySensor.h> // Mysensor network
        #include <Time.h>
        
        #define TEXT_NODE_CHILD_ID 0
        #define NODE_ID 7 // use a static nodeID for this sensor.
        
        // uncomment if you are using the DEVELOPMENT version with V_TEXT & V_INFO defined (better to use development MyMessage.h)
        const byte V_TEXT = 47;                  // values taken from development edition MyMessage.h
        const byte S_INFO = 36;
        
        // Software SPI (slower updates, more flexible pin options):
        // pin 7 - Serial clock out (SCLK)
        // pin 6 - Serial data out (DIN)
        // pin 5 - Data/Command select (D/C)
        // pin 4 - LCD chip select (CS)
        // pin 3 - LCD reset (RST)
        Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
        
        MySensor gw;
        
        // Initialize messages for sensor network
        MyMessage textMsg( 0, V_TEXT );
        
        boolean timeReceived = false ;
        
        void setup() {
          Serial.begin( 115200 );
        
          // initialize 5110 LCD
          display.begin();
          
          // initialize MySensor communication
          gw.begin(incomingMessage, NODE_ID);
          //Send the sensor node sketch version information to the gateway
          gw.sendSketchInfo("Domotica Monitor", "1.0");
          gw.present(TEXT_NODE_CHILD_ID, S_INFO, "Databridge"); 
          gw.send(textMsg.setSensor(TEXT_NODE_CHILD_ID).set("-"));
         
          // Initializations
          gw.requestTime(receiveTime);     
          
          // you can change the contrast around to adapt the display
          // for the best viewing!
          display.setContrast(50);
        
          displayDateAndTime();
        }
        
        void displayDateAndTime() {
          display.clearDisplay();
          // text display tests
          display.setTextSize(1);
          // display.setTextColor( WHITE, BLACK ); // 'inverted' text
          display.setTextColor( BLACK ); // 'inverted' text
          display.setCursor(0,0);
          display.println("Zo 20-09-2015");
          display.setTextColor( BLACK ); // 'inverted' text
          display.setTextSize(2);
          display.setCursor(10,18);
          display.println("10:43");
          display.display();
          delay(2000);
        }
        
        void loop() {
         // do nothing yet
        }
        
        // This is called when a new time value was received
        void receiveTime(unsigned long controllerTime) {
          Serial.print("Time value received: ");
          Serial.println(controllerTime);
          timeReceived = true;
        }
        
        // This is called when a message is received 
        void incomingMessage(const MyMessage &message) {
          if (message.type==V_TEXT) { 
            // Write some debug info
            Serial.print("Message: "); Serial.print(message.sensor); Serial.print(", Message: "); Serial.println(message.getString());
          } 
        }
        
        AWIA Offline
        AWIA Offline
        AWI
        Hero Member
        wrote on last edited by
        #11

        @TheoL You should use the latest Domoticz beta release. It is a very new (beta) feature. Domoticz can (at the moment) not recognize the S_INFO but will create the sensor when a V_TEXT is sent.

        TheoLT 1 Reply Last reply
        0
        • AWIA AWI

          @TheoL You should use the latest Domoticz beta release. It is a very new (beta) feature. Domoticz can (at the moment) not recognize the S_INFO but will create the sensor when a V_TEXT is sent.

          TheoLT Online
          TheoLT Online
          TheoL
          Contest Winner
          wrote on last edited by
          #12

          @AWI Thanx for your quick reply. I'm able to add the sensor node to Domoticz. When I use the JSON url I get an Update OK from Domotoicz. But I can't see an incomming message. I added gw.process() to the main loop. Do I need to update the MySensors gateway as well?

          AWIA 1 Reply Last reply
          0
          • hekH Offline
            hekH Offline
            hek
            Admin
            wrote on last edited by hek
            #13

            No, the gateway will forward anything you throw at it.

            1 Reply Last reply
            0
            • TheoLT TheoL

              @AWI Thanx for your quick reply. I'm able to add the sensor node to Domoticz. When I use the JSON url I get an Update OK from Domotoicz. But I can't see an incomming message. I added gw.process() to the main loop. Do I need to update the MySensors gateway as well?

              AWIA Offline
              AWIA Offline
              AWI
              Hero Member
              wrote on last edited by
              #14

              @TheoL the sketch polls the controller every x seconds. So it should send the update everytime. What value does the text sensor have in the 'device" listing?

              1 Reply Last reply
              0
              • TheoLT Online
                TheoLT Online
                TheoL
                Contest Winner
                wrote on last edited by
                #15

                @hek Thanks you for claryfying that. @AWI I'll adjust the code tomorrow. The device doesn't have a value in Domoticz. But it's getting a bit to late at the moment. ;)

                1 Reply Last reply
                0
                • TheoLT Online
                  TheoLT Online
                  TheoL
                  Contest Winner
                  wrote on last edited by
                  #16

                  I've gotten it to work. But the version of Domoticz I installed was very unstable. It caused the GUI to stall. At the end I had to burn a new installation on a SD card and had to setup everything from scratch. I have no spare Pi at the moment so I have to postpone this project for a while.

                  It's a pitty 'cause I was really looking forward to this project.

                  1 Reply Last reply
                  0
                  • user1306U Offline
                    user1306U Offline
                    user1306
                    wrote on last edited by
                    #17

                    this is a great project thank you.
                    just a quick question is there a way to be able to turn on and off the backlight with text received from domoticz?
                    for example if i just send "1" then the back light goes on and "0" for off.

                    thanks

                    AWIA 1 Reply Last reply
                    0
                    • user1306U user1306

                      this is a great project thank you.
                      just a quick question is there a way to be able to turn on and off the backlight with text received from domoticz?
                      for example if i just send "1" then the back light goes on and "0" for off.

                      thanks

                      AWIA Offline
                      AWIA Offline
                      AWI
                      Hero Member
                      wrote on last edited by
                      #18

                      @user1306 you can do anything with the text sent but be aware that this would imply you are making your own (non standard MySensors) protocol. V_TEXT is intended only for information.
                      I am the 'misusing' it myself but only where there is no MySensors solution.

                      user1306U 1 Reply Last reply
                      0
                      • AWIA AWI

                        @user1306 you can do anything with the text sent but be aware that this would imply you are making your own (non standard MySensors) protocol. V_TEXT is intended only for information.
                        I am the 'misusing' it myself but only where there is no MySensors solution.

                        user1306U Offline
                        user1306U Offline
                        user1306
                        wrote on last edited by
                        #19

                        @AWI
                        thank you for the info, i'm a bit new to arduino and my sensors, so i'm not really sure how to do that.
                        if possible could you let me know what piece of code i need to be able to do that?

                        thanks

                        AWIA 1 Reply Last reply
                        0
                        • user1306U user1306

                          @AWI
                          thank you for the info, i'm a bit new to arduino and my sensors, so i'm not really sure how to do that.
                          if possible could you let me know what piece of code i need to be able to do that?

                          thanks

                          AWIA Offline
                          AWIA Offline
                          AWI
                          Hero Member
                          wrote on last edited by
                          #20

                          @user1306 This is a part from the routine where I read three values from a V_TEXT value (renamed to V_ORIENTATION) separated by a ";". (I think V_ORIENTATION would be a good addition for MySensors ;-) in addition to V_POSITION but I haven't suggested it officially yet)

                          Also be aware that Domoticz only sends the V_TEXT after it has been requested. So you need to send a request(sensor_id, V_TEXT)first .

                          #define V_ORIENTATION V_TEXT								// Own (not existing in MySensors protocol) type for orientation (payload = Pitch ; Roll ; Yaw in degrees)
                          #define S_ORIENTATION S_INFO								// Yaw = 0 (north)to 360) ; Horizontal = 0 ; 
                          
                          
                          			if (message.type==V_ORIENTATION) {
                          				char payload[12] ;								// temporary buffer
                          				strcpy(payload, message.getString());			// read and copy payload
                          				Yaw = atoi(strtok(payload, ";"));				// get variables from payload (; seperated int)
                          				Pitch = atoi(strtok(NULL, ";"));
                          				Roll = atoi(strtok(NULL, ";"));
                          				attachServos(true) ;							// power up servo's
                          				servoH.write(map(-constrain(Yaw, -90, 90),-90, 90, 0, 180));		// servo middle 90 deg == 0 deg Yaw 
                          				servoV.write(map(Pitch, -90, 90, 0, 180));
                          				}
                          1 Reply Last reply
                          1
                          • AWIA Offline
                            AWIA Offline
                            AWI
                            Hero Member
                            wrote on last edited by
                            #21

                            On special request of @pepov attached a piece of LUA script for Domoticz. This demonstrates how to fill V_TEXT devices from other values so that thes can be displayed on the Text sensor node.

                            This special example demonstrates how to fill V_TEXT with weather data from a virtual device connected to Weather Underground. Please search the Domoticz wiki for more information on this special service.

                            -- script to read the virtual Weatherstation (Weather Underground) service and send it to "V_TEXT" MySensors devices
                            -- Weather Underground values are in 'WUWeer' and 'WUWind'
                            
                            commandArray = {} ;
                            --Weatherstation data:
                            sWeatherTemp, sWeatherHumidity, sWeatherUV, sWeatherPressure, sWeatherUV2 = otherdevices_svalues['WUWeer']:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)") ;
                            sWeatherTemp = tonumber(sWeatherTemp);
                            sWeatherHumidity = tonumber(sWeatherHumidity);
                            sWeatherUV = tonumber(sWeatherUV);
                            sWeatherPressure = tonumber(sWeatherPressure);
                            sWeatherUV2 = tonumber(sWeatherUV2);
                            -- print to log 
                            print("Weather station: Temperature is " .. sWeatherTemp .. " ");
                            print("Weather station: Humidity is " .. sWeatherHumidity .. " ");
                            print("Weather station: UV is " .. sWeatherUV .. " ");
                            print("Weather station: Pressure is " .. sWeatherPressure .. " ");
                            print("Weather station: UV2 is " .. sWeatherUV2 .. " ");
                             
                            ------------------------------------------------------------------------
                             
                            --Windmeter data:
                            sWindDirectionDegrees, sWindDirection, sWindSpeed, sWindGust, sWindTemperature, sWindFeel = otherdevices_svalues['WUWind']:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)") ;
                             
                            sWindDirectionDegrees = tonumber(sWindDirectionDegrees);
                            sWindDirection = (sWindDirection);
                            sWindSpeed = tonumber(sWindSpeed);
                            sWindGust = tonumber(sWindGust);
                            sWindTemperature = tonumber(sWindTemperature);
                            sWindFeel = tonumber(sWindFeel);
                             
                            print("Windmeter: Winddirection (in degrees) is: " .. sWindDirectionDegrees .. " ");
                            print("Windmeter: Winddirection is: " .. sWindDirection .. " ");
                            print("Windmeter: Windspeed is: " .. sWindSpeed .. " ");
                            print("Windmeter: Windgust is: " .. sWindGust .. " ");
                            print("Windmeter: Windtemperature is: " .. sWindTemperature .. " ");
                            print("Windmeter: Windfeel is: " .. sWindFeel .. " ");
                            
                            -- device numbers 725/ 873 and 872 are V_TEXT  
                            commandArray[1] = {['UpdateDevice'] = string.format ("725|0|out %4.1f\01 %2d\07 %4d\02\03  ", sWeatherTemp, sWeatherHumidity, sWeatherPressure)}
                            commandArray[2] = {['UpdateDevice'] = string.format ("873|0|%2.1f:%3d:%4.1f", sWeatherTemp, sWeatherHumidity, sWeatherPressure)}
                            commandArray[3] = {['UpdateDevice'] = string.format ("872|0|%3d:%4.1f:%4.1f:%4.1f:%4.1f", sWindDirectionDegrees, sWindSpeed/10 , sWindGust/10, sWindTemperature, sWindFeel)}
                            
                            
                            return commandArray
                            
                            pepovP 1 Reply Last reply
                            3
                            • AWIA AWI

                              On special request of @pepov attached a piece of LUA script for Domoticz. This demonstrates how to fill V_TEXT devices from other values so that thes can be displayed on the Text sensor node.

                              This special example demonstrates how to fill V_TEXT with weather data from a virtual device connected to Weather Underground. Please search the Domoticz wiki for more information on this special service.

                              -- script to read the virtual Weatherstation (Weather Underground) service and send it to "V_TEXT" MySensors devices
                              -- Weather Underground values are in 'WUWeer' and 'WUWind'
                              
                              commandArray = {} ;
                              --Weatherstation data:
                              sWeatherTemp, sWeatherHumidity, sWeatherUV, sWeatherPressure, sWeatherUV2 = otherdevices_svalues['WUWeer']:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)") ;
                              sWeatherTemp = tonumber(sWeatherTemp);
                              sWeatherHumidity = tonumber(sWeatherHumidity);
                              sWeatherUV = tonumber(sWeatherUV);
                              sWeatherPressure = tonumber(sWeatherPressure);
                              sWeatherUV2 = tonumber(sWeatherUV2);
                              -- print to log 
                              print("Weather station: Temperature is " .. sWeatherTemp .. " ");
                              print("Weather station: Humidity is " .. sWeatherHumidity .. " ");
                              print("Weather station: UV is " .. sWeatherUV .. " ");
                              print("Weather station: Pressure is " .. sWeatherPressure .. " ");
                              print("Weather station: UV2 is " .. sWeatherUV2 .. " ");
                               
                              ------------------------------------------------------------------------
                               
                              --Windmeter data:
                              sWindDirectionDegrees, sWindDirection, sWindSpeed, sWindGust, sWindTemperature, sWindFeel = otherdevices_svalues['WUWind']:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)") ;
                               
                              sWindDirectionDegrees = tonumber(sWindDirectionDegrees);
                              sWindDirection = (sWindDirection);
                              sWindSpeed = tonumber(sWindSpeed);
                              sWindGust = tonumber(sWindGust);
                              sWindTemperature = tonumber(sWindTemperature);
                              sWindFeel = tonumber(sWindFeel);
                               
                              print("Windmeter: Winddirection (in degrees) is: " .. sWindDirectionDegrees .. " ");
                              print("Windmeter: Winddirection is: " .. sWindDirection .. " ");
                              print("Windmeter: Windspeed is: " .. sWindSpeed .. " ");
                              print("Windmeter: Windgust is: " .. sWindGust .. " ");
                              print("Windmeter: Windtemperature is: " .. sWindTemperature .. " ");
                              print("Windmeter: Windfeel is: " .. sWindFeel .. " ");
                              
                              -- device numbers 725/ 873 and 872 are V_TEXT  
                              commandArray[1] = {['UpdateDevice'] = string.format ("725|0|out %4.1f\01 %2d\07 %4d\02\03  ", sWeatherTemp, sWeatherHumidity, sWeatherPressure)}
                              commandArray[2] = {['UpdateDevice'] = string.format ("873|0|%2.1f:%3d:%4.1f", sWeatherTemp, sWeatherHumidity, sWeatherPressure)}
                              commandArray[3] = {['UpdateDevice'] = string.format ("872|0|%3d:%4.1f:%4.1f:%4.1f:%4.1f", sWindDirectionDegrees, sWindSpeed/10 , sWindGust/10, sWindTemperature, sWindFeel)}
                              
                              
                              return commandArray
                              
                              pepovP Offline
                              pepovP Offline
                              pepov
                              wrote on last edited by
                              #22

                              @AWI said:

                              evices from other values so that thes can be displayed on the Text sensor node.

                              This special example demonstrates how to fill V_TEXT with weather data from a virtual device connected to Weather Underground. Please search the Domoticz wiki for more informati

                              Wow Thanks AWI!!!!

                              1 Reply Last reply
                              0
                              • NiklasON Offline
                                NiklasON Offline
                                NiklasO
                                wrote on last edited by
                                #23

                                Does this work with MySensors 2.0? If someone has this running on 2.0, please share the code. :)

                                Q 1 Reply Last reply
                                0
                                • Marc-Olivier ChaubetM Offline
                                  Marc-Olivier ChaubetM Offline
                                  Marc-Olivier Chaubet
                                  wrote on last edited by
                                  #24

                                  Hi,
                                  i try to send message but nothing change on LcdDisplay.

                                  I d'ont undestant what is wrong.

                                  Can you help me pls.

                                  send: 49-49-20-0 s=8,c=2,t=47,pt=0,l=0,sg=0,st=ok:
                                  send: 49-49-20-0 s=9,c=2,t=47,pt=0,l=0,sg=0,st=ok:
                                  read: 0-20-49 s=9,c=1,t=16,pt=0,l=4,sg=0:test
                                  send: 49-49-20-0 s=9,c=1,t=16,pt=0,l=4,sg=0,st=ok:test
                                  send: 49-49-20-0 s=8,c=2,t=47,pt=0,l=0,sg=0,st=ok:
                                  
                                  AWIA 1 Reply Last reply
                                  0
                                  • NiklasON NiklasO

                                    Does this work with MySensors 2.0? If someone has this running on 2.0, please share the code. :)

                                    Q Offline
                                    Q Offline
                                    Qu3Uk
                                    wrote on last edited by
                                    #25

                                    @NiklasO I have something similar running on MYS 2.0 and can paste the code. I'm using a 4x1 display and using V_VAR-1-4 to send each line over.
                                    If that's useful to you I can post it.

                                    NiklasON 1 Reply Last reply
                                    0
                                    • Q Qu3Uk

                                      @NiklasO I have something similar running on MYS 2.0 and can paste the code. I'm using a 4x1 display and using V_VAR-1-4 to send each line over.
                                      If that's useful to you I can post it.

                                      NiklasON Offline
                                      NiklasON Offline
                                      NiklasO
                                      wrote on last edited by NiklasO
                                      #26

                                      @Qu3Uk said:

                                      @NiklasO I have something similar running on MYS 2.0 and can paste the code. I'm using a 4x1 display and using V_VAR-1-4 to send each line over.
                                      If that's useful to you I can post it.

                                      Yes please. I ported to 2.0 late yesterday and it works ok. I have 4 lines, 20 chars.

                                      Q 1 Reply Last reply
                                      0
                                      • Marc-Olivier ChaubetM Marc-Olivier Chaubet

                                        Hi,
                                        i try to send message but nothing change on LcdDisplay.

                                        I d'ont undestant what is wrong.

                                        Can you help me pls.

                                        send: 49-49-20-0 s=8,c=2,t=47,pt=0,l=0,sg=0,st=ok:
                                        send: 49-49-20-0 s=9,c=2,t=47,pt=0,l=0,sg=0,st=ok:
                                        read: 0-20-49 s=9,c=1,t=16,pt=0,l=4,sg=0:test
                                        send: 49-49-20-0 s=9,c=1,t=16,pt=0,l=4,sg=0,st=ok:test
                                        send: 49-49-20-0 s=8,c=2,t=47,pt=0,l=0,sg=0,st=ok:
                                        
                                        AWIA Offline
                                        AWIA Offline
                                        AWI
                                        Hero Member
                                        wrote on last edited by AWI
                                        #27

                                        @Marc-Olivier-Chaubet Can you post a little more information (the sketch)?

                                        The text seems to be arriving at the node. So first check if the information comes in on serial (Serial.print(....)).
                                        And next: is your display working? just print something it in the local sketch.

                                        1 Reply Last reply
                                        0
                                        • NiklasON NiklasO

                                          @Qu3Uk said:

                                          @NiklasO I have something similar running on MYS 2.0 and can paste the code. I'm using a 4x1 display and using V_VAR-1-4 to send each line over.
                                          If that's useful to you I can post it.

                                          Yes please. I ported to 2.0 late yesterday and it works ok. I have 4 lines, 20 chars.

                                          Q Offline
                                          Q Offline
                                          Qu3Uk
                                          wrote on last edited by
                                          #28

                                          @NiklasO

                                          Here is it.

                                          // Enable debug prints to serial monitor
                                          //#define MY_DEBUG
                                          
                                          //#define MY_NODE_ID 200
                                          #define MY_SENSOR_ID 1
                                          
                                          // Enable and select radio type attached
                                          #define MY_RADIO_NRF24
                                          //#define MY_RADIO_RFM69
                                          
                                          // Enable repeater functionality for this node
                                          #define MY_REPEATER_FEATURE
                                          
                                          // LCD includes
                                          #include <Wire.h> 
                                          #include <LiquidCrystal_I2C.h>
                                          
                                          // MYS includes
                                          #include <SPI.h>
                                          #include <MySensors.h>
                                          
                                          #define LCD_ON 1  // GPIO value to write to turn on attached relay
                                          #define LCD_OFF 0 // GPIO value to write to turn off attached relay
                                          
                                          LiquidCrystal_I2C lcd(0x3f, 20, 4); //0x3f is the LCD address.
                                          String LINE_BLANK = "                    ";
                                          
                                          void before() {
                                          }
                                          
                                          void setup() {
                                            // Set off  LCD module
                                            lcd.begin (); 
                                            lcd.backlight();
                                          
                                            lcd.setCursor(0, 0); //
                                            lcd.print("Ready!"); // We expect the controller to remove this from display.
                                          }
                                          
                                          void presentation()
                                          {
                                            // Send the sketch version information to the gateway and Controller
                                            sendSketchInfo("LCD Display", "1.0");
                                          
                                            present(MY_SENSOR_ID, S_INFO);
                                          }
                                          
                                          
                                          void loop()
                                          {
                                            // extra processing if required.
                                          }
                                          
                                          void receive(const MyMessage &message) {
                                            // We only expect one type of message from controller. But we better check anyway.
                                            if (message.type == V_STATUS) {
                                              // Use V_STATUS to turn on/off the LCD display
                                              // if supported by LCD.
                                            }
                                          
                                            // temp string, probably don't need this.
                                            if (message.type == V_VAR1) {
                                              writeScreen(0, message.data);
                                            }
                                          
                                            if (message.type == V_VAR2) {
                                              writeScreen(1, message.data);
                                            }
                                          
                                            if (message.type == V_VAR3) {
                                              writeScreen(2, message.data);
                                            }
                                          
                                            if (message.type == V_VAR4) {
                                              writeScreen(3, message.data);
                                            }
                                          }
                                          
                                          void writeScreen(int line, String text)
                                          {
                                            // Trim whitespace from incoming text.
                                            text.trim();
                                          
                                            // Remove anything over 20 char in text.
                                            if(text.length() > 19)
                                            {
                                                text.remove(20);
                                            }
                                            
                                            // Clear the line
                                            lcd.setCursor(0, line);
                                            lcd.print(LINE_BLANK);
                                          
                                            // Set Line
                                            lcd.setCursor(0, line);
                                            lcd.print(text);
                                          }
                                          
                                          user1306U 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          15

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

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