Home Engineering Projects For You 1001+ Electronics Projects For You

IoT Activity Through Eye Control Things Just By Looking

Ashwini Kumar Sinha

Cool IoT device with which anyone can control a home appliance by looking at it

Have you ever thought of controlling electric/electronic home appliances by simply looking at them? Could happen in movies but seems to be impossible in real-life…..Well, no more. Now you can switch on or off any electric/electronic appliance with the blink of your eyes. Besides developing a cool IoT project, it also helps specially abled people to independently control such appliances. So let’s start our project by collecting the following components. 

Bill Of Materials

Coding 

The device needs to recognise the appliances that require to be controlled with the help of commands sent from the eye. Therefore the following code allows us to capture real-time videos for object detection and toggling an appliance on or off.

For the project, we will use OpenCV to capture video from the camera and then TensorFlow (TF) to select the home appliance we are looking at. Then use the gpiozero library so that commands are processed from the eye blink sensor to control the appliances. 

So install Python and the required modules in the Raspberry Pi using the following commands:

sudo pip3 install python-opencv

sudo pip3 install tensorflow

sudo pip3 install keras

sudo pip3 install gpiozero

Now duplicate the object detection library. Then in the test folder, create a file containing the list of appliances and save it under the name ‘eyeiot.pbtxt’. 

To create the IoT object detection and controlling functionalities, copy the code for object detection to a new file. Make sure to import a few more modules and libraries to the code such as gpiozero to control the pin inputs and outputs. 

After this, define the pin numbers to control the appliances.

Finally, set the file name in the code so that it can detect which appliance you wish to control from the given list of appliances (whether it is refrigerator, TV, toaster or any other appliance). After doing so, obtain the result where the strings contain the list of detected object names on the video. 

Now the code will search various sub-string names in the string format results. These sub-strings contain the name of the appliance you wish to control. A few conditional statements will check the availability of that string i.e. check the presence of an appliance. 

For instance, suppose you wish to operate a TV. The code will detect its presence when you look at it. With the help of an if condition, the total time will be counted while looking at it. If it exceeds five seconds, then the TV will be switched on or off.

Connection 

First connect the relay to the pin number mentioned in code (to control an appliance) and then connect the camera to the Raspberry Pi camera port. Now mount the Raspberry Pi camera to the eyeglass powered by a tiny usb power bank.

Testing

Run the code and move your eyes to look at the appliances that you intend to control. On looking at an appliance for more than five seconds, it will automatically switch on or off.

This project is the first version. A newer version with more cool features and wireless control system is here

Download Source Code

2 COMMENTS

  1. im unable to run the code
    when im running it. iam getting the following message

    Traceback (most recent call last):
    File “/home/pi/eyeiotversion_2.py”, line 2, in
    import cv2
    File “/usr/local/lib/python3.5/dist-packages/cv2/__init__.py”, line 5, in
    from .cv2 import *
    ImportError: libcblas.so.3: cannot open shared object file: No such file or directory

    • First, do checks camera interface is on in RPi settings camera working properly . Now check the open cv is installed properly multiple versions of OpenCV or wrong version of open cv cause problem in importing its module in code.

SHARE YOUR THOUGHTS & COMMENTS

Please enter your comment!
Please enter your name here

Exit mobile version