Daj się poznać / Get noticed – summary

Time is almost over but we have so much more work to do! Of course, we won’t stop our work but let’s summarise was has been done during competition.

The main goal was to build a control node that can gather and display information from different sources/sensors. This node is the Doton project.


But before we could create it we have to do two other projects: a GfxLCD python library, NodeOne sensor and improve one: NodeMCU boilerplate. So, in fact, we have done four projects 🙂

W began our journey with creating system behind messages and network. My idea is to have many devices (nodes) that use a common protocol (iot:1) to communicate. I already had this implemented for NodeMCU but not for Raspberry Pi.

Then we began the long way to display something on graphical LCD. From lines on ILI9325 via circles, areas and finally, we made a common drawing interface and library, the GfxLCD.
We can use it on ILI9325, ILI9486, NJU6450 and SSD1306

At the same time, we were working with NodeMCU board and boilerplate project. We made some improvements to relay node, added module for PIR sensor, and for the sound sensor. Then used HLK-PK01 to power such node.
Next, we checked the light sensor and DHT11 temperature&humidity sensor.

All this work on NodeMCU resulted in first milestone a Node One – a multi-purpose Node.
This device gathers some information and sends it to the network. The first node to receive it and show data was Raspberry Pi with LCD44870 char display. There, I use my older project CharLCD.

Then we returned to graphical displays and added two rendering algorithms, one called 8-bit for monochromatic LCDs and second called area for TFT.
Next, we added drawing images with transparency.

This was the second milestone. Working GfxLCD library.

With all this, we were able to create a first version of the graphical control node. Next, a bunch of posts was about improving and expanding abilities.

With adding touch driver to GfxLCD we could extend node to control a light by virtual buttons.

Then, for fun, we made an attempt to port lib to Windows 10 IoT. First in Python and next in C#.
This was a failure, performance was too low.

As a final step, we added driver for common ILI9486 in form of Waveshare shield. This is a 4″ 320×480 LCD with XPT2046 touch panel.

And as consequence, we moved Doton project to this screen. And this was the third milestone.

But this is not all 🙂 we have much more to do, lots of bugs to fix :). The tiles auto adjustments awaits 🙂 Or hook Rpi Zero W and create a nice case to mount the device on the wall.

Doton

The Doton is using few concepts. We have handlers, classes that work with message server and reacts for received network messages. In practice, a broadcasted message with temperature data is received by the server and passed to the handler. Handler calls correct widget and sends new data.
To keep a connection between handler and external source we use the HandlerDispatcher class.

Then we have workers. Their task is to err work as thread or something similar and pass data to the widget. Like a weather widget worker calls service to read weather from Openweathermap.
And similar to handlers we have the Worker Handler. Was is the difference between handlers and workers? The handler only listens and the worker has an initiative.

And we have just a widget, in our samples, it is a clock. It does not communicate with any external services.

Workers and handlers are responsible for gathering data.

And we have widgets with tiles. One widget may have many tiles. And tiles can be clickable (touchable 😛 ). Their role is to present data in a nice form and receive user’s input.
To compensate for slow drawing we only repaint those numbers/icon that has changed. We have a relay buttons. After the click, it broadcast message to the relay node and if everything is ok, it receives the response and change state.

As a representative of active tiles, we have the relay buttons. After the click, it broadcast message to the relay node and if everything is ok, it receives the response and change state.

But to make it even more flexible we have a window manager. It knows the size of the screen and knows where and how to position tiles. It supports internal touch areas to scroll between pages. The page is a pack of widgets that are displayed and visible on the screen. We can have many pages, with different or same tiles 🙂
The Manager can raise an exception when a widget is out of bounds or just remove it.
The manager also propagates events to widgets that support actions.

There is, of course, an interface/abstract for all this. So it is easier to write your own part of the system.

The Doton can work on any supported screen or even better on any screen that is supported by GfxLCD package.
I have two different nodes one with ILI9325 and second with ILI9486. This forced me to create a config service and file in such way that hardware is configurable in the ini file.

But it is far from perfection 🙂 There are few bugs like relay widgets always starts in the same state. It doesn’t ask about the current state. Same with NodeOne widget.
Next, we do not have an SPI lock, so when drawing is disturbed by touch it gets messy.

Booting up:

My thoughts

This was hard, like really hard. Three months and minimum 20 posts to write, we made 34 or something. But it was also a fun and a great motivation. I do not believe that I could do all this without a “pressure” from Get Noticed competition.

I made a few shortcuts that bite me at the end. Like no tests in drawing module so when I saw a little problem I ignored it :). But all in all, I’m pretty happy with the result. Or even four results 🙂

Now it is a time for break 🙂 I have an awaiting board game to play 🙂

After that we will return to project and start fixing and patching 🙂

Thank You.

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s