#ShareTheScare this Halloween

Visit our Halloween space and find out how to win one of two Cel Robox 3D Printers. There are two ways to win:

Share your Project and Win
#ShareTheScare Competition
The Ben Heck Show Episodes


Disclaimer: I’m an engineer, not a pro film maker. Be advised.

Disclaimer: I’m an engineer, not a pro film maker. Be advised.





Why are dolls so scary to me? They watch you. Follow you. Walk around at night. Always evil. Always!


My fear must stem from a movie I saw as a child called “Dolls.” It frightened me so bad, I literally could not sleep, not even in the day! No other film did that to me. The Chucky series, Goosebumps episodes with the ventriloquist puppet, none of these scared me as a kid. It was something about that movie, Dolls… fuel for nightmares.


I’m not the only one. Dolls of various types always freak people out. Just take that movie “Annabelle,” the prequels to “The Conjuring” horror film series. All of which feature the doll, Annabelle.


To be honest, every single scary doll in anyone’s house I know… has been thrown out, burned or buried. Thank goodness!


However, for this project, there was a doll shortage. Who knew I would need one of those hideous things one day?


I tried many antique shops. But very freaky doll they had cost a fortune! Wouldn’t that be a double smack? I buy a 200 dollar doll, and it comes to life to get me! Luckily, some local resale stores had a few options. I found this one below… not as scary as I wanted it though.


I wanted to animate a doll to look like something left by a child on a porch. As someone approaches, it would slowly stand up. Guaranteed to freak everyone out. I had a few ways to do this in mind, but I thought the simple puppet on a string should do the trick.


In this project, we are going to talk about two important skills to learn: One – Raspberry Pi stepper motor control. Two – making a Scary Doll move. For an added bonus, we’ll add some scary sounds to go along with the doll moving.





The dolls movement is controlled by a stepper motor hidden behind it. The doll’s head is attached to a clear fishing line, going up to a pulley where it is attached to the motor on the ground behind it. Turning the motor in different directions controls the movement of the doll up and down from lying to standing to floating.


When it comes to motion control of any type, especially at low speeds, stepper motors are the way to go. I know the doll isn’t all that heavy, but a stepper motor has the highest holding force of any motor type. So, accidental unwinding will not be an issue.


Also, it will help with situations where the doll stands up slowly.


Another useful feature of a stepper motor is you can keep track of how it turns. The stepper motor used for this project is 200 steps per revolution. So, let’s say it take the motor 10 full rotations to raise the doll – that is 2000 steps. I can just send the stepper driver 2000 steps to stand up, then 2000 steps in the other direction to lay back down.


I know some of you are worried about missing steps. That is definitely and issue if the stepper is under a load. If you take a look at my drink-mixing robot, the Drinkmotizer, missing steps what a major problem. Drinkmotizer featured a leadscrew that is considered a load on the motor. Plus it would get sticky from the beverage fluid dripping on the leadscrew. I would experience binding and missing steps too frequently.


However, with the Scary Doll, there is almost a zero load on the motor. The doll is only a few ounces after all. Unless someone pulls on the string holding the doll, then missing steps would not be a problem.


What would stop the stepper motor from spinning? How do you control the motion?


To do this, I wanted to set virtual limits in the software. Typically, CNC or motion control devices have physical limits. When a carriage reaches a certain point, it presses a button, and the software interprets that as a limit – stopping all motion in that direction. However, with the doll, I thought that might be too hard to implement. So, I would set limits virtually.


The user moves the doll to one point, presses a button to set a limit. Then to another point and presses a button for the second limit point. Then, the software would not allow the motor to turn outside those parameters. This way, you can create canned cycles that stay within a certain distance envelope.




Scary Doll

Fishing Line

1x Low current Stepper motor

Gecko 210X Stepper Controller

Raspberry Pi 3

Speakers with Audio Input

4x Momentary Push buttons

1x Full-size breadboard


Schematic and design:



The actual build, setup away from the doll.


Gecko stepper settings



Code - How the code works:


In the main loop, button presses are checked. When a movement button is pressed, a direction is set based on the corresponding button. The direction is either Clockwise or counterclockwise of the stepper motor. This is set by the direction pin of the Gecko stepper motor controller. From our Raspberry Pi, we use the GPIO to write the pin 0 or 1 corresponding to the direction. When the button is pressed, we jump into a routine called rampUP() which incrementally increases the speed of the stepper motor to its full speed that the user sets based on the time between pulses. This is to ensure smooth operation of the motor. Steppers do not like to go from 0 rpm to a fast speed without gradually accelerating to its set speed. If this is how it's controlled it will most likely stall. Low speeds can be started up without the need for ramping up. Voltage applied to the motor windings is also a factor. The Gecko 210X has a voltage input range of 18VDC to 80VDC.


The higher the voltage, the better the ability of the motor to achieve a higher speed without stalling. One of the first things to do when entering the rampUP() routine is to enable the driver, so we change the enable pin to a 1. We only want this enabled when the stepper is going to move or else the stepper will heat up unnecessarily when not moving. Before the motor moves, The music starts playing with a call to mpg123 library using os which is playing a mp3 in the same folder as the .py file. This plays out of the audio jack of the Raspberry pi, which you can hook up to a speaker with an AUX cable. The motor ramps up from a starting low pulse that decreases with time, so there are faster transitions between high and low pulses making the motor turn faster. The high pulse is a very short time which is static and does not change in the pulse. Controlling the speed with the time of the low portion of the pulse.


The number of steps is hard coated to reel the fishing line into a certain limit and let the line back out at the end to the same point it started at. Driving the motor one way a certain number of steps and reversing the motor direction the same number of steps. Which results in the doll moving up from a starting laid down position to a raised position back to a laid down position. The Doll pauses for 3 seconds standing or crawling. Moving the Doll across the floor then standing up required more fishing line to be let out on the pulley and setting the doll farther away from the fulcrum.  

-control of stepper, theory, concept

-how limits were handled

-how the sound was played



- Keeping the Fishing line wrapped around the shaft coupler and taught to the doll. Something like a fishing rod spool would probably solve this issue.

- Keeping the doll from spinning too much. It would rotate on the fishing line. The only way around this would be a two line system to prevent that.


Other uses of the system:

- Moving a doll isn’t the only option. You could lift much larger objects, skeletons and ghosts come to mind. Or something smaller like fake bugs.

- This tutorial shows you how to turn a stepper motor. Anything CNC is possible. Linear stages, CNC router, etc.


If I had more money/time:

- I would love to animate more of the doll or puppet. Almost like a marionette with no puppeteer. The almost natural movement of arms and such, I imagine, would be very creepy.

- Find a better, scarier, doll for the project.

-Film in front of a porch with people walking up