Announcement

Collapse
No announcement yet.

ESP8266 - LCD Display temperature and humidity

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ESP8266 - LCD Display temperature and humidity

    Hi,
    I have several ESP8266 around the house that monitor temperature and humidity. I would like to install an LCD display to it that will display these two values. Did any of you implemented such thing and would you willing to share your project?

    Thanks,
    Aldo

  • #2
    I'm looking anywhere on the internet but so far I can not find anything that works, any one has a sketch that work with the LCD? Any help will be greatly appreciated.

    Aldo

    Comment


    • #3
      I haven't used the LCD but here is a 'Hello World' example.

      Code:
      //www.elegoo.com
      //2016.06.13
      
      /*
        LiquidCrystal Library - Hello World
      
       Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
       library works with all LCD displays that are compatible with the
       Hitachi HD44780 driver. There are many of them out there, and you
       can usually tell them by the 16-pin interface.
      
       This sketch prints "Hello World!" to the LCD
       and shows the time.
      
        The circuit:
       * LCD RS pin to digital pin 7
       * LCD Enable pin to digital pin 8
       * LCD D4 pin to digital pin 9
       * LCD D5 pin to digital pin 10
       * LCD D6 pin to digital pin 11
       * LCD D7 pin to digital pin 12
       * LCD R/W pin to ground
       * LCD VSS pin to ground
       * LCD VCC pin to 5V
       * 10K resistor:
       * ends to +5V and ground
       * wiper to LCD VO pin (pin 3)
      
       Library originally added 18 Apr 2008
       by David A. Mellis
       library modified 5 Jul 2009
       by Limor Fried (http://www.ladyada.net)
       example added 9 Jul 2009
       by Tom Igoe
       modified 22 Nov 2010
       by Tom Igoe
      
       This example code is in the public domain.
      
       http://www.arduino.cc/en/Tutorial/LiquidCrystal
       */
      
      // include the library code:
      #include <LiquidCrystal.h>
      
      // initialize the library with the numbers of the interface pins
      LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
      
      void setup() {
        // set up the LCD's number of columns and rows:
        lcd.begin(16, 2);
        // Print a message to the LCD.
        lcd.print("hello, world!");
      }
      
      void loop() {
        // set the cursor to column 0, line 1
        // (note: line 1 is the second row, since counting begins with 0):
        lcd.setCursor(0, 1);
        // print the number of seconds since reset:
        lcd.print(millis() / 1000);
      }

      Comment


      • #4
        I use Greig's (Enigmatheatre) Arduino plug-in with 20 char x 4 line displays attached to NodeMCU boards. The devices in HomeSeer look like this:

        Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	41.9 KB
ID:	1193115

        The first line is time, temp and humidity, the second is our work schedule mode and the DHW temperature, the third is today's total energy consumption plus the current energy consumption and the last is the moon phase plus percent illuminated.

        The device is updated once a minute by an event.

        Click image for larger version

Name:	Capture1.PNG
Views:	1
Size:	58.1 KB
ID:	1193117

        We have a few of these displaying different information.

        They are in some little mounts I found on eBay. I still need to neaten up the wiring between the NodeMCU and the display.

        Click image for larger version

Name:	IMG_1188.jpg
Views:	1
Size:	186.3 KB
ID:	1193116
        Last edited by rprade; November 18th, 2017, 02:12 PM.
        Randy Prade
        Aurora, CO
        Prades.net

        PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

        Comment


        • #5
          Thank you Logbuilder for trying to always help, very much appreciated.

          rprade likewise. I love what you have build, this is similar that what I'm trying to accomplish. Could you please share the Sketch? My LCD has two lines and has the four wires connector not sure if yours is similar. I will be happy to purchase the one similar to yours if you send me a link. Edit: your link already showed the LCD with the pins and etc. I jump the gun here, no need for the link.

          Going thru so many examples on the internet, I can seem to find what I'm looking for or does not work :-(

          Thank you,
          Aldo

          Comment


          • #6
            ESP Easy is quite stable, supports tons of sensors and LCD.
            With ESP Easy you can change device codes with HS3 using json https://forums.homeseer.com/showthre...=esp+easy+json commands and from HomeSeer you can control the LCD and digital outputs using http commands.

            https://www.letscontrolit.com/wiki/index.php/ESPEasy

            vbScript to control LCD:
            PHP Code:
            Sub Main(ByVal parm As Object)
            dim debugs as integer
            dim page 
            as string
            dim sendString 
            as string
            dim ESP 
            as string
            dim x 
            as integer
            debugs 
            1

            if hs.DeviceValue(1115) = 0 then 
            sendString 
            "No%20Motion%20"
            else
            sendString "Motion%20%20%20%20"
            end if
            page hs.GetURL("http://192.168.1.168/control?cmd=lcd,4,1,"sendString "%20","",TRUE ,80)

            end sub 
            Script snippet to control digital output:
            PHP Code:
            page hs.GetURL("http://192.168.1.168/cmd=GPIO,12,1,"",TRUE ,80) 


            ~Bill

            Comment


            • #7
              Originally posted by aldo View Post
              Thank you Logbuilder for trying to always help, very much appreciated.

              rprade likewise. I love what you have build, this is similar that what I'm trying to accomplish. Could you please share the Sketch? My LCD has two lines and has the four wires connector not sure if yours is similar. I will be happy to purchase the one similar to yours if you send me a link. Edit: your link already showed the LCD with the pins and etc. I jump the gun here, no need for the link.

              Going thru so many examples on the internet, I can seem to find what I'm looking for or does not work :-(

              Thank you,
              Aldo
              I am using the standard sketch provided with Enigmatheatre's Arduino plug-in. I am using beta 1.0.0.142. The plug-in provides a sketch that is configured for the IP address, port and method of connection. You simply configure those within HomeSeer, download the sketch from the plug-in and upload it to the board. Then inputs, outputs, OneWire and LCD are configured within the plug-in's configuration page. Devices are created in HomeSeer and can be used in events just like any other HS device.
              Randy Prade
              Aurora, CO
              Prades.net

              PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

              Comment


              • #8
                Thanks, I understand now, I was always using the API and I forgot about this option. Unfortunately the display does not show anything, which pins did you connect to the board, From the LCD to the ESP8266 board I have the following

                GRN to G close to the USB jack
                VCC to 3v close to the USB jack
                SDA to D1
                SCL to D2

                Is this correct?

                Edit: My old manager always said to me RTFM, I guess I never learn the lesson, It looks like I need the find the address to my LCD since is not the standard indicated in the PDF help. I purchased the one that you have referenced in this post, is that the same one as the PDF help or you needed to modify the address for it?

                Thanks,
                Aldo

                Comment


                • #9
                  Originally posted by aldo View Post
                  Thanks, I understand now, I was always using the API and I forgot about this option. Unfortunately the display does not show anything, which pins did you connect to the board, From the LCD to the ESP8266 board I have the following

                  GRN to G close to the USB jack
                  VCC to 3v close to the USB jack
                  SDA to D1
                  SCL to D2

                  Is this correct?

                  Aldo,

                  I think your power might be the problem I think you need 5v.

                  From the manual.

                  Arduino Connections:
                  LCD > Arduino Pin
                  GND - GND
                  VCC - 5V
                  SDA - ANALOG Pin 4
                  SCL - ANALOG pin 5

                  NodeMCU Connections:
                  LCD > Node MCUL Pin
                  GND > GND
                  VCC > VIN (this pin gives you 5v from the usb)
                  SDA > D2
                  SCL > D1

                  Greig.
                  Zwave = Z-Stick, 3xHSM100 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
                  X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
                  Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
                  Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
                  Scripts =
                  Various

                  Comment


                  • #10
                    Thanks, I made some correction why you were responding to my last post.

                    This is what I wrote:

                    Edit: My old manager always said to me RTFM, I guess I never learn the lesson, It looks like I need the find the address to my LCD since is not the standard indicated in the PDF help. I purchased the one that you have referenced in this post, is that the same one as the PDF help or you needed to modify the address for it?

                    P.S> I think my LCD is little bit different, when I use the VCC > VIN (this pin gives you 5v from the usb) the LCD will be blank. Thanks to you I'm getting closer.

                    Aldo

                    Comment


                    • #11
                      A few tips on LCDs.

                      1) This sketch has saved me hours. compile/upload this after the LCD is connected to get the address via serial monitor: https://playground.arduino.cc/Main/I2cScanner

                      I bought 6 LCDs from one seller on ebay and 2 had one address, and 4 had another. Save yourself the trouble and find the address ... sketch also helps debug if the LCD is connected and communicating.

                      2) For sure the LCD needs 5V. No voltage divider required for the I2C bus, but has to be powered at 5V.

                      You say you're running ESP8266, is this a NodeMCU? I've only run various Arduino boards and NodeMCU. I had zero luck getting the LCD to run from VIN. I ended up getting the NodeMCU v3 with breakout board. You can get two units at Amazon for $16. The breakout has "USB In" pins. For whatever reason, I could not get the LCD to run off of the VIN pins, even with the breakout.

                      3) I tried to have the LCD 20 ft from the NodeMCU, using CAT6 shielded cable. It does not work. The I2C bus is made for short distances. Less than one foot seems to be fine. I had to put a NodeCU in the remote location, right behind the LCD. I has to get a microUSB to AC adapter and use the CAT6 to send 5V to the remote location to power the NodeMCU.

                      4) Moving almost exclusively to the NodeMCU I've had to adjust my circuits to adjust to 3.3V vs the Arduino 5V standard. Google is your friend. A simple voltage divider works in most cases. Power the 5V device from the USB In pins of the breakout board, but use a voltage divider on the pins back to the NodeMCU so they are 3.3V.

                      5) Look at the NodeMCU OTA update code Logbuilder posted. I have nodeMCUs all over the property, and I never have to take a laptop to the unit to update or bring back to the bench

                      6) Because I use the OTA code, I have to use the NodeMCU API vs. the standard HS3 sketch. The API sketch is way more flexible, and most things are pretty easy, but the LCD is a PITA! I finally figured it out, and can pass more than on/off tot he NodeMCU via the API sketch. The linked devices is an awesome concept and I link virtual devices to the NiodeMCU outputs for LCD outputs. Then lcd.print() text + the value passed from HS3.

                      If anyone has found workarounds for the NodeMCU and LCD power issues I'd love a better option to the breakout boards. It's not the cost as much as the added size.

                      Hope this helps.

                      Guy

                      Comment


                      • #12
                        Originally posted by cowsr4eating View Post
                        A few tips on LCDs.

                        1) This sketch has saved me hours. compile/upload this after the LCD is connected to get the address via serial monitor: https://playground.arduino.cc/Main/I2cScanner

                        I bought 6 LCDs from one seller on ebay and 2 had one address, and 4 had another. Save yourself the trouble and find the address ... sketch also helps debug if the LCD is connected and communicating.

                        2) For sure the LCD needs 5V. No voltage divider required for the I2C bus, but has to be powered at 5V.

                        You say you're running ESP8266, is this a NodeMCU? I've only run various Arduino boards and NodeMCU. I had zero luck getting the LCD to run from VIN. I ended up getting the NodeMCU v3 with breakout board. You can get two units at Amazon for $16. The breakout has "USB In" pins. For whatever reason, I could not get the LCD to run off of the VIN pins, even with the breakout.

                        3) I tried to have the LCD 20 ft from the NodeMCU, using CAT6 shielded cable. It does not work. The I2C bus is made for short distances. Less than one foot seems to be fine. I had to put a NodeCU in the remote location, right behind the LCD. I has to get a microUSB to AC adapter and use the CAT6 to send 5V to the remote location to power the NodeMCU.

                        4) Moving almost exclusively to the NodeMCU I've had to adjust my circuits to adjust to 3.3V vs the Arduino 5V standard. Google is your friend. A simple voltage divider works in most cases. Power the 5V device from the USB In pins of the breakout board, but use a voltage divider on the pins back to the NodeMCU so they are 3.3V.

                        5) Look at the NodeMCU OTA update code Logbuilder posted. I have nodeMCUs all over the property, and I never have to take a laptop to the unit to update or bring back to the bench

                        6) Because I use the OTA code, I have to use the NodeMCU API vs. the standard HS3 sketch. The API sketch is way more flexible, and most things are pretty easy, but the LCD is a PITA! I finally figured it out, and can pass more than on/off tot he NodeMCU via the API sketch. The linked devices is an awesome concept and I link virtual devices to the NiodeMCU outputs for LCD outputs. Then lcd.print() text + the value passed from HS3.

                        If anyone has found workarounds for the NodeMCU and LCD power issues I'd love a better option to the breakout boards. It's not the cost as much as the added size.

                        Hope this helps.

                        Guy

                        Thank you for your detailed explanation. Perhaps I'm getting old but it seems not to be that simple as it should. I wish they standardize a little on the boards, libraries and etc. You wrote a great summary, please see my answers below yours, hopefully we will help others. The plugin is excellent by the way, the author did a fantastic job.


                        1) This sketch has saved me hours. compile/upload this after the LCD is connected to get the address via serial monitor: https://playground.arduino.cc/Main/I2cScanner
                        >>I have Qunqi IIC/I2C/TWI 1602 Serial Blue Backlight LCD Module for Arduino UNO R3 MEGA2560 - https://www.amazon.com/gp/product/B0...?ie=UTF8&psc=1 so far no luck with this. I ran multiple scanners, they can not find the LCD.

                        I bought 6 LCDs from one seller on ebay and 2 had one address, and 4 had another. Save yourself the trouble and find the address ... sketch also helps debug if the LCD is connected and communicating.
                        >>Could you please send me the link of the ebay site when you have a chance?

                        2) For sure the LCD needs 5V. No voltage divider required for the I2C bus, but has to be powered at 5V.

                        You say you're running ESP8266, is this a NodeMCU? I've only run various Arduino boards and NodeMCU. I had zero luck getting the LCD to run from VIN. I ended up getting the NodeMCU v3 with breakout board. You can get two units at Amazon for $16. The breakout has "USB In" pins. For whatever reason, I could not get the LCD to run off of the VIN pins, even with the breakout.
                        >>I have the NodeMCU iLetgo New Version ESP8266 NodeMCU LUA CP2102 ESP-12E Internet WIFI Development Board Open source Serial Wireless Module Works Great with Arduino It has a great WIFI distance and never lose connection.
                        IDE/Micropythonhttps://www.amazon.com/gp/product/B010O1G1ES/ref=oh_aui_search_detailpage?ie=UTF8&psc=1

                        3) I tried to have the LCD 20 ft from the NodeMCU, using CAT6 shielded cable. It does not work. The I2C bus is made for short distances. Less than one foot seems to be fine. I had to put a NodeCU in the remote location, right behind the LCD. I has to get a microUSB to AC adapter and use the CAT6 to send 5V to the remote location to power the NodeMCU.

                        4) Moving almost exclusively to the NodeMCU I've had to adjust my circuits to adjust to 3.3V vs the Arduino 5V standard. Google is your friend. A simple voltage divider works in most cases. Power the 5V device from the USB In pins of the breakout board, but use a voltage divider on the pins back to the NodeMCU so they are 3.3V.
                        >> Not sure how to do this.
                        5) Look at the NodeMCU OTA update code Logbuilder posted. I have nodeMCUs all over the property, and I never have to take a laptop to the unit to update or bring back to the bench
                        >>I agree, I need to get it running. Hopefully it can be integrated in the plugin

                        6) Because I use the OTA code, I have to use the NodeMCU API vs. the standard HS3 sketch. The API sketch is way more flexible, and most things are pretty easy, but the LCD is a PITA! I finally figured it out, and can pass more than on/off tot he NodeMCU via the API sketch. The linked devices is an awesome concept and I link virtual devices to the NiodeMCU outputs for LCD outputs. Then lcd.print() text + the value passed from HS3.
                        >>I love to use the sketch as well, more flexible. Can you share yours?

                        Thank you,
                        Aldo

                        Comment


                        • #13
                          Aldo,

                          I'll just refer to the topic #'s and respond.

                          1) I purchased my LCDs here:https://www.ebay.com/itm/IIC-I2C-TWI...53.m2749.l2649

                          2) Take a look at this site for good background on the LCDs
                          https://arduino-info.wikispaces.com/LCD-Blue-I2C

                          Very likely your problem is not the LCD, but a power issue. Sounds crazy, but may be worth buying $6-$7 so you have a 5V based system to test/validate modules with.


                          4) Look at this site for voltage divider using 5V devices with 3.3V NodeMCU
                          https://tinker.yeoman.com.au/2016/01...u-arduino-ide/


                          6) Nothing special with the sketch. In this example, I wanted the "Sprinkler %" from my OpenSprinler unit to be displayed in the garage ... how much is it going to water. The values can be 0% - 250%. In hindsight it was easy, but took me a while to get there. I wanted the screen to look like image API1 (attached), so I had to set the device graphical values as shown in API2 (attached). Then with lcd.print I printed the values on the LCD as I wanted. Not as easy as the non-API sketch, but works. Only reason I used the API sketch was to get the OTA support.


                          Hope this helps.

                          Guy
                          Attached Files

                          Comment


                          • #14
                            Thanks, I will post my results soon. Have a great weekend.

                            Aldo

                            Sent from my SM-G935V using Tapatalk

                            Comment


                            • #15
                              Aldo,

                              I noticed I somehow deleted a few key words in my reply:
                              Very likely your problem is not the LCD, but a power issue. Sounds crazy, but may be worth buying a $6-$7 Arduino R3 so you have a 5V based system to test/validate modules with.

                              Basically a cheap Arduino R3 goes a long ways to working out voltage issues with the LCD, sensors, etc. Even relays come in 3.3V, 5V, and 12V varieties.

                              Comment

                              Working...
                              X