This might be one of my weirdest projects yet :-)
But even if you are not interested in keeping burglars away, this project can be used for anything where you need to drive a steppermotor or servo motor, or even several DC motors with an Attiny13.
Most of you will remember the movie Home Alone, where McCauly Calkin tries to pretend to the burglars that in fact he is not home alone, by putting a cardboard figure on a record player and putting strings on another cardboard figure so he can imitate people dancing.
As I am away from home often, I am very conscious about leaving my house behind as if it is still occupied.
For that I earlier published an 'At home simulator' that switches lights in a specific pattern with enough randomness to make it look like someone is present. I added a 'Fake TV' that makes it look like there is a TV playing.
All these things help, but if it comes to simulating presence there is nothing better than actual movement. So I needed something that moved and as I do not have a record player and wanted something that could operate while I was away, I needed something a bit more solid state.
The most obvious way to have a cardboard figure create impression of movement would be to turn it 90 degrees so it would alternately block light and not block light.
I first did that with a cheap servo but that gave two problems: It was hard to add a cardboard figure even a not too big one, to the axle and once I did, the drag would just be too much for that servo. A more powerful servo had a very steep price rise so I started to think 'Steppermotor'. I still had one that was heavy due to the heatsink attached to it so that seemed ideal.
A program to turn the Steppermotor was easily written on an Arduino, but drag was still causing a bit of a problem as my cardboard figure had the size of a human torso (about 80 cm long). I either had to reinforce the cardboard, making it heavier, or I had to make it smaller. The latter seemed to be the best solution as I could just put it closer to a light.
All that time I had also been playing with the thought to have a figure stand up. Motors, pulleys etc crossed my mind and though I have not completely given up that idea, for now I just decided to add a small feature to the cardboard figure and that was a moving head.
My idea was to have the figure turn 90 degrees, so it would cast a full shadow, and then have it nod its head. and that is where my servo came in again.
I actually didnt want to sacrifice an entire arduino just to turn a cardboard figure. On the contary, I guessed an Attiny13 that I had laying around could do the job just as well: 4 pins for the stepper, 1 pin for the servo. that is exactly what an Attiny13 has to offer.
I admitt that sometiems I can be very dense coz I thought of all kind of scenarios of how to operate the contarption to work at a specific time, for a specific time because ideally I wanted to control it from the 'At home simulator' I mentioned earlier. So I thought about a wire, or wireless, but then the Attin13 wasnt the best idea coz that has a problem with Manchestercode and I needed a pin for the receiver and the sensitivity of those cheap receivers isnt that great. So I already thought about just a commercial timer switch, but then I realised I was being an idiot. As the thing would need its own PSU, why not take a wallwart and put that in a Remote Switch that I could already control from my At Home simulator.
So, I started building my final design.
A cheap Servo
A cardboard box
An 8 pins IC socket
A Piece of stripboard 9 strips of 17 holes
Some servo extension cords
A 16 pins IC socket
A 10 k resistor
A plastic cutting board (or some other piece of light material)
3 pin male header (for servo)
6 pin male header (for steppermotor)
duct tape (ofcourse)
A way to program the Attiny
Just a remark on the Steppermotor. I use an old 55SI-25DAWC, but if you still have to buy one there is a very cheap steppermotor/driver combo available: the 28BYJ-48. The motor itself costs 1.50 euro, but for 2 euro's you can get that same motor with a driver board. so that is a good deal
Step 1: 'Home Alone' Constructing the Cardboard Man
From a box I cut a piece of 40x20 cm and a piece of 18x18. I attached the two pieces together as a head and a torso, using duct tape, leaving a small gap between the two pieces, but covered by the duct tape, to form a hinge for the neck. (The pictures make this very clear)
From the old cutting board I cut a piece of 20 cm long, about half a cm thick (the thickness of the board) and about 1.5 cm wide. The 1.5 cm was enough to fit the axle of my stepper. if you have a different stepper, then make sure the piece you cut is wide enough for the axle of your stepper.
Drilled a hole dead center that would fit my axle.
then I glued the plastic to the base of the cardboard 'Torso'
Just under the 'neck', from pieces of cardboard I built up a holder for my servo. Ofcourse this can be done with an angle iron (or plastic), but that is a bit hard to attach to the cardboard torso, so I just used cardboard to fit the servo. I added an arm to the servo made out of an 11 x 0.6 x 0.6 piece of plastic from the cutting board and attached that to te Servo. Again, look at the pictures to see how this is done
Though my stepper was heavy enough to carry cardboard figure, the torque and the drag caused by it's turning would make the motor to start 'walking' around, so i created a base plate out of 24 * 11 cm of cutting board. I drilled two holes to attach the stepper motor and still have ample space for the controller.
Although the servo turns 180 degrees, i positioned the arm such that it doesnt put up the head completely straight. That way it easily falls back when the servo turns back to 0 position
Step 2: 'Home Alone' Constructing the Controller
The controller is An Attiny13, attached to a ULN2003. Though in my version I have used a bit more pins to make the board more flexible to use for other projects, the only headers you need are a 3 pin male servo header and a 6 pin male header for the stepper
Step 3: 'Home Alone': the Software
The above program shows how to drive my particular stepper and you may need to change the values being written to PORTB if you have anotehr stepper. As the Attiny13 is rather small in memory and also doesnt provide too many pins, the program misses some sophistication. Writing directly to PORTB is OK, but in this case it will also write a “0” to PB4 and PB5. PB5 is not much of a problem, but you may want to use PB4. In my case that is where I put my servo and that doesnt really cause a problem as I do not use them at the same time.
However, If you want to use another microcontroller such as a 328 and you want to avoid writing to PB4 and PB5 and PB6 and PB7, use a mask to only write to bit 0-3. The mask to do that is B00001111.
If you then want to set bits bits 0 and 2, go like this:
Instead of PORTB=5, state: PORTB=(PORTB &~mask) | (B00000101);
For those who find this too cryptic:
it first ANDs the value of PORTB with NOT mask and OR’s the result with the value we want to write and assigns that back to PORTB.
So, suppose PORTB= 00010000 and we want to write 00000101 to it, we cannot assign that immediately because that would clear PB4.
However, if we do as described, it becomes:
PORTB=(PORTB & 11110000) | 00000101
PORTB=(00010000 & 11110000) | 00000101
PORTB=00010000 | 00000101
We have written our value and kept PB4
So, why cant we immediately OR PORTB with the value we want in stead of AND-ing it first?
Well because that might keep PB4 and PB5… but it also keeps PB3-PB0 unchanged if one of them already contained a ‘1’
Of course inverting the mask wouldn’t be necessary if we would define it already inverted, but it is common practice to do it as such
Step 4: 'Home Alone' Burglar Deterrent: Use
watch the video to see it work (it got rotated -90 degrees, sorry for that)
The intention of this device is to throw moving shadows on the curtains or blinds. It therefore works best with light curtains. The device itself should not be visible from outside. Make sure it has a light source somewhere behind it.
I control it by sending an RF signal to the Remote Switch in the mains outlet that feeds the wallwart PSU for this device, but you could also use a timer.
Step 5: 'Home Alone' What Didn't Work.......
This video shows one of my earlier experiments with a larger torso and just a simple servo. Obviously not a good design