Home Automation With a Raspberry Pi (Part 3)
This home automation series' conclusion delves into a demo of the app in action, including how to connect your appliances and configuring hand gestures for control.
Join the DZone community and get the full member experience.Join For Free
and we are back with the third blog of our home automation series. the first and second blogs of this series were more about technology set up, as seen in the software installation guide and implementation of hand gesture recognition . the third blog is more about command configuration set up and a user-oriented real time demo of the application, which is actually a captive portal type application designed to automate home appliances.
creating a captive portal
- as the user can have remote access to the application, we hosted the application on the raspberry pi server.
- though spring boot is known for making a notable reduction of configuration and boilerplate code, its auxiliary niceties of being lightweight and the capability of packaging the application as a runnable jar that includes an embedded tomcat server attracted us more for, considering its rest endpoints also helped us in making the application accessible through a browser.
- the application package comes in executable jar format, and it has configured system settings that help to start the web server upon the raspberry pi startup without any user interaction.
- a user-friendly application flow, described in the real-time demo section, could be achieved through prominent utilization of spring boot's capabilities.
this basically looks like a plug-and-play set-top box intended for easy installation and operation. the user simply needs to supply electric power through a cable to access it.
elementary application access
- we have tried to make the application access handy, at least as much as possible.
- once the user plugs in our set-top box lookalike device and connects to their wi-fi network, the system ui will automatically open up in each laptop or mobile device connected to that particular network and enable the user to manage their home appliances through them.
- we have used the captive portal concept for implementing this functionality and, of course, it needs successful wi-fi access permissions like ssid and the password or any configured hint.
- then the url of the application will be saved in a browser so that users can manually ping the system.
how it works
once the user starts the application, it will check whether the “smart ir device” has connected or not, according to the device status application message. if it is connected, the system will go ahead. otherwise, it will display an error message, and in that case, the user needs to configure the smart ir device by providing the wi-fi user id and password. this process is called ‘smartconfig’.
once the ir device gets connected, the application will confirm it with a message and will navigate you to the home page.
- learning mode is all about making the ir device understand which gesture or numerical input to be considered for performing the desired action. accordingly, this lets the ir device pass the signals to the connected home appliance.
- for manual input setups, the application will display a dashboard with configured options. for gesture input setup, you can enable the device's camera and capture the gesture by using the start capture and stop capture buttons. once the gesture is configured, you can link that gesture to the desired actions (on, off, etc.).
once the gestures are configured and linked to their relevant actions, they can be executed any time. to execute it, the user simply needs to assess the application and capture the gesture using take snapshot.
manual inputs can be executed by using number keys.
the help section is also the part of the application to guide the user so that they can use the application flawlessly.
of course, this accomplishment has certainly boosted our techie spirit up to the optimum level. still, while the world is advancing swiftly toward the internet of things, and people are looking forward to a high-end and affordable technological experience in their routine lives, there is a long way to go. many more advancements are still on the way for us.
Published at DZone with permission of Santosh Prajapat, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.