Introduction
The Cypress PSoC6 WiFi BLE kit is a great and powerful board that includes several features it is worth to use locally, regardless of its role to connect to the AWS IoT Cloud. For example, one of the interesting features available through the TFT display and sensors module is the environmental sound level detection via the sound level microphone sensor. On the path to complete the features of the PSoC6-based Super Smart Home node, I have implemented the skeleton of the double function of the board; while it is working as the AWS gateway can also control the environmental light and noise levels, as well as replicate the Control Center Raspberry Pi 4B through the local WiFi network.
Determining the PSoC6 node features and how to implement them in a good way has been the first step of this path; as it is obvious, I met also some challenging problems I had to solve, basically to create the Cloud Node basic architecture, as shown in the short sequence below.
Software Skeleton
Conditioned by the roled of the PSoC6 Cloud Node the scheme below shows the software skeleton and the UI schema:
While the PSoC6 is one of the endpoints of the Super Smart Home IoT network its UI role is for monitoring and consultation only for which I planned to use the FTF screen included with the PSoC6 Kit. The application active part instead should connect in a secure way to the Raspberry Pi 4B Control Center receiving the log, buffered on one of the monitoring pages of the interface (there is not a story of the log saved locally, as it is already done by the Control Center), as well as sending its status to the Raspberry Pi.
The other active part is dedicated to the timed acquisition of the light level and noise level; these two environmental values are acquired and interpolated by the PSoC6 program while only the alarm triggered values – daylight and dark light changes, and over the preset limits of the noise level – are sent to the Control Center.
Both the logged statuses from the Control Center and the environmental sensor values are updated through the MQTT shadows to the AWS IoT console to be displayed on the SiteWise web.
Display Monitoring Pages
The above scheme shows the strategy I adopted to monitor all the data through a simple user interaction; due to the reduced TFT screen resolution of the PSoC6 kit every group of data has been organized on a page (a single view of the TFT display). The pages are visible in sequence scrolling in both directions with the two Capsense buttons. Also if I plan to add more pages in the future it is not difficult to add others in the middle.
Software Development
The PSoC6 node has not to accomplish special tasks that require the real-time processing features of the RTOS (that by the point of view of the software development is an extra layer added to the Cypress libraries and a further complication); the PSoC6 can do its job using some threading and the interrupts, as well as the two sensor triggers for light and sound, so I adopted the Mbed OS as the development platform on the Modus Toolbox IDE.
Managing the UI: a Challenging Development
UI development has been the most complex part and I had to spend a full day to understand the logic to control the TFT display, very few documented in the Cypress Tools. The main page of the UI is the Super Smart Home graphic image; I discovered how to proceed with the UI design just when I tried to discover how it was possible to convert a bitmap to something usable by the device firmware.
The above image is the graphic screen for the first page (shown at power-on) I prepared and exported in PNG format at the TFT resolution (320x240 pixel). Digging on the net I finally discovered that the TFT display component – and only this, all the other parts of the same Arduino Compatible board are managed by the Cypress libraries – uses the Segger third-party components. It is included in the library configurator of the Modus Toolbox IDE but is undocumented by Cypress.
The Segger emWin Kit
All the graphic features available on the TFT – as for a lot of other industrial displays used with the microcontrollers – adopted the Segger emWin standard. It is a powerful library supporting multiple text modes and 2D graphics on the PSoC6 TFT. The strange fact is that the library is included in the library manager but selecting the TFT in the devices the library is only included but nothing about it is mentioned at all; it is like Cypress considering the TFT board of the kit only for the sensors included onboard.
After discovering that it was this library my problem I investigated and found the emWin specifications on the Segger site. The documented API of the library, are available from the Segger emWin site, as well as in the document attached to this post.
Also in the same site emWin includes a lot of useful software utilities (Window only) to convert images, videos, and fonts in the format accepted by the emWin library. It is possible to access this stuff and download it for free only after registering on the Segger portal. Ther I found the bitmap conversion program to generate the code for the PSoC6 TFT display.
The above image shows the image conversion tool I have used to generate the graphic content shown on the main page of the PSoC6 TFT on boot.
Above: the final result, shown on the TFT display of the PSoC6 WiFi BT Pioneer kit.
Full Content
Already Posted (until now)
Super Smart Home #1 The project
Super Smart Home #2 The Door Opener
Super Smart Home #3 Designing the Control Center
Super Smart Home #4 Activating the Door Opener
Super Smart Home #5 Connecting the First Node to the Control Center
Super Smart Home #6 PSoC6 On the Cloud
Super Smart Home #7 From AWS IoT Core to AWS SiteWise
Super Smart Home #8 The Kitchen Node: Parts, Design and Components
Super Smart Home #9 The Kitchen Node: Circuit and Software
Super Smart Home #10 Building IoT nodes with PSoC6-WiFi-Bt and Mbed OS
Super Smart Home #11 Project Summary, Highlights, and More...
Super Smart Home #12 PSoC6 Local Node: Application Skeleton
Super Smart Home #13 PSoC6 Protection Case
Sources, Circuits, and Documentation
All the software sources, scripts, circuits schematics, and more are available as Open Source material on the SuperSmartHome GitHub repository.
The video episodes of this challenge are repurposed on the blog posts of the site we-are-borg.com
Thanks to
Element14, AWS, and Cypress, main sponsors
Elegoo for 3D printers ad printing material
Digitspace for sensors, actuators, and boards
The friends and community members Jan Cumps and shabaz always available with advice and suggestions.
Top Comments