Thursday, November 7, 2024

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages

Designing IoT Face Recognition AI Robot

In this project, we are going to learn how to design a smart AI robot that can recognize a person’s face, can recognize that person’s voice and thus receive various commands for welcoming guests or for security purposes. One can also preview live streaming with a camera through face recognition.

- Advertisement -

Components Required

For this AI robot, we need the following components. 

  • 2 Servo Motors
  • 2 OLED SSD1306s
  • 2 Arduino boards 
  • Raspberry Pi 4 board
  • Raspberry Pi camera
  • Amplifier
  • Bluetooth HC 05
  • Bluetooth Audio receiver
  • 3 thin metallic rods (7cm long) 
  • A hard-cardboard or wooden base to mount the robot head
  • USB data cable
  • 5V power adapter
  • Connecting wires
  • Last but not the least, a robot face mask (Here we are using an open source INMOOVE robot head).

NOTE:  As the sensors and parts are customizable, the above bill of materials can vary.

- Advertisement -

Assembling the AI Robot’s face

This may vary according to the different shapes and sizes of the robot head design. Here, I am using the Open Source INMOOV robot head that has been created using a 3D printer. You can even 3D print your own face and use it as a robot head or get various 3D printed robot heads from thingiverse.com

NOTE:- Before assembling the OLED display for the robot’s eyes, first solder it to make the proper connections (as explained later).

Make sure to securely screw the OLED displays onto the eye piece of the robot head as shown in Fig. 1

IoT Robot head assembly
Fig. 1 Robot head assembly

After this, mount the Raspberry Pi camera (connected to Raspberry Pi board) carefully beside the one of the OLED displays. Attach a servo motor near the mouth of the robot head. This will allow the robot’s jawline to open and close (See Fig. 2, 3)

Fig. 2
Fig 3.

Supporting the Robot head

First, firmly fix another servo motor on a cardboard or wooden base with the help of a screw or hot glue. This will provide up and down movement to the robot head.

To make a sturdy support, screw three thin metallic rods in such a way that they surround the servo motor in a triangular shape. Make to sure to connect one end of a metallic rod with the shaft of motor. (See Fig. 4, 5, 6).

Fig. 4
Fig. 5
Fig. 6

Now the basic assembly portion is done. The final AI Robot head will look like this (See Fig. 7).

IoT Face Recognition AI Robot
Fig 7

Now, let’s move on to the coding part.

Prerequisite

Before we begin, go the Library Manager of Arduino IDE and install the following libraries:

  • Adafruit GFX 
  • SSD1306 OLED

Similarly, install the following modules in Raspberry Pi for Python3 environment.

  • Numpy
  • Scipy
  • Open cv
  • Cv2
  • Face recognition 
  • Espeak
  • Matplot
  • Keras

To install these libraries, follow the library installation instructions available at the documentation folder of each library.

Coding for robot’s eyes

We will add the above Arduino libraries into the code using ‘include’ function and then insert the bitmap hexadecimal code for the eyes (See Fig. 8).

Fig. 8

Next, we create a loop function to call the above bitmap codes to preview them on the OLED display.  (See Fig. 9).

Fig. 9

Coding for face recognition 

This is to recognize the person in front of the robot (known or unknown). In this code, we will import 3 modules: face recognition, cv2 and numpy. We will create different arrays for recognising faces and names. Make sure to write the image file name of that member for correct face recognition. (Refer fig 10 and 11).

Fig 10
Fig 11.

In the next part of code, we will try to match the face that has been captured by the camera with the array of known faces. If the face matches, then the code will run the espeak synthesizer to speak the person’s name using the syntax ‘espeak.synth ()’ as in the pic below (See Fig.12)

Fig. 12

Connection 

OLED to Arduino Connection

Arduino  OLED
GND GND
5V VCC
SDA(A4) SDA
SCL(A5) SCL

To get audio output with the help of Raspberry Pi, you can follow the below two processes:

  •  Connect any small speaker via TTRRS (aux) audio output of raspberry pi to TTRRS(Aux) of speaker, or
  • Use a small speaker with an amplifier.

Now connect one end of Raspberry Pi camera’s ribbon cable to the Raspberry Pi camera input present in the board. Then power the Arduino Mini connected with the OLED display via 5V pin of Raspberry Pi. 

Now our AI Robot is ready to work.

Testing

After booting the Raspberry Pi, open the face recognition script that we have made and run that script. Now, on the OLED display, you can see the robot’s eyes move. Whenever you will go in front of the camera, the robot will recognize your face and will say your name.

Note : This is the first version of robot we will upload soon the next version. 

Download Source Code

If you found this IoT project useful then you may also like Top 30+ IoT Projects | IoT Project Ideas for Enthusiasts.

Ashwini Sinha
Ashwini Sinha
A tech journalist at EFY, with hands-on expertise in electronics DIY. He has an extraordinary passion for AI, IoT, and electronics. Holder of two design records and two times winner of US-China Makers Award.

22 COMMENTS

  1. Hi, Looks like this could be a great project with some extra information. Have you a wiring diagram for this? especially for the Pi/Arduino connection as I’ve not done that before and also you have some code in screenshots that I can’t find? Thanks Darren

  2. Hello
    sir,
    humbly request you that i want to create that project but, where these component will available
    if we purchase all component how we assemble,
    sir we want to help from your
    we must submit the project and this project is my choice
    please give me your whats app or other contact Number
    my cell no 00929150293
    email: [email protected]
    Regard
    Habib Ullah
    waiting for your response
    Thank you!

    • There is Not much connection , You only Need to put the Camera into Raspberry PI camera port .
      ANd then Connect the OLED display to Arduino to Arduino SDA and SCL pins tof arduino to OLED display pins. If you need more help contact me on whats app 7061350809

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics