Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Home Automation With a Raspberry Pi (Part 3)

DZone's Guide to

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.

· IoT Zone ·
Free Resource

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.

Image title

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.

Real-Time Demo 

User Setup

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’.

Image title

Once the IR device gets connected, the application will confirm it with a message and will navigate you to the home page.

Learning Mode

  • 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.).

Image title

Execution Mode

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.

Image title

Manual inputs can be executed by using number keys.

Image title

The help section is also the part of the application to guide the user so that they can use the application flawlessly.

Conclusion

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.

Topics:
iot ,home automation ,raspberry pi ,captive portal ,tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}