Face-Following Carousel - Hackster.io

2023-02-28 13:54:35 By : Mr. Kevin Parts

Add the following snippet to your HTML:

A carousel that automatically rotates to face the nearest person. Put a phone, fan, or anything you want to face at you on top!

Read up about this project on

A carousel that automatically rotates to face the nearest person. Put a phone, fan, or anything you want to face at you on top!

When I'm cooking or cleaning I'll often watch shows on my tablet, but I'll be moving around the kitchen and my hands are often full or dirty so I can't keep the display in view easily. I have a similar problem at my desk, where I have a fan that I'd like to keep pointing at my face as I type. With those situations in mind, I decided to create a stand that you can place an object on, and it will always rotate to face you. This project guide shows you how you can build one too, for around $50, with no soldering!

The brains in this device come from a Person Sensor, 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 example shows how to use it to control a servo-driven carousel.

The first step is assembling the materials. You should be able to use any servo and housing as alternatives to the exact models listed in the BoM, these were just chosen because they are easy to assemble. You can also use a regular Pico and solder on the headers yourself if you don't have a Pico H.

Next, put together the carousel itself.

There's a full wiring diagram below.

Wiring up the sensor requires 4 jumpers, to connect VDD, GND, SDA and SCL. We're using I2C port 0, which on the Pico is assigned to GPIO4 (SDA, pin 6) and GPIO5 (SCL, pin 7) in software. Power is supplied from 3V3(OUT) (pin 36), with ground attached to GND (pin 38). If you're using a Qwiic connector, the colors will be black for GND, red for 3.3V, blue for SDA, and yellow for SDC. It's the same setup as the introductory Person Sensor CircuitPython sample code.

The Person Sensor needs to be mounted on the plate of the carousel. If you're actually skilled you can probably do something fancy like 3D printing a part, but since I'm just a simple CEO I resorted to Blu Tack. It doesn't matter where on the plate the sensor is mounted as long as it is facing outward, the connector is on the top, and its view won't be blocked by anything you place on the carousel.

You should read the official guide to setting up CircuitPython on a Pico for the latest information, but here is a summary:

Once you've followed those steps, you should see a new CIRCUITPY drive appear. You can now drag `code.py` files onto that drive and the Pico should run them.

We need the adafruit_motor library to control the servo for the carousel, so the first step is to download a big bundle of all the CircuitPython libraries from circuitpython.org/libraries. You'll need to find the right bundle for your CircuitPython version. Once you have that downloaded, unpack the bundle on your local machine. In the file viewer, go to the `lib` folder within the unpacked bundle and copy the adafruit_motor directory into the lib folder on the CIRCUITPYTHON drive.

Now you need the CircuitPython code to check the sensor and control the servo. If you're familiar with git, you can use the command line to clone the github.com/usefulsensors/person_sensor_carousel repository. If not, you can just download the code as a ZIP archive from this link and unpack it on your machine.

Now your carousel is set up, copy the code.py file from this repository into the CIRCUITPYTHON drive. You should notice that the green LED on the Person Sensor lights up when it sees your face, and the carousel rotates until it is facing towards you. Now place whatever items you want to face you on the plate, and enjoy!

Hackster.io, an Avnet Community © 2023