Creating a Super Smart Home design from scratch has been one of the most interesting and exciting competitions I ever participated in. As a fan of The Cypress PSoC family with some experience on how the AWS ecosystem works (I own an AWS EC2 server by 2015, already used some AWS IoT service and strongly sponsoring the AWS use to the customers of the company I work here in Belgium), it was a great WOW seeing the kit of this challenge.
In the past, I experimented a lot with the smaller Cypress dev kits of the family (PSoC4 and 5 and a few with PSoC6) but keeping the two things together god me the possibility to explore in-depth the incredible possibilities of the PSoC 6 kit, as well as learning more in detail the specific IoT dedicated services from AWS.
1. The project begins!
What is "Super Smart Home"? the idea is to create a network-based distributed system that can keep under control all the aspects that may be strategical in a private home.
2. The Door Opener and the ESP8266
In this second post, I have experimented with the control of actuators using the small ESP8266 designing a door opener controller. This part involved both software and a couple of electronic boards designed from scratch to test and program the microcontroller
3. The Control Center
Based on the Super Smart Home proof of concept I developed the Raspberry Pi 4B Control Center: a Python application with the UI created with Qt Designer and converted to a Python class using PySide.
4. Controlling the Door Opener from WiFi
In this post, I illustrate how I implemented an HTTPS server on the ESP8266 controlled through REST APIs from the Control Center. I have also implemented a dual-way pin OTP password authentication.
5. Connecting a Node to the Control Center
In this fifth post, I illustrated how the remote node connected to the Raspberry Pi 4B Control Center; I developed the software architecture of the Control Center able to manage the connection of the nodes, retrieve information and monitor the status of every node saving a timestamped log and text to speech alarm notifications.
6. Building a PSoC6 IoT Gateway Connected to the AWS IoT Core
In this post, I illustrate how I have created an IoT Gateway with the PSoC6, through a secure connection to the AWS IoT Core using strong private/public keys and an authorization certificate.
7. AWS Services for a Scalable Management IoT System
Working with the AWS IoT services I have set up the PSoC6 connecting with MQTT shadow topics building a scalable management system using AWS SiteWise
8. Building Out the Solution
In this post, I illustrate how I have managed a series of sensors and actuators, including temperature measurement and gas monitoring, to control the health status of a complex room as well as implementing efficient feedback to avoid and minimize risky conditions.
9. Managing Actuators, Feedback, Alarms, and Notifications Rising the Status to the AWS IoT Cloud
In this post, I presented the development of a complex C and C++ application for the Arduino Mega 2560: the creation of a state machine that can provide immediate feedback reacting to potentially dangerous situations, as well as avoiding risky conditions. Every meaningful change in the state machine (alarm, events, notifications) is sent upward to the Control Center that update the strategical information to the AWS IoT cloud via the connected PSoC6
10. IoT Nodes with PSoC6 and Mbed OS
In this post, I present how I have explored the development of PSoC6 based nodes using the Mbed OS as a good alternative to the RTOS development environment.
What I Learned
In my previous posts I tried to summarize the most important aspects I found valuable and possibly giving a few added value to the community. For all interested in exploring the deeper software aspects behind the Super Smart Home project, as well as the circuits and the logic of the adopted strategies, the last updated content is available on the GitHub SuperSmartHome repository. I have tried to give the repo an easy-to-follow folders tree; in detail:
/AWS-PSoC6-WiFi_Bt-Pioneer_Kit - Contains the development of the PSoC6 related to the AWS IoT MQTT connection.
/Circuits - The circuits schematics of the boards, shields, build I made. Regardless I design my PCB circuits with Altium Circuits, I have adopted the Fritzing Open Source platform to make easier the reading of the schematics.
/ESP8266-Arduino - Contains the ESP8266 source sketches developed with the Arduino IDE.
/Key-Generator - The key generator Bash shell script to create the header file with the certificate and the private key.
/Raspberry-Pi - Organized in subfolders contains all the software (mostly Python and Bash shell scripts) used to create the Raspberry Pi units.
/SmartHome-Qt – The Qt designer project I created to design the Raspberry Pi Python Control Center UI
Arduino_Mega-2560 – Contains the software sketches and classes developed for the Arduino Mega 2560 with the Arduino IDE.
Connecting the PSoC6 WiFi Bt kit to the AWS IoT Cloud
Experimenting just for testing or trying how a certain system works maybe interesting but approaching a complex, geographical architecture to reach a specific goal is really challenging; this is what happened when I had to study how to set the communication between the local PSoC6 device connected to the Internet and the remote AWS IoT Core. And things come more complex when I decided to adopt a flexible and modular platform as the AWS SiteWise assets portal for data representation as I tried to show in the two posts Super Smart Home #6 PSoC6 On the Cloud and Super Smart Home #7 From AWS IoT Core to AWS SiteWise
The aspect I more appreciated of the AWS IoT services features (I only used the IoT Core and SiteWise but there is plenty of other possibilities), is the scalability of the IoT ecosystem implemented by AWS. As much the remote structure grows and expands, as much the AWS IoT architecture can be easily adapted to a modelization optimized for data representation and clustering the information in well understandable structures (graphs and tables).
Above: the Super Smart Home portal created with SiteWise in the AWS IoT ecosystem, connected to the PSoC6, secured with a strong private/public key and certificate.
Programming the PSoC6 with both AWS RTOS and Mbed
After trying with success connecting the PSoC6 to the AWS IoT Core using the Cypress version of the AWS RTOS, specific for the PSoC6 (and some other Cypress IoT enabled platforms), I also tried programming the PSoC6 with Mbed OS. And in both cases, the documentation and development environment included excellent documentation. My conclusion is that RTOS is a good development platform but where possible I think I will continue developing with the Mbed OS; the advantage that, in my opinion, this second platform offers – but the investigation is fat to be concluded – is the compatibility with many other devices, including the BBC micro:bit I use frequently in my projects. So, probably, the knowledge and software developed for one platform can be easily adapted and recycled (saving a lot of time) on different platforms as well (see more on Super Smart Home #10 Building IoT nodes with PSoC6-WiFi-Bt and Mbed OS )
Developing User Interfaces for Python with Qt and PySide
In the past, I have already tried several solutions to design UI for Python programs on the Raspberry Pi. I tried Kivi, an efficient Python library; the approach of this tool is oriented in the creation of dynamics interfaces running on small screens with a lot of possibilities (and complexities) to present efficiently a lot of data on a small screen thanks to fast menus, pop-up windows, list boxes, and many other widgets. Not the ideal choice for a big screen and the kind of interface I had in mind. Another possibility was using the Python library PyGame but in this case, the best performances of this set of graphical features are for making games; using PyGame for a more traditional UI requires some strong customization and considerably reducing the features.
To make a complex interface design in Python for the Raspberry Pi 4B Control Center, instead, I decided to use Qt. I develop on the multiplatform Qt environment by almost ten years but I never faced the problem in these terms: designing the interface using Qt Designer (a component part of the Qt Creator IDE) then converting the design file to a Python class using PySide. I should admit that this was a lucky choice as the result had been efficient and reliable as discussed in the post Super Smart Home #3 Designing the Control Center
Below: The Control Center Python main program and the Qt designed UI running on the Raspberry Pi 4B
Creating a Web Server with SSL/TLS Security Programming the ESP8266
ESP8266-01 is the component I risked more selecting the parts; it was the first time I was using this microcontroller and now I should say it has been a good choice: It is small, cheap, and really powerful, obviously with its own challenging issues. I studied the ESP in detail making the design of the Door Opener in the post Super Smart Home #2 The Door Opener In the past I developed hundred of web sites and web applications; before this challenge, the smaller device I worked with has been the Nokia Maemo and the experience of seeing a couple of square centimeters of technology able to connect to the WiFi running an SSL/TLS web server with a lot of possibilities was really exciting.
As mentioned before, it is the very first time I put my hands so in-depth in a wide IoT project. Considering the results and the possibilities I explored – I see that there are a lot of other aspects that can be efficiently automated in a home at a more than reasonable price. So I decided to extend the project and going ahead with more nodes integration. By the way, I have added to my monthly subscription of the AWS EC2 server also the AWS SiteWise fee. During the next weeks, I will continue posting here the evolution and new implementations of the project.
In the meantime, I am working to extend in a more detailed way the content of the posts to convert them in chapters; the plan is publishing a book that will be on the library shelf (obviously printed and digital version) by the next month of July, a three languages edition – English, Italian, and Spanish – for the Spanish publisher Ediciones Baleares.
Stay in touch, that the story continues...
Already Posted (until now)
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
Element14, AWS, and Cypress, main sponsors
Elegoo for 3D printers ad printing material
Digitspace for sensors, actuators, and boards