Code and 3D Files:
Youtube Video (Demo and Assembly):
The design of the light was inspired by this task light made by Dyson:
I thought the elegant and minimalist styling was really cool.
This design reminded me of the structure of some 3D printers and laser engravers, so naturally, I wondered if I could attach motors to it and make it move on its own.
Then arose the issue of how I'd control it. I could've simply used knobs to control each motor, but I wanted to do something a little more challenging, so I decided to use machine learning to control the light.
The process flow of the light goes like this:
A USB camera mounted on the light sends images to a computer.
The computer is running a Python program that runs object detection on the images. Within this program, you can toggle the light on/off and you can tell the light whether or not to follow your hand.
If the hand-following mode is on, the computer sends instructions to the Arduino via the serial port.
The Arduino reads these instructions and moves the motors as needed.
Here is a simple diagram of the process:
I modeled the entire light in Rhinoceros 3D, and I made it using a combination of 3D printed parts and components I either bought online or already had at home.
Here are the final CAD drawings:
To drive the light, I used 2 28BYJ-48 stepper motors paired with ULN2003 driver boards.
One of the motors uses a belt-pulley system to control the arm of the light, and the other was reduced to a 1:3 gear ratio and controls the rotation.
The base of the light is a simple clamp mechanism that allows you to clamp it onto most tables:
This is the menu screen of the Python program:
Before running the program, you have to plug both the USB camera and the Arduino into the USB ports of your computer.
The Video Feed button toggles the video feed.
In the Arduino Port space, type the port your Arduino is plugged into. If you just want to test the object detection without an Arduino attached, leave it blank.
This is the program while running:
From here you can toggle the light on and off and tell the light whether or not to follow your hand. It also displays the frames per second, which can vary depending on the capabilities of your computer.