We have a remote LCD Node that works on NodeMCU board. It has a 40×4 char LCD attached to it and displays text received via a network message. We also can use Raspberry Pi as a remote LCD. But all those LCDs are small. We need something bigger and we have it! This something is an ILI9325 graphical display. There is a huge difference between char and graphic but we can simulate char interface. Our GfxLCD library has an ability to display a text and with a little bit of tinkering, it should work :D.
This could bring nice results, imagine a dump from Symfony with multiline formatting thanks to the ProxyLCD project. Nice 🙂
Finally, something that is missing from the start, the ability to write some text on display. In Doton we needed an ability to display numbers and we have done it via images. It was a partial solution but good enough. But we want more 🙂
So this time fonts, text and another step in endless struggle with displaying anything anywhere 🙂
Recently I bought an LCD 4″ IPS with an ILI9486 chip from Waveshare. It should be better than 2.8″ 🙂 In instruction states that this display can work as system screen and I thought that maybe we can use PyQt or something instead of a custom driver.
The idea died quickly. I tried to run it on Raspberry Pi Zero W and this is not trivial 🙂 First, I hit the bug with inability to use GPIO #17 and driver couldn’t be loaded. After some googling, I know that this is caused by the newest kernel. So I reverted to old one and… screen booted up but WiFi and Bluetooth did not.
So this way is no go. Back to the original idea and custom driver for ILI9486.
We may now return to the main task, the Control Node with all data from all sources. We will present data in form of a tile.
I’m thinking about creating widgets for both Node One sensors.
Each node is the one tile. We could present light and movement with small icons and humidity and temperature with numbers. It sounds nice and simple but there is a catch. If we refresh the whole screen it would take around 5s to change its content. So we must find a way of repainting only required parts of the screen.
Part 2 – weather widget
Part 3 – window manager
Doton project @ GitHub
During the work on GUI, I had to add a new function, ability to load and display an image. First, this post was a part of bigger one but I think it should be a post on its own.
I tried to display numbers but we have no ability to display a text. So I thought about using images and that’s why we are here:)
In previous three articles, we managed to create a united interface for NJU and SSD based LCD. Today we will add another LCD, the most important one, with ILI9325 chip and 240×320 size.
This one brings a new way of drawing. Not on pages but on pixels and with colours.
– part one
– part two
– part three
Source @ GitHub
We can draw lines and rectangles so next step should be filling rectangle areas. We will write a function to fill rectangle defined by given points. This will give us some info about performance.
And we will add drawing a circle and an arc.
Source @ GitHub
We can draw pixels so let move further and write an algorithm for drawing a line. We could use loop and draw_pixel for it but this would be very inefficient. Remember that we operate in selected area so using pixel would first select a 1×1 area and then set a color. Two operations for each point in the line.
So this is it. A start of a long road to the main control node. It needs output (display) and input(touch). I was thinking about using a ready-solution, hook shield to a RPi and do some web based GUI. But the web it is my daily work – so no! It must be something different. And I want to use Python!
So lets get to work and do some first drawing. My screen is 2.4″ TFT 240×320 v2.1 – this display has an ILI9325 controller for an LCD and AD7843 for touch. And it is GPIO only version without SPI (ok it has SPI for touch) but it may work in 8-bit mode (it has 16 data pins – we will use only 8).
We will start with dirty code and one goal in mind. Display something 🙂 Later we will do the same thing as with CharLCD – separate driver logic and wiring from the main class.