Main Content

Motivation
I’m planning to build my own home automation system with an ESP32 as the main microprocessor. So I was looking for a fun project to test it’s capabilities and to get to know it’s good and bad sides.

I bought my daughter an Etch A Sketch but it turned out she is too young to play with it and I’m myself really bad in controlling it. So my idea was that I could implement a joystick so my daughter could play with it easily.

I found some builds what have done this already. So I needed to add something extra to make it special. I was already planning to use a camera for the home automation so naturally I want to play around with that too.

So the “etch a selfie” idea was born.

In the end it turned out it was harder to implement than expected. But don’t worry it’s working and you can use my firmware and I designed the PCB in a way that it should be really easy to solder even for a beginners :-)

How does it work?
First we need something to control the stepper motors. For that I use grbl. The ESP32 has a real time operating system. So it’s possible to run grbl in the background. It needed a lot of modifications but in the end it’s working.

Then we need to take a picture. That’s easy. There is a library for that and it’s working fine

So now we get a colored image. Not usable for etching. We can only etch (black) or not etch (white). We need a way to convert the colored image into a black and white image. One idea is to use an edge detection algorithm. But this doesn’t look very pretty…

I found an algorithm called XDOG (eXtended difference-of-Gaussians compendium including advanced image stylization) this makes really good results. But it’s a challenge to run this on a microcontroller.

To reduce development time I made a feasibility test in JavaScript. There I tried to implement XDOG with the limitations of the ESP32 in mind. This worked in the end and is somehow fast enough. I hosted the results here.

Next problem is we cannot stop etching and start somewhere else. So everything needs to be connected. The connection lines can look ugly. So we need a way to use as few and and as short lines as possible.

I also implemented a test algorithm in JavaScript to see if it’s possible to do that. My best solution is still very slow O(n^4). If someone has a more efficient algorithm be my guest. With a lot of optimisations it is not too bad. But in worst case scenario it can take a while to process ….

Last step is to etch everything. This is not so hard to do. Just find the longest line to etch, etch it and search for the next on. Here we could also implement something more advanced. Like finding cycles and etch cycles. This may look better in the end result. But for me just simple lines work fine.

Etch A Sketch Version
There are a lot of different versions of the “Etch A Sketch” out there. So we need to measure its properties to order the right parts! You can order this on. The knobs have a distance of 180mm and a diameter of 6mm.

Step 0.1
Remove the knobs from the “Etch A Sketch”. Mine were glued. So they were nearly impossible to remove. I used scissors and a lot of force to remove them.

Warning: Be careful. Don’t hurt yourself. I assume no liability for any damage.

Nevertheless it’s constructed in a way that you later can attach them again without gluing.

Step 0.2
Measure the distance between the knobs and its diameter. Depending on its values you have to order different parts.

PCB
To make the life easier for you I designed a PCB. It’s used to mount the motors and all electronic components. So you do not need to do woodwork and wiring yourself.

The only problem is you have to order it. I can recommend JLCPCB (not sponsored) they are the cheapest for the dimensions used but you can use any other manufacturer. Just download the gerber files depending on your distance and send it to the manufacturer.

Tools
To assemble everything you need the following tools:

soldering iron
wire cutter
screwdriver cross and smale straight
smale hex key
some tweezers
USB to serial adapter (this one is recommended)
multimeter to measure voltages unter 20V
superglue
Order
I have some PCBs left to ship. But international shipping is expensive. So I was thinking if enough of you want to order a kit from me, I can make lager orders and so we all save on the shipping cost and I can get some coffee as well. I will not include the “Etch A Sketch” because it’s expensive in europe :-(

Send me an email if you are interested: etchaselfie@im-pro.at but it can take up to one month to process.

Supplies:
1 Etch-A-Sketch Classic_
_1
PCB form JLCPCB

1 ESP32-CAM - A.I. Thinker_
_1
LM2596S 3A Step-down DC-DC

1 1.3 Inch OLED LCD Display_
_1
MPU-6050 3 Axis Gyro and Acc

1 PS2 Game Joystick Module_
_1
ADS1115 ADC 4 Channel

1 DC Jack 5.5x2.1mm_
_2
5mm to 6mm Coupling for 6mm diameter OR 5mm to 5mm Coupling for 5mm diameter

2 Stepstick DRV8825 Stepper Driver_
_2
HANPOSE 17HS2408 28mm Nema 17 Stepper Motor

1 100-240V to 12V 2A Power Supply_
_1
Single Row Male Pin Header

3 4k7 Ohm Resistor 1/4W_
_4
M3 screw 8mm length

2 Cork Gasket (Optional)_
_2
100µF 35V Capacitor E2,5-6 (Optional)

All together should be under 100$.

The build time is around 1 to 2 hours.”

Link to article