tasmota lcd display made in china
The display driver is able to display predefined setups of text or user defined text. To display text using DisplayText set DisplayMode to 0, or set DisplayMode to 1 for the HT16K33 dot-matrix display.
To use the seven-segment-specific TM1637, TM1638 and MAX7219 Display- commands, set DisplayMode to 0. Parameter LCD Display OLED Display TFT Display 7-segment Display (TM163x and MAX7219) 0 DisplayText DisplayText DisplayText All TM163x Display- functions
The DisplayText command is used to display text as well as graphics and graphs on LCD, OLED and e-Paper displays (EPD). The command argument is a string that is printed on the display at the current position. The string can be prefixed by embedded control commands enclosed in brackets [].
In order to use the DisplayText command the DisplayMode must be set to 0 (or optional 1 on LCD displays) or other modes must be disabled before compilation with #undef USE_DISPLAY_MODES1TO5.
In the list below p stands for parameter and may be a number from 1 to n digits. On monochrome graphic displays things are drawn into a local frame buffer and sent to the display either via the d command or automatically at the end of the command.
Pfilename: = display an rgb 16-bit color (or jpg on ESP32) image when file system is present, Scripteditor contains a converter to convert jpg to special RGB16 pictures See ScriptEditor Ffilename: = load RAM font file when file system is present. the font is selected with font Nr. 5, these fonts are special binary versions of GFX fonts of any type. they end with .fnt. an initial collection is found in Folder BinFonts
Draw up to 16 GFX buttons to switch real Tasmota devices such as relays or draw Sliders to dimm e.g. a lamp Button number + 256 - a virtual touch toggle button is created (MQTT => TBT)
When a file system is present you may define displaytext batch files. If a file named "display.bat" is present in the file system this batch file is executed. The file may contain any number of diplaytext cmds, one at a line. You may have comment lines beginning with a ;
E-Paper displays have 2 operating modes: full update and partial update. While full update delivers a clean and sharp picture, it has the disadvantage of taking several seconds for the screen update and shows severe flickering during update. Partial update is quite fast (300 ms) with no flickering but there is the possibility that erased content is still slightly visible. It is therefore useful to perform a full update in regular intervals (e.g., each hour) to fully refresh the display.
The data sheets of the TFT and OLED displays mention burn-in effects when a static display is shown for extended periods of time. You may want to consider turning on the display on demand only.
The EPD font contains 95 characters starting from code 32, while the classic GFX font contains 256 characters ranging from 0 to 255. Custom characters above 127 can be displayed. To display these characters, you must specify an escape sequence (standard octal escapes do not work). The ~character followed by a hex byte can define any character code.
The I2C address must be specified using DisplayAddress XX, e.g., 60. The model must be specified with DisplayModel, e.g., 2 for SSD1306. To permanently turn the display on set DisplayDimmer 100. Display rotation can be permanently set using DisplayRotate X (x = 0..3).
E-Paper displays are connected via software 3-wire SPI (CS, SCLK, MOSI). DC should be connected to GND , Reset to 3.3 V and busy may be left unconnected. The jumper on the circuit board of the display must be set to 3-wire SPI.
Waveshare has two kinds of display controllers: with partial update and without partial update. The 2.9 inch driver is for partial update and should also support other Waveshare partial update models with modified WIDTH and HEIGHT parameters. The 4.2 inch driver is a hack which makes the full update display behave like a partial update and should probably work with other full update displays.
In black and white displays, a local RAM buffer must be allocated before calling the driver. This must be set to zero on character or TFT color displays.
Universal Display Driver or uDisplay is a way to define your display settings using a simple text file and easily add it to Tasmota. uDisplay is DisplayModel 17. It supports I2C and hardware or software SPI (3 or 4 wire).
Initial register setup for the display controller. (IC marks that the controller is using command mode even with command parameters) All values are in hex. On SPI the first value is the command, then the number of arguments and the the arguments itself. Bi7 7 on the number of arguments set indicate a wait of 150 ms. On I2C all hex values are sent to I2C.
bit 2: enable async DMA, 0 wait for DMA to complete before returning, 4 run DMA async in the background. This later mode is only valid if the SPI bus is not shared between the display and any other SPI device like SD Card Reader.
# Scripter is the nost convenient way to edit and develop a uDisplay driver. On every scripter save the display is reinitialized and you immediately see results of your changes.
There are also many variants of each display available and not all variants may be supported. #define directive Description USE_DISPLAY Enable display support. Also requires at least one of the following compilation directives
This first week of Feb 2021 I received lots of gadgets and some more displays from Banggood including an old favourite – the ILI9341 – good, cheap LCD display – which I’ve always supported in ESP-GO – but now I want to run on an ESP8266 (again) this time using Tasmota. Here’s the ILI9341 display first: 2.4 Inch 240*320 Color HD LCD TFT Screen SPI Serial Display Module ILI9341
The setup for the display wasn’t QUITE as indicated on the Tasmota site – it seems that displays are not yet a high priority there, but with help I managed to get it running – here’s the template for Tasmota-display standard build – no need to compile a special. Note that the display does NOT have a CS pin but this has to be defined in Tasmota for the display to be recognised. I hooked RESET to RST and the backlight to pin marked BLK on the display. It SEEMS that Tasmota display support is a bit primitive as yet.
Note the ILI9341 CS and DC settings – the SPI versions don’t work – see above and this works. Also, CS is not used on these boards but needs to be defined in Tasmota or it won’t recognise the display. In the end, easier done than written about so here we go – 4 lines and some coloured text. The software also does boxes and circles.
I noted in an earlier Tasmota-display.bin development update some severe font issues and I spent days talking to the author of some of the Tasmota displays – Gerhard Mutz – he recently included a 7-segment font – and thanks to a little encouragement these will work on ESP8266 (that’s what I’m running my tests on to be sure).
I’ve also learned about the Tasmota file system and it is now possible to run PNG files (losing the transparency) through an editor to convert them into .RGB files so that icons can be easily added to Tasmota-displays – I expect this is in the tasmota-display.bin file but certainly in a custom Tasmota file – also font 5 onwards are optionally added RAM fonts. In essence we can have a small number of fonts including 7-segment as well as a range of colour icons available to use in Tasmota for the ILI9341. For me it has been a goal to get this facility for many months. The file system makes it possible to store the icons in FLASH and checking earlier I noted not far short of 2MB available for this purpose.
Lots of fonts are available here but beware they take up RAM. “displaybatch” lets you run files stored in the file system (which has to be enabled depending on your tasmota build). I run it with display.bat (the file who’s contents can init the display on powerup – currently not 100% perfect at powerup) or other .bat files – you need a leading slash before the file name. Example: displaybatch /display2.bat
Given a graphic in the root of the Tasmota file system and also a file called display.bat (with for example [z] in it to clear the display) then running displaybatch /display.ini produces the following display: (the virus image wasn’t my idea:-) )
With success on the ILI9341 board from Banggood, I turned to a model JYC150-7P SPI SSD1351 OLED board. The board has a link set for 4-wire SPI, I changed the link over to 3-wire SPI. Sadly no matter what combinations I tried – despite help from a couple of guys on the Tasmota displays DISCORD channel, we still got no-where. I found this document – which seemed to clear up what to do with the SPI DC wire, reset and CS – but.. nothing but black from the display.
In the meantime I tried a very old SSD1351 (2013 ILSoft Ltd) display board. Here are the settings I used after changing the link (cutting) on THAT board to set to SPI 3-wire mode with DC grounded, CS wired to Tasmota SSD1351 CS (see Tasmota config page) and RST to ESP8266 RESET. This board has SCK and SDI which go to the Tasmota SPI CLK and SPI MOSI :
displaytext [z][x0y0h128x0y127h128x0y0v128x127y0v128][x5y3C31s1f1]Working[x5y23C30735]Color is purple[x5y43C4032]Green text[x5y63C63488]red text[x5y83C64800]Orange text
No other settings in Tasmota-displays.bin.gz were used to achieve the above. See this page for the full colour codes (indexed did not work – I used the full colour codes).
I should take this opportunity to correct some colour coding on the Tasmota page as relates to this and similar displays. The page refers to green as code “8”. As we are looking at a display that uses 5 bits, 6 bits and 5 bits for R,G,B respectively, full green is in fact 64*63 i.e. 1984.
Once again this display works well but feature support for displays in Tasmota still leaves something to be desired – more fonts would be good and not just scaled up. In the example to the right above, I’m using codes which may look awkward at first – but are merely text – with commands embedded in square brackets – z for CLEAR SCREEN, x and y for POSITIONING, f for FONT, C for COLOUR, r for RECTANGLE and R for FILLED RECTANGLE:
Another great gadget – see photo below: You’ll see a white dolphin I picked up at a seaside market in Spain early summer 2020 – they are widely available – they come with a wooden base + USB lead and have a bright, warm, single-colour (white) display – but the SHARK came from Banggood (described as “Shark 3D Night Light 7 Colors Changing LED Touch Switch USB Table Lamp“), has a solid-looking black plastic base, USB lead and has full RGB including touch button options for any single colour or slowly cycling through the colours. I love it and so does my wife. The shark base in the photo above is sitting on a USB battery power pack I happened to have handy.
I just wrote about the 10-pack of GeekCreit Wireless IOT Modules – or as most of us know them – nodeMCU ESP8266 boards – at a very reasonable €23 for 10 – i.e. 2.30 each inc post. So what better to test them with than the freely-available tasmota-displays.bin and a nice OLED display.
But using the little 0.96″ displays is nothing new and though cheap they are a little on the small size. I was pleased therefore to note that Banggood stock a larger version at 1.3″ (I’ve no idea why we still use inches for the size of these). I’ve been using the SSD1306-based 0.96″ displays for years and you’ll find umpteen references to them in here.
The larger, white 1.3″ OLED displays however use a different chip – the SSH1106 – this particular version has the same resolution as the higher of the two smaller displays – i.e. 128*64
Having already tested one of my nodeMCU boards with the SSD1306 I was happy my hardware worked – and changed the Tasmota commands slightly to cater for the new display.
Disaster – and that’s why it has taken me a couple of weeks to write this article, planned originally for Christmas week. I wasted a lot of time on the Tasmota forums trying to find out why my new display – when presented with some text, would only show every other line of pixels. Antonio (Mr Shark) and I spent AGES trying to figure it out then he remembered he’d had a similar display and his worked.
The penny dropped… so I sent an email to Banggood who rapidly shipped off a pair of replacements. They turned up in deepest Spain this morning and here I am. They work, PERFECTLY – so it looks like, after all that, I simply had a duff display (looking now I can see a minor crack in the bottom left of the display which may have resulted in a disconnected internal wire) – nothing wrong with the Tasmota driver at all.
If you check the link in this article to the displays – note that for some reason Banggood show the GND and VCC positions to be the same as the SSD1306 displays – in FACT they are reversed (and marked accordingly) on the displays I have (i.e. vcc on the outside).
To drive these OLED displays, assuming for now you are working in the Tasmota webUI – is easy. But take note – the displays use 4 wires in total – 3v3,gND, SCL and SDA (i2c). The Tasmota (display version bin file) settings for this are easy – simply set GPIO4 (D2) to SDA in the webUI and GPIO5 (D1) to SCL using the “generic (18)” template. This as it happens is a choice, you don’t HAVE to use GPIO4 and 5, I just tried moving SCL to GPIO12 and it worked just as well.
Then wire the display to the ESP8266 board. (for reference these boards sit at i2c address 0x78 by default – that is how Tasmota knows the board is connected. In addition, a couple of commands are needed and these are non-volatile.
There are a ton of commands and settings for displays and it all gets confusing very quickly – the ones I’ve given you above are all you need to get started. That should force a reset of the board and give you a blank screen on the display. Next you will want to send some text…again in this case in the console:
Of course it doesn’t stop there – you can set one of several fonts, clear the screen, change orientation and so much more as well as xy position the cursor but that gets confusing fast so I thought I’d get the basics out of the way – I got bogged down with all the commands through trying to do too much at once. Ok, got a working display?
“displaytext” supports commands in square brackets which can be used for control – for example [z] clears the screen, [x0y8] sets the cursor down and left etc. To go further – I direct you back to the massive Tasmota commands page (display section) for more. You have a small choice of fonts, can draw rectangles etc filled or un-filled and more.
If you were sending commands via MQTT, in this example to a device I’m calling “display1”, you might send the displaytext command as a topic – payload pair:
There’s an important point here, these displays don’t last forever, so when I put a message up, sfter some time, maybe a couple of minutes depending on the job, I turn it off – this can be done with a POWER command or simply [z] to clear the display.
Until recently I was running the SSD1306 display on my home control Raspberry Pi, but now that I have this, I can combine the display and maybe a pair of SSD PSU control relays onto one nodeMCU board (I’m thinking power to the Pi and control of a pair of SSDs for cloning, all handled in Node-Red but that’s another article). Oh, another non-volatile command DISPLAYROTATE (0,1,2 or 3). Of course, it is up to you not to put too many characters on a line.
I’ll shortly expand this as I’m expecting more displays in the next week or so including colour LCD and OLED displays (the larger ones tend to use SPI hence more GPIOs).
13:02:59.788 MQT: stat/tasmota_0FDEC8/STATUS = {"Status":{"Module":0,"DeviceName":"Tasmota","FriendlyName":["Tasmota",""],"Topic":"tasmota_0FDEC8","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0,"InfoRetain":0,"StateRetain":0,"StatusRetain":0}}
13:02:59.794 MQT: stat/tasmota_0FDEC8/STATUS1 = {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://ota.tasmota.com/tasmota32/tasmota32.bin","RestartReason":"Software reset CPU","Uptime":"0T02:20:19","StartupUTC":"2022-12-12T09:42:40","Sleep":50,"CfgHolder":4617,"BootCount":39,"BCResetTime":"2022-12-11T14:40:16","SaveCount":118}}
13:02:59.799 MQT: stat/tasmota_0FDEC8/STATUS2 = {"StatusFWR":{"Version":"12.2.0.6(tasmota)","BuildDateTime":"2022-12-11T18:58:26","Core":"2_0_5_3","SDK":"v4.4.3","CpuFrequency":160,"Hardware":"ESP32-D0WD-V3 rev.3","CR":"393/699"}}
13:02:59.804 MQT: stat/tasmota_0FDEC8/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":3,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["Molleetjes_Guest",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["00008009","2805C80001000680003C5A0A192800000000","00000080","00006000","00004000","00000000"]}}
13:02:59.819 MQT: stat/tasmota_0FDEC8/STATUS4 = {"StatusMEM":{"ProgramSize":1484,"Free":1395,"Heap":134,"StackLowMark":3,"PsrMax":0,"PsrFree":0,"ProgramFlashSize":4096,"FlashSize":4096,"FlashChipId":"16405E","FlashFrequency":40,"FlashMode":"DIO","Features":["00000809","9F9AD7CF","0015A001","B7F7BFCF","05DA9BC0","E0360DC7","400840D2","20200000","D43C482D","000000A1"],"Drivers":"1,2,3,4,5,7,8,9,10,11,12,14,16,17,20,21,24,26,27,29,34,35,38,50,52,59,60,62,63,82,86,87,88","Sensors":"1,2,3,5,6,7,8,9,10,11,12,13,14,15,17,18,19,20,21,22,26,28,31,34,37,39,40,42,43,45,51,52,55,56,58,59,64,66,67,74,85,92,95,98,127"}}
13:02:59.825 MQT: stat/tasmota_0FDEC8/STATUS5 = {"StatusNET":{"Hostname":"tasmota-0FDEC8-7880","IPAddress":"xxxxxxxxx","Gateway":"192.168.178.1","Subnetmask":"255.255.255.0","DNSServer1":"xxxxxx","DNSServer2":"0.0.0.0","Mac":"C4:DE:E2:0F:DE:C8","Ethernet":{"Hostname":"","IPAddress":"0.0.0.0","Gateway":"0.0.0.0","Subnetmask":"0.0.0.0","DNSServer1":"0.0.0.0","DNSServer2":"0.0.0.0","Mac":"00:00:00:00:00:00"},"Webserver":2,"HTTP_API":1,"WifiConfig":4,"WifiPower":17.0}}
13:02:59.830 MQT: stat/tasmota_0FDEC8/STATUS6 = {"StatusMQT":{"MqttHost":"xxxxxxx","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_0FDEC8","MqttUser":"DVES_USER","MqttCount":2,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30,"SOCKET_TIMEOUT":4}}
13:02:59.837 MQT: stat/tasmota_0FDEC8/STATUS7 = {"StatusTIM":{"UTC":"2022-12-12T12:02:59","Local":"2022-12-12T13:02:59","StartDST":"2022-03-27T02:00:00","EndDST":"2022-10-30T03:00:00","Timezone":"+01:00","Sunrise":"08:34","Sunset":"16:52"}}
13:02:59.897 MQT: stat/tasmota_0FDEC8/STATUS11 = {"StatusSTS":{"Time":"2022-12-12T13:02:59","Uptime":"0T02:20:19","UptimeSec":8419,"Heap":127,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":20,"MqttCount":2,"Berry":{"HeapUsed":3,"Objects":46},"POWER1":"OFF","POWER2":"OFF","Wifi":{"AP":1,"SSId":"Molleetjes_Guest","BSSId":"9A:9A:4A:4C:3D:EE","Channel":7,"Mode":"11n","RSSI":100,"Signal":-50,"LinkCount":1,"Downtime":"0T00:00:03"}}}
#define SUB_PREFIX "cmnd" // [Prefix1] Tasmota devices subscribe to %prefix%/%topic% being SUB_PREFIX/MQTT_TOPIC and SUB_PREFIX/MQTT_GRPTOPIC
#define PUB_PREFIX2 "tele" // [Prefix3] Tasmota devices publish telemetry data to %prefix%/%topic% being PUB_PREFIX2/MQTT_TOPIC/UPTIME, POWER and TIME
//#define USE_CORS // [Cors] Enable CORS - Be aware that this feature is unsecure ATM (https://github.com/arendst/Tasmota/issues/6767)
// #define USE_MQTT_AZURE_IOT // REQUIRED Enable accesss to IoT Hub without DPS using a preshared key: https://tasmota.github.io/docs/Azure-IoT-Hub/ Enable MQTT for Azure IoT Hub (+1k code)
// #define USE_MQTT_AZURE_DPS_PRESHAREDKEY // OPTIONAL The Preshared Key of DPS https://github.com/tasmota/docs/blob/development/docs/Azure-IoT-Central.md
// #define USE_DISPLAY_SSD1306 // [DisplayModel 2] [I2cDriver4] Enable SSD1306 Oled 128x64 display (I2C addresses 0x3C and 0x3D) (+16k code)
//#define USE_TASMOTA_CLIENT // Add support for Arduino Uno/Pro Mini via serial interface including flashing (+2k6 code, 64 mem)
#define SET_ESP32_STACK_SIZE (8 * 1024) // Set the stack size for Tasmota. The default value is 8192 for Arduino, some builds might need to increase it
The order the pieces of the jigsaw go together is not important. I had a rough sketch of what I wanted the dashboard display to look like and so started at the top and worked down. However moving items around on a dashboard page is pretty easy so any other approach would be just as good.
Next add a slider and text display to give bed time in steps of 5 minutes from 10pm to 12pm - so 24 steps. Add a slider for the 24 steps, feeding a function to convert these to Bedtime and a text display to show the Bedtime. For the latter is is easiest to copy and paste the Time node so all we have to do is change the name to Bedtime. Check slider is set to Group Blanket[Bedroom1]. Set the Label to Bedtime and Range 0 to 24, Step 1. Name the function No. to Time and enter the code:
While searching the Internet for a battery monitor for DC voltages, I came across the PZME-017. The Peacefair company is known for various inexpensive battery monitors with LCD displays such as the PZEM-015.
In contrast to the PZEM-015, the PZEM-017 has no display and transmits the measurement data via the Modbus. The Modbus protocol is open and there are some implementations with an arduino. The website is an example here Solarduino called. There, however, a TTL-RS485 adapter is used to connect to the Arduino. In the area of home automation there are implementations with a Wemos D1 mini (ESP8266) with Tasmota firmware and a data connection via WiFi. However, it cannot be used well as a battery monitor on a boat, as you still need an external power supply of 5V for the Wemos D1 mini.
Energy display in kWh for the current day, previous day and total consumption display (not power off resistant when completely switched off, details look here)
The current version of the Tasmota firmware can be downloaded here: http://ota.tasmota.com/tasmota/release/ The firmware is available in different language versions. The tasmota.bin file would be a good choice for English-language firmware. If you want to know more about Tasmota, you can visit this website: https://www.tasmota.info There you will find detailed information about supported hardware and flashing.
The Tasmota firmware is universal and supports a variety of devices. With the configuration, the firmware is adapted to the specific hardware. After flashing, the Wemos D1 mini starts with its own access point, which can be reached under the SSID tasmota_xxxxxx. A password for logging into the WiFi network is not required. The start page can be opened with a web browser under the IP address 192.168.4.1. The respective settings are made under Configuration as shown in the following images.
Up to 3 temperature sensors can be connected in parallel to the 1-Wire port. The sensors can be used, for example, to measure the temperature of the battery, the charger, the solar regulator or the inverter. Any other application would also be conceivable. The Tasmota firmware will automatically detect the additional temperature sensors and display the temperature values below the values from the battery monitor. The assignment of the sensors to the IDs must be found out by testing the sensors.
By default, the Tasmota firmware only shows the voltage without decimal places. Up to two decimal places can be displayed if you enter the following command in the console:
If you want to access this data on third-party websites, you have to CORS (Cross Origin Resource Sharing) in the Tasmota firmware. This is done with the following command via the console:
The measured values can also be integrated into SignalK and can then be displayed via the instrument panel. How the configuration works in detail is described here:
The power consumption of the battery monitor can be reduced quite significantly to 1.0 mA at 12 V if the Wemos D1 mini can be switched off using a small switch (red cable 3.3V). The original measuring circuit then continues to run in the switched-off state and counts the power consumption. Only data transmission and display of the measurement data is then no longer possible. After switching on the supply voltage, all data are transmitted again and displayed correctly. This is very useful when you are not on the boat, so as not to discharge the battery.
If you also want to measure the consumption data of the AC shore connection, you can do this with the Sonoff Pow Power Monitoring Switch with the Tasmopta firmware do. The shore connection can also be switched on and off via the module. The newer variant is the Sonoff Pow R2. It has a larger range of functions and can display more measured values and react to limit values. An ESP8266 is already built into these two devices and is only operated with the Tasmota firmware. A modification of the electronic circuit is not necessary as with the battery monitor. The Sonoff Pow R2 is therefore a good addition to the battery monitor.
However your latest video you mention that the sensor life can be extended significantly by turning it off between readings and that Tasmota doesn’t do this.
Tasmota does not appear to have native support for this sensor. It was the CO2 sensor from same manufacturer that it does support. Since this sensor is so easy to interface it would be a natural addition to the Tasmota library.
Tasmota does support many serial-based sensor and the simplest one was a Maxbotic distance sensor. I converted it to a CO sensor and now am in the process to checking the Tasmota integration. While a straight serial interface of the sensor is possible, the integration with Tasmota provides a more complete integration of a device that has no other dependencies.
I also received the CO2 sensor CCS811 and was able to get it to recognize CO2 ppm via Tasmota, but after trying to package it rather than just a breadboard test I could no longer get it to work. I ordered another. My suspicion is that I connect power to 5VDC at some point and the sensor has a max rating of 3.6VDC.
I am also waiting for another sensor from China that does pressuee, temperture and humidity. While not a necessary component, it would be nice to have the additional information being reported since the software already exists to report these sensors. I also have a LCD display that I have proved to work through Tasmota so expect to show the CO and other information when it is all done. For packaging I took a basic LCD design from Thingaverse and stretched it to have more room for other components. I am not good at CAD, but can 3-D print designs with acceptable functionality. If pressed I can design a new widget, but is not something that give me pleasure. If you are conversant with CAD then I am more than willing to provide some physical dimensions of the components so you can design a case. I",m thinking now that the CO sensor should be on the back lid of the case so the sensor is fully exposed to the environment. The other choice is to provide additional air penetrations into the case.
This article explains in detail how to use and debug SSD1306 displays. In this article, I use the Segger emWin library and MBEDOS, but for all practical purposes this discussion applies to all other interfaces to the board including Arduino, Raspberry Pi, Adafruit, etc. I will say from the outset that I spent far far too much time digging into the inner workings of an 11 year old graphics driver. Oh well, hopefully someone will get some benefit.
A year ago (or so) I designed a user interface board called the CY8CKIT-032 to go with my Cypress WICED WiFi book and class. This board uses a PSoC 4 Analog co-processor which can do a bunch of cool stuff. I have a series of articles planned about that board, but that will be for another day. One of the things that I did was put a 0.96″ I2C OLED Display based on a SSD1306 driver on the board. These displays are widely available from Alibaba and eBay for <$2. I think that the displays are being used in inexpensive cells phones in China so there are tons of them and they are CHEAP! The bad news is that if you google “ssd1306 problems” you will find an absolute rogues gallery of unpleasantness. It seems that tons of people struggle to get these things working.
This whole thing started last week as Cypress released and update to our MBED OS implementation. This update included releasing a complete set of the Segger emWin drivers. I had been wanting to step up to a more robust graphics library than the Adafruit library that I used in this article. I was pleased to see that our release included the emWin SPAGE driver which knows how to talk to a bunch of different page based displays including the SSD1306.
But, as always, I had to wrestle with the display a little bit before I got everything working. This time I wrote down what I did/learned. So, for this article I will describe
There is not a lot to know about the electrical interface. The data sheet specifies that the device can use I2C, SPI, 6800 and 8080. I have not seen either the 6800 or 8080 interface put onto any of these OLED displays. Like all driver chips, the SSD1306 has an absolute boatload of pins, in fact, 281. The chip is long and skinny and was made to be mounted either on the display under the glass or on the flex connector. Of the 281 pins, 128+64=196 are connected to the segments and commons in the display. The rest of the pins are either capacitors, no-connects, power/ground or data signals. The data signals are
One thing you should be careful about is the I2C connections. I looked around on eBay and Alibaba to find a few pictures of the I2C displays. You should notice that all three of these displays are I2C, but all three of them have a different position and ORDER of VCC/GND/SCL/SDL When we ordered displays from China to go onto the CY8CKIT-032 we found displays in the same BATCH that had different orders of the VCC/GND.
The first part is the command interface. Inside of the chip there are a bunch of logic circuits which which configure the charge pumps, sequence COMs and SEGs, charge and discharge capacitors etc. All of these things are configurable to allow for different configurations of screens e.g. different x-y sizes, configuration of what wires are connected to what places on the glass etc. Before you can get the display to work correctly you must initialize all of these values by sending commands. All the commands are 1-byte followed by 0 or more command parameters.
The second part is the data interface. Inside of the SSD1306 chip there is a Graphics Display DRAM – GDDRAM which has 1 bit for every pixel on the screen. The state machine inside of the chip called the Display Controller will loop through the bits one by one and display them on the correct place on the screen. This means that your MCU does not need to do anything to keep the display up to date. When you want a pixel lit up on the screen you just need to write the correct location in the GDDRAM.
As to the fundamental commands. I tried a bunch of different contrast settings on my screens and could not tell the difference between them. I tried from 0x10 to 0xFF and they all looked the same to me. The best course of action is to use the default 0x7F. I don’t really know why there is a command 0xA5 “Entire Display ON ignore RAM”. The data sheet says “A5h command forces the entire display to be “ON”, regardless of the contents of the display data RAM”. I can’t think of a single use case for this. I suppose that if you issue 0xAE the screen will be all black… and if you issue 0xA5 the screen will be all white? But why?
In the next section of the command table are the “Scrolling” commands. It appears that this graphics chip was setup to display text that is 8-pixels high. The scrolling commands will let you move the screen up/down and left/right to scroll automatically without having to update the the frame buffer. In other words it can efficiently scroll the screen without a bunch of load on your MCU CPU or on the data bus between them. The Adafruit graphics library provides the scrolling commands. However, I am not using them with the Segger Library.
The hardware configuration registers allow the LED display maker to hookup the common and segment signals in an order that makes sense for the placement of the chip on the OLED glass. For a 128×64 display there are at least 196 wires, so the routing of these wires may be a total pain in the ass depending on the location of the chip. For instance the left and right might be swapped… or half the wires might come out on one side and the other half on the other side. These registers allow the board designer flexibility in making these connections. Commands 0xA0, 0xA1, 0xA8, 0xC0, 0xC8, 0xD3, 0xDa will all be fixed based on the layout. You have no control and they need to be set correctly or something crazy will come out.
These displays require a high voltage to program the liquid crystal in the display. That voltage can either be supplied by an external pin or by an internal charge pump. All the displays that I have seen use an internal charge pump.
In order to actually get data to display on the screen you need to write 1’s and 0’s into the Graphics Data RAM that represents your image. The memory is actually organized into 8 pages that are each 128 bits wide and 8 bits tall. This means that if you write 0b10101010 to location (0,0) you will get the first 8 pixels in a column on the screen to be on,off,on,off,on,off,on,off. Notice that I said vertical column and not row. Here is a picture from the data sheet. That shows the pages:
If you have the speckled screen this means that your screen is displaying an uninitialized frame buffer which the SSD people call the GDDRAM. These are basically the random 0 and 1s that are the startup values in the SSD1306. If this is happening then your graphic data is probably not being transferred between your MCU and the SSD1306. This almost certainly means you have a problem in your porting layer.
So let"s start playing! A BMP085 [Aliexpress] pressure sensor, a HC-SR04 [Aliexpress] ultrasonic range module, a I2C LED display [Aliexpress] or an nice little
What else… well, almost anything digital out there: displays, humidity sensors, distance sensors, touch sensors, encoders, magnetometers, gyroscopes, accelerometers, tilt switches, reed switches, real time clocks,… and also servos, external relays, buzzers, and WS2812 strips!
LCD Display I2C Adapter for Arduino With PCF8574A: Using LCD display with arduino needs many I/O lines of your microcontroller. Never again with the I2C adapter !!! In this tuto…
Lanbon, a chinese company smart home tech company has released a series of Wi-Fi mesh connected touch switches with an LCD screen and some other accompanying devices.
I have received the L8-HS 5 in 1 LCD smart switch. 5 in 1 meaning you can choose between 5 existing modes and adapt the switch to your current needs. You can choose between a 1, 2 or 3 gang light switch with a max load of 200W per gang or completely switch it up and use it as a curtain switch for any kinds of motorised covers. Lastly you can forego using the relays completely and use it as a scene switch to remotely control other Lanbon devices.
Each mode will change the buttons displayed on the screen accordingly. With that you also have the option to modify the labels and icons for your switches as well as change the theming of the UI.
European version of the switch has an 86mm by 86mm front plate inside which is a 49mm by 59mm color LCD touch screen protected by a, I assume, acrylic plate. The front plate contains all the brains of the switch while the mains switching relays and power supply are in the back of the switch. There’s a thin white strip running through the middle of the front plate sides.
The LCD touch portion of the switch is attached to a metal plate with a slide and lock system. You simply slide it out to install the switch in your electrical box.
Everything needed for installation is neatly labelled and explained in the instruction booklet. I hooked it up in my testing board as a 3 gang switch and slid the front plate back on. After giving it power, the screen lit up and started booting with a Lanbon logo displayed. The thin white strips around the switch also lit up, seems they are some sort of status RGB LEDs and they color cycle while booting.
“Greenmode” automatically turns off the light after the configured interval. When “Greenmode” is active a green leaf icon is displayed in the status bar right of the clock.
You can set screen brightness and screen timeout time. Turn on Home Assistant support. Calibrate temperature offset. Choose between power consumption or current power used displayed on the main screen. You can also flip the display to landscape orientation. Of course, there’s the obligatory Factory reset.
And then there’s something called “epidemic report:”. After turning it on I can select a country. And with this I got a display of COVID stats for my country when the switch goes to sleep mode. Got to have a good reminder of how bleak the times are, just before turning on the light.
Displays various system information including system time, current firmware version, power monitoring stats, memory, network info, device temperature and more.
Still, there is so much potential hidden in it and, luckily, the switch is based on ESP32 so who knows, maybe someone will start a good open source firmware project for it. I for sure will try installing Tasmota on it!