arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
21.96k stars 4.77k forks source link

OLED Display support #2557

Closed rlust closed 5 years ago

rlust commented 6 years ago

Checking to see if any display support is planned for the future? I see great value in using OLED displays for non SONOFF devices, like WEMOS.

Jason2866 commented 6 years ago

Should be possible with LiquidCrystal I2C but this lib needs space.... https://github.com/marcoschwartz/LiquidCrystal_I2C or for OLED https://github.com/adafruit/Adafruit_SSD1306

arendst commented 6 years ago

I have some display support running for over a year but it is very user unfriendly as it only allows displaying of MQTT messages without user intervention. Displays supported are LCD, Oled, TFT and up to 8 matrices. AT home they run fine.

I might release a branch without support just for you to see what is possible.

arendst commented 6 years ago

See https://github.com/arendst/Sonoff-Tasmota/tree/development_display

This is with NO support.

rlust commented 6 years ago

Got it loaded, not sure how to set options? I will continue reading code. I am using a I2C OLED display. Anyone have any luck here?

Jason2866 commented 6 years ago

Hello @rlust, i am in the same boat. Got it running. Display shows Time and Date after boot. @arendst could you give me/us just one short example, i am not a programmer so reading code isnt easy for me. But when i get a hint i get things sorted ;-) For testing i have connected a DS18B20 (Temperature is shown on Web Console) Thx a lot, if you do not, it is 100% fine!! You said NO support ;-) P.S. And thank you again for your great pice of software!! With this my long wanted plan realizing a powerful and inexpensive smart home solution (without a cloud) was made possible.

arendst commented 6 years ago

Currently all displays have the possibility to show life MQTT messages. This probably only works when the default prefixes are used. The display driver receives all tele messages and decodes the JSON text and should display information like

img_20180430_152549 Settings:

14:39:16 CMD: displaymodel
14:39:16 MQT: stat/wemos9/RESULT = {"DisplayModel":2}
14:39:20 CMD: displaymode
14:39:20 MQT: stat/wemos9/RESULT = {"DisplayMode":5}
14:39:33 CMD: displayrefresh
14:39:33 MQT: stat/wemos9/RESULT = {"DisplayRefresh":2}
14:39:45 CMD: power
14:39:45 MQT: stat/wemos9/RESULT = {"POWER":"ON"}
14:39:45 MQT: stat/wemos9/POWER = ON
14:39:56 CMD: displayrows
14:39:56 MQT: stat/wemos9/RESULT = {"DisplayRows":8}
14:40:01 CMD: displaycols
14:40:01 MQT: stat/wemos9/RESULT = {"DisplayCols1":21}

img_20180430_152615 Settings:

15:41:23 CMD: displaymodel
15:41:23 MQT: stat/ticker/RESULT = {"DisplayModel":3}
15:41:28 CMD: displaymode
15:41:28 MQT: stat/ticker/RESULT = {"DisplayMode":5}
15:41:34 CMD: displayrefresh
15:41:34 MQT: stat/ticker/RESULT = {"DisplayRefresh":1}
15:41:38 CMD: power
15:41:38 MQT: stat/ticker/RESULT = {"POWER":"ON"}
15:41:38 MQT: stat/ticker/POWER = ON
15:41:49 CMD: displayrows
15:41:49 MQT: stat/ticker/RESULT = {"DisplayRows":2}
15:41:54 CMD: displaycols
15:41:54 MQT: stat/ticker/RESULT = {"DisplayCols1":32}

img_20180430_152623 Settings:

15:42:46 CMD: displaymodel
15:42:46 MQT: stat/lcd/RESULT = {"DisplayModel":1}
15:42:50 CMD: displaymode
15:42:50 MQT: stat/lcd/RESULT = {"DisplayMode":4}
15:42:58 CMD: displayrefresh
15:42:58 MQT: stat/lcd/RESULT = {"DisplayRefresh":2}
15:43:01 CMD: power
15:43:01 MQT: stat/lcd/RESULT = {"POWER":"ON"}
15:43:01 MQT: stat/lcd/POWER = ON
15:43:07 CMD: displayrows
15:43:07 MQT: stat/lcd/RESULT = {"DisplayRows":2}
15:43:11 CMD: displaycols
15:43:11 MQT: stat/lcd/RESULT = {"DisplayCols1":16}
15:43:24 CMD: displayaddress
15:43:24 MQT: stat/lcd/RESULT = {"DisplayAddress1":39}

img_20180430_152637 Settings:

15:44:10 CMD: displaymodel
15:44:10 MQT: stat/tft/RESULT = {"DisplayModel":4}
15:44:14 CMD: displaymode
15:44:14 MQT: stat/tft/RESULT = {"DisplayMode":5}
15:44:21 CMD: displayrefresh
15:44:21 MQT: stat/tft/RESULT = {"DisplayRefresh":2}
15:44:24 CMD: power
15:44:24 MQT: stat/tft/RESULT = {"POWER":"ON"}
15:44:24 MQT: stat/tft/POWER = ON
15:44:28 CMD: displayrows
15:44:28 MQT: stat/tft/RESULT = {"DisplayRows":2}
15:44:34 CMD: displaycols
15:44:34 MQT: stat/tft/RESULT = {"DisplayCols1":20}
Jason2866 commented 6 years ago

THANK you! More explenations as hoped! With that the last open point in my Smart Home project is going to be solved. I need a few simple and cheap devices that displays some parameters (temperature, humidity)😃

arendst commented 6 years ago

I used double sided tape and wire-wrap to mount the wemos to the TFT display:

img_20170501_101359962

rlust commented 6 years ago

Thanks so much Arendst, your work is invaluable! Well done as always!

Jason2886, are you able to work with me on this to understand how you got a display? My email is rlust_at_mac.com

Jason2866 commented 6 years ago

@rlust Which type of display do you want OLED or LCD Dot Matrix (how many rows and lines)? To find is really simple. For OLED search for SSD1306 and for LCD with a I2C interface For example https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180430063646&SearchText=Ssd1306 or https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180430063755&SearchText=Lcd+i2c

rlust commented 6 years ago

I have an OLED .96 like option 1 128x64 What changes did you make in 06_display.ino? I am able to scan I2C and see the address 0x3c.

Jason2866 commented 6 years ago

@arendst Nice, reliable and quick solution. I like it too. In my very early years it was part of my job. Would be nice to own a electric wire rapp machine for private use...

arendst commented 6 years ago

In my early days, fixing backplanes, I used a battery powered wire-wrap tool too but the battery has left this planet so I have to use an old, once bought from Tandy wire-wrap manual tool which does the job perfectly.

Jason2866 commented 6 years ago

@rlust just added in user_config.h around line 264:

define USE_DISPLAY // Add I2C code for Diplays

Nothing changed in 06_display.ino Time and Date is on the display at start. I´m not at home so i can try the commands from Theo later the day.... Comment from source code 06_display.ino (line 977): `/*

Jason2866 commented 6 years ago

@arendst I know this hand wrap tool too. Mine still works pretty well after many years! And it is a good training for the hand muscels ;-) How do you power your devices? Have you a setup with a low Voltage DC wiring? Maybe you have a good best practice tipp here too? I use this little things to (hopefully) safeley power my WeMinis: https://www.aliexpress.com/item/1pcs-HLK-PM01-AC-DC-220V-to-5V-mini-power-supply-module-intelligent-household-switch-power/32319515750.html?spm=a2g0s.9042311.0.0.4wV9Ez

rlust commented 6 years ago

Got it working!!! It is picking up all of my temperature readings. This is fantastic! Thanks Jason for the guidance! arendst you made my day, this really is a great feature!!!!!! Now to pull out my old wire wrap toll and get a larger display. I also spent to many days back in tech school doing wire wrap :)

arendst commented 6 years ago

I use a 5V/3A power supply feeding the matrix unit. From there I use USB cables to TFT and LCD. The oled is currently fed by a USB to FTDI converter as the onboard USB connector broke off the board within an hour of use ;-(

They all could have been fed by a decent USB power supply.

ascillato commented 6 years ago

Amazing! Thanks for sharing :+1:

sharpn commented 6 years ago

Is there a specific build that needs to be uploaded to the device to get this working?

Jason2866 commented 6 years ago

Yes, branch development-display

bollitec commented 6 years ago

@arendst, many thanks for your picture with wemos and tft display, can you please send a higher resolution or the pin assignments (wemos - tft) ?

Like to test the branch and have some idea with touch screen display from raspi.

Thanks a lot!

abaszczok commented 6 years ago

Guys... I can not get it running... I setup display mode model etc... I got OLED 128x64 + D1 mini, which device type did you select in config module?? "generic?" .. I put #define USE_DISPLAY.. what else I'm missing/??? I tested this display + D1 on ESPeasy - the depslay is OK.. any hints?

abaszczok commented 6 years ago

Got it working.... pull up resistors 4,7k - ESPeasy you dont need to use them - they are internally proramable.. @arendst - you'r my hero !!! - keep it rolling

Jason2866 commented 6 years ago

I received my TFT today. If someone doesnt know how to connect the TFT Display (SPI). Take a look here: http://microcontrollerkits.blogspot.de/2015/11/esp8266-wifi-tftlcd.html CS and DC has to be cofigured over web console in module generic. See picture screenshot_20180526-144604 I used not GPIO 2 and 5 as in description example. I used GPIO 15 and 16.

vMeph commented 6 years ago

hi @arendst was trying this comands not working

21:04:49 CMD: displaymode1
21:04:49 MQT: stat/sonoff/RESULT = {"Command":"Unknown"}
Jason2866 commented 6 years ago

Habe you used the correct branch Development-Display?

vMeph commented 6 years ago

Yes mate https://github.com/arendst/Sonoff-Tasmota/tree/development_display

Jason2866 commented 6 years ago

You have enabled user_config_override.h ? In this file is the display part enabled. Does the connected Display shows anything? Just out of the box it shows time and date.

vMeph commented 6 years ago

Got it to work mate

Jason2866 commented 6 years ago

What was missing?

vMeph commented 6 years ago

enable user_config_override.h :)

thanks

vMeph commented 6 years ago

@jason2866 anyway to keep values info steady, everytime updates info it keeps moving down wondering if any command exits to keep them updating in the same place

Jason2866 commented 6 years ago

I had this too If i remember correct there is a command displaycols and displayrows. You have to set the values here of your display

Dees7 commented 6 years ago

Hello. Is origin/developmet support Display? I use ea43540 and connect TFT LCD 1.8 (128x64) with config g but after save SDA and CLK reset b

Display works but in mirror mode and with lines img_20180826_232321

MQT: stat/sonoff/RESULT = {"DisplayModel":4} MQT: stat/sonoff/RESULT = {"DisplayAddress1":113} MQT: stat/sonoff/RESULT = {"DisplayRows":8} MQT: stat/sonoff/RESULT = {"DisplayCols1":21}

BMP280 doesn't work with display in this config. What do I wrong?

arendst commented 6 years ago

As the interface is SPI you will need to know it uses 5 signal lines. Tasmota currently only supports hardware SPI. This always uses pins 12, 13 and 14 in addition to user selectable SPI CS and SPI DC.

So in your case connect 12 to MISO (if used) 13 to MOSI 14 to CLK and any of the other gpios to cs and dc

Other gpios can be used for I2C

arendst commented 6 years ago

Use displayrotate 0 to 3 for correct rotation. Only rotation 0 supports hardware scroll.

Jason2866 commented 6 years ago

Yes @arendst has implemented display drivers since a few days in development branch. Save must have been failed for config SDA SCL. I think display is not compatible. Maybe there is a mirror command. May you ask Gemu2015 in #3472 from him is the new display approach

Dees7 commented 6 years ago

Yes after connnecting as @arendst said BME280 works but display steel mirrored and shows a lot of noise.

Jason2866 commented 6 years ago

Maybe you have to use pullup resistors on all data connections. And a breadboard can make troubles too. Try to connect everything without it. Use short wires. Electronic can be a pain... I have this connections TFT LCD Pin VCC TFT LCD Pin GND TFT LCD Pin CS to GPIO_15 TFT LCD Pin RST to RST TFT LCD Pin DC to GPIO_16 TFT LCD Pin MOSI to GPIO_13 TFT LCD Pin CLK to GPIO_14 TFT LCD Pin LED to +3.3 V. TFT LCD Pin MISO ( not use )

andrethomas commented 6 years ago

@Dees7 Are you sure about the driver for that lcd? Did you test it with the code from http://microcontrollerkits.blogspot.com/2015/11/esp8266-wifi-tftlcd.html ?

Dees7 commented 6 years ago

@andrethomas yes I'm sure about LCD. I've tested it. @Jason2866 you have the same LCD TFT 1.8 tested? This works with test sketch well.

Jason2866 commented 6 years ago

I have this display https://www.aliexpress.com/item/2-8-inch-TFT-LCD-Module-without-Touch-Panel-ILI9341-Drive-IC-240-RGB-320-SPI/32764300681.html?spm=a2g0s.9042311.0.0.27424c4dWb2ZWj

simo26246 commented 6 years ago

Hi all, I've read through this and am still having a little difficulty. I'm trying to connect a display -

https://www.aliexpress.com/item/0-96-inch-IIC-SPI-Serial-128X64-Yellow-Blue-OLED-Display-Module-I2C-LCD-Screen-Board/32779485021.html?spm=2114.search0604.3.9.5b3758e8dJJGLc&ws_ab_test=searchweb0_0,searchweb201602_3_10065_10068_10130_10547_10059_10548_10696_100031_10084_10083_10103_451_10618_5016315_452_10307_10131_10132_5015615_10133,searchweb201603_45,ppcSwitch_5&algo_expid=79e93466-11bf-42de-9e2d-5d49db3c7070-1&algo_pvid=79e93466-11bf-42de-9e2d-5d49db3c7070&transAbTest=ae803_2&priceBeautifyAB=0

But I can't figure out which pins to connect to what, and how to set it up as a generic chip (I'm using a wemos d1 mini) in the config menu.

I know this is super basic, but I'm super new at this - any help would be really appreciated!

Jason2866 commented 6 years ago

You have to connect GND = Power -, 3.3V = Power +, SCL, SDA: Edited CS connect To GND image and to solder the jumpers R1, R4, R6, R7, R8, Unsolder R2, R3 : image You have bought not the easiest one for beginning :-)

simo26246 commented 6 years ago

Thanks for the reply. That all sounds like it needs to go in the too hard basket, and I'll just buy new screens, haha.

andrethomas commented 6 years ago

@simo26246 Its simple enough to solder the bridges where they are marked on the pc board? Why waste a good lcd

simo26246 commented 6 years ago

When you say solder them, you mean just bridge them together with solder? Do I need to desolder R4, R6, and R7 and get rid of the chips already there?

What would my pin config for a generic device be in the sonoff firmware? Obviously ground and vcc don't need to be setup, but what about the other pins? Do I need to use RES/DC/CS?

I just need to connect the SDA and SCL? Like this? - (yes, I know this isn't the development branch firmware - it's on another device, and wanted to make sure I got it right before stuffing around again) testconfig

Then connect them to the corresponding pins on the d1 mini? Really appreciate the help guys (total utter nooby here!)

ascillato2 commented 5 years ago

Closing issue as now it is implemented in Tasmota. Thanks everyone for sharing ideas.

AalianKhan commented 5 years ago

is it possible to show the status of a relay on these displays? it will be a really cool feature.

Jason2866 commented 5 years ago

@AalianKhan Yes, i agree. But isnt easy. How todo? So many different displays. And if done everyone has different wishes... You can do it via rules!