Twitter icon
Facebook icon
LinkedIn icon
Google icon
Reddit icon
StumbleUpon icon icon

Build a Face-Following Robot

Added to IoTplaybook or last updated on: 01/09/2023
Build a Face-Following Robot


I've always loved robots, but been frustrated that they never seem as smart as they are in the movies. One of the basic behaviors I never seemed to be able to achieve was paying attention. I wanted a robot that looked at me, and followed me around. This was one of the motivations for building our Person Sensor in the first place, this kind of capability seemed like it would be a useful building block for robots that can better fit into our world.

The sensor is a small, low-cost hardware module that detects nearby peoples’ faces, and returns information about how many there are, where they are relative to the device, and performs facial recognition. It is designed to be used as an input to a larger system, and this guide shows you how to program a ring:bit robot car to follow you using a BBC micro:bit board with MicroPython.

Things used in this project

Hardware components

Person Sensor
Useful Sensors Person Sensor
× 1


ELECFREAKS Ring:bit robot car
× 1


BBC micro:bit board
BBC micro:bit board
× 1




SparkFun Qwiic Cable Kit
SparkFun Qwiic Cable Kit
× 1


SparkFun Qwiic micro:bit breakout
× 1



I suggest the SparkFun breakout in the BoM because it converts the micro:bit's small I2C pins into a standard Qwiic socket, but if you're skilled at soldering you could attach the wires directly to the edge pins on the board instead.

No soldering is required for this project, but if you want to use the breakout you will need to cut off the top 5mm of the backing board, because the ring:bit also has a board that needs to connect with the micro:bit, and that connection isn't mechanically possible otherwise. As far as I can tell there are no wires in this section, and the robot and breakout both work after this surgery, but it does mean it's not quite plug and play. I suggest using a small jewelers saw for this process. Here's what the completed result looks like:


First assemble the ring:bit according to the manufacturer's instructions, then test to make sure that you're able to run some sample programs on it.

Now remove the micro:bit from the car and slot it into the breakout slot, with the two I2C sockets on the breakout facing in the same direction as the front of the board (the side with the buttons and LED display on it). Plug one end of the Qwiic cable into either of the breakout's I2C sockets, and the other into the socket at the top of the person sensor. If you power the micro:bit board, you should see the green LED on the person sensor light up when you point it at yourself.

You will now need to rescrew the micro:bit back into the ring:bit backing board. With the top of the breakout removed, you should just about have room, though you may need to move the micro:bit a few millimeters higher in the breakout's slot.

Once that is in place, fix the person sensor to the top of the backing board, so that it's facing horizontally forward. I've used Blu Tack to fix it in place in this example:

Getting the Code

Now you'll need the code to control the car using a Person Sensor. If you're familiar with git, you can use the command line to clone the repository. If not, you can just download the code as a ZIP archive from this link and unpack it on your machine.


Create a new project in the Python micro:bit editor. Click on the Open button, and choose the file in the code folder. Then choose Open again and select the file. When you're asked if you want to replace, click on a small icon to the right of the dialog and pick the option to add it to the project under its original name. Make sure you have your micro:bit plugged in and click Send to micro:bit to upload the program to the board.

After it has uploaded, place your ring:bit on a flat surface and move so the sensor can see your face. You should find that the robot rotates to face you, and moves forwards and backwards to keep you about two feet away. If you move from side to side it should follow you, and it should also move to keep about the same distance from you. You can alter the speed, distance, and other behaviors by modifying the constants around line 34 in

Congratulations, you've built a robot that can interact with people around it. There's a lot more information you can get from the sensor, including whether people are looking at it and even some simple facial recognition, so I can't wait to see what you build with it!



Code - MicroPython code for controlling the ring:bit using a Person Sensor

usefulsensors / person_sensor_robot_car

Controlling a ring:bit robot car with a Person Sensor from MicroPython on a BBC micro:bit — Read More

Latest commit to the master branch on 11-27-2022 - Download as zip


Pete Warden

Pete Warden

This content is provided by our content partner, an Avnet developer community for learning, programming, and building hardware. Visit them online for more great content like this.

This article was originally published at It was added to IoTplaybook or last modified on 01/09/2023.