The time has come and I decided to surprise my girlfriend with a weekend in Prague during which I will ask her to marry me.
I wanted it to be special in my way. I’m Electrical Engineer and consider as a “Maker” so it must be involved with some electronics and building something!
I had few ideas, some involved with creating a custom PCB with LEDs flashing “Will You Marry Me”, but it was too simple and BORING!
I also like photography very much, and long exposures.
Then remembered that tutorial on Adafruit about light painting.
And then it hit me!
I will ask her to take a long exposure photo of me, and then I will do all the painting.
She won’t be able to see or understand what I’m doing until the long exposure will end.
Then, she will see “Will You Marry Me?” on the camera screen!
So how it works?
The camera’s sensor capture everything it “sees” while the shutter is open.
If you open the shutter for a long period of time, and your hands are not stable – you will get a blurry image.
The same principle is here; The camera will be stable on a tripod, but the object will be moving.
I will open the shutter for a very long time (about 15 seconds) and will start moving a light source.
The result will be that light source “smeared” on the photo.
Now imagine that the light source is a bar like in the picture, and I can change the colors very fast (about 60 changes per second)!
When I will move my hand while the shutter is opened, the camera’s sensor will “see” and capture all the changes of the light bar.
If I will sync my movement to the lights changing in the bar – I will be able to “paint” texts or even images.
It’s easiest to control such amount of leds (about 70) if they are addressable leds, so I used here 0.5m a of a WS2812B strip (I bought 1 meter of 144 pixels/meter).
In addition I will need a place to store our images. SD Card is very convenient for loading new photos so we will need a SD card adapter / module.
If I want to make it portable then we need a battery. Since I want to make it very portable, and 70 leds will consume a lot of current, I choose to use lipo batteries.
One 18650 battery will give me about 3.7v-4.2v, which is not enough to operate WS2812B which needs 5V, so two of them in series will give me about 7.4v-8.4v.
Now I need to regulate the voltage to 5V, so an adjustable 5A switching step down regulator will do the job here.
I will need a button to start the painting, a switch turn the device on and off, and a knob to change the speed or light intensity (I didn’t use that feature but there is a support for that).
For the knob I used 5k potentiometer.
To control the leds and the sd card reading, I will use a small Arduino pro mini clone. It’s small and it has enough power to drive the leds for this purpose.
|WS2812B 1M 144 leds||1|
|Protected 18650 2600mAh||2|
|Micro SD Card Module||1|
|470uf 16v Capacitor||1|
|7mm Push button||1|
|12mm Latching switch||1|
|5A XL4005 DC-DC Step Down||1|
|Arduino Pro Mini 5V 16MHZ||1|
If you need a charger for the 18650 battery, you can use the NITECORE D4 (it support more types of batteries like AA, AAA and more..)
I’m not the first one who build such a light painter.
I got this idea and based all this on this cool project I saw on Adafruit:
The general principle is the same, and I even used their code to run my bar (with few tiny changes), but I wanted a small and portable device.
The top and bottom orange parts are sliding into the black parts.
The tiny orange part is for the Arduino and sd card module from the other side.
The big orange part is for the battries and the voltage regulator.
The handle can be removed and the potentiometer hides there (I didn’t want to change it accidentally) .
On the right near the handle lays the button for easy press while holding the handle.
The bar is made from two parts because I can’t print it in once piece with my printer.
Here’s a photo of all the electronics and almost all the printed parts (did you notice what’s missing? )
I had a little space problem with the voltage regulator (it was too high), so I removed it’s potentiometer and replaced it with a small resistor to get about 5v.
From the datasheet I got the formula for Vout, and on the module I have R1 = 330 ohm, so I used 1.6k ohm resistor I had to get 4.84V which is still fine (above 4.5v is good).
Schematics for the entire light bar:
And this is what came up, exactly how I imagined it:
So I have a working led bar, I can change the colors but now is the hard part – the software.
I need a software to take a photo with a width 72 pixels (because I have 72 leds) and translate each row in the photo to commands for the leds.
(The text is inverted because the software assume that the pixels are connected from the bottom of the bar, and I connected them from the top)
Fortunately, this is what Adafruit did, and since I didn’t have much time for writing my own code – I used their’s this time:
So I need to find the correct pace, and keep moving smoothly at the same speed.
After few tries I found the golden ratio: 60 lines per second!
The second problem was a little minor, but I needed to know the limits inside the frame, so I wouldn’t go out.
This took some practice, but I counted steps from the camera and to the starting position and then I could estimate my limits.
SHE SAID YES
I designed the text I want to display.
I didn’t want to it be one long row with a tiny text, so I splited it to two rows.
The device thinks it’s one long row and keep displaying it.
In the middle of the image I created, I put a long black break. That brake signaled me that I need to lower the
lightbar and start going backwards (I also mirrored the text).
I asked her to take a photo (I changed all the camera parameters before), and then I started walking with the bar in my hand (sorry for the bad quality but you get the idea)
And this is the result of all the hard work:
Of course she said yes 😉