Now it's getting serious. We start with an extensive project, we want with that ArduiTouch implement a SmartHome control center that can manage up to 32 remote devices based on ESP8266. Each of these devices can use up to 8 channels for communication. So that you can see where the journey is going, I have decided this time to first create a rudimentary but fully functional prototype and make it available for download.
This is followed by blog posts with detailed explanations of the protocols and programs used. Since the entire project consists of a large number of files, I will not publish the code in this post, but will make it available for download on GitHub. The repository TouchEvent contains a library that I developed for easy management of touchscreen events, the repository ATMessageBuffer contains libraries for a message buffer for data transmission and finally the repository ATSmartHomeit contains a database as the basis for this project as well as sample programs for the smart home center and for a simple client for temperature measurement.
To build the prototype you need one for the headquarters ArduiTouch With ESP32 processor as well as one for the remote temperature sensor D1Mini or another ESP8266 module and one or two DS18B20 Temperature sensor. The following circuit is used for the temperature sensor:
For the ArduiTouch, you should also find information in this Blog post note.
Next, the three downloads mentioned above should be fetched from GitHub. You simply copy the extracted folders into the Arduino libraries directory.
In the examples for ATSmartHome-master there is a sketch ATSmartHome for the control center and an ESP8266Device for the sensor.
The sketch for the control center should be compiled with the board "ESP32 Dev Module" and for the sensor with the board "NodeMCU 1.0 (ESP-12F Module)". After both sketches have been compiled and uploaded to the respective module, we should see the following image on the ArduiTouch.
The lower blue bar may be without text at first, but this should change as soon as the temperature sensor has sent its values. If the Smart Home Central receives data from an unknown device, the ID of the unknown device is displayed in the lower blue bar.
If you tap the lower blue bar twice in quick succession (double-click), the registration page should be displayed. Attention, if the bridge for the program download is still closed, the touch screen will not work !!
If you double-click on the "Register" button, the new device is registered and its measured values can be displayed. If you double-click the "Back" button, the main page is displayed again without registering the device.
If the device has been registered, this information is also permanently saved in the SPI file system of the ESP32. As soon as the control center has received data from the temperature sensor again, the following picture should be visible.
The display is updated whenever new measured values are received by the temperature sensor. Since the registration has been saved permanently, the ArduiTouch can also be disconnected from the power supply without forgetting the registered devices.
Additional devices can be registered in the same way as described. In this prototype version, the registration data in the SPI file system can only be deleted by formatting. To do this, double-click on the upper blue bar. The System Setup page should appear.
A double click on "Format FS" formats the file system and deletes all files. When formatting is complete, the main page is displayed again. If the temperature sensor continues to send data, it is recognized as an unknown device and its ID is displayed in the lower blue bar.
The sketch for the temperature sensor is set so that it sends measured values every 10 seconds. This is very practical for testing. For a real application, this time should be increased to five minutes or more to minimize power consumption.
As you can see, we have a very simple smart home center here, with which external sensors can be registered, whose measured values are then displayed.
Finally, a few features that will be implemented in future versions.
- Customizable presentation of the measurement results
- Several pages to display the measurement results
- Send data from the control center to remote devices (switch, dim)
- Connection of the smart home center to the Internet and time display
- Operation via web pages
- Connection to external services such as Cayenne
- Hardware expansion. Use the SD card reader on the touch screen to log data
- Definition of trigger values to trigger actions depending on measured values
and many other beautiful things. There are almost no limits to your imagination.
If you want to learn more about how this prototype works, you should read my upcoming blog posts. If you have any questions or problems, just add a comment. I will have a regular look and try to answer questions as soon as possible.