Arduino Drawbridge
This was a project I made for my school, the HKU. It is a simple drawbridge that can be lowered at the press if a button, and raised using rope.
Supplies
- Arduino UNO
- A breadboard / PCB Plate
- One (1) Button
- Either: One (1) Servo or One (1) Unipolar Stepper motor and One (1) U2004 Darlington Array
- One (1) 10k ohm Resistor
- Wires
- Soldering supplies (soldering iron, soldering tin)
- (If using Stepper motor) Battery
Concepting
The idea for this project was to create a more fun variation on a dice tower with some interactivity. You could throw in a dice into this miniature castle, then press a button to have a drawbridge lower, and then the dice would be kicked out from the inside. I went through many variations of possible designs, but eventually decided to simplify the project to simply making an interactive drawbridge that you could lower and raise.
My original plan was to use a stepper motor with a 3d printed wheel attached that could reel in and reel out a string to lower and raise the drawbridge. I went far enough to create the wheel, solder the stepper motor, and write the code for it, when my stepper motor stopped working for unknown reasons.
I pivoted my own project then to use a servo instead to lower the bridge, and have the user manually raise the bridge by pulling on a rope, as I felt that would still be a fun toy to play with. I have included instructions and details for both my original stepper-motor design as well as my final servo design here in this instructable.
The way this contraption works is very simple:
1- Press the button to lower the bridge
2- Press the button again to reset the lowering mechanism
3- Pull on the rope to raise the bridge again.
For the stepper motor version, you may simply press the button to lower the bridge, then press it again to raise it.
Wiring
This is the circuit of the servo version of the project. The stepper motor version is not included since Tinkercad does not include a stepper motor. For the stepper version, replace the servo with the stepper motor connected to a U2004 Darlington array, connecting it to pins 8, 9, 10, and 11. Note that though the 9V battery is optional for the servo design, it is mandatory for a stepper motor, as an Arduino Uno does not provide enough power for the stepper motor.
Code (Servo Version)
Code (Stepper Version)
Development Process
I first decided to start with soldering all the components, to avoid any late-stage soldering issues later on. I soldered the components to a PCB plate and to a shield that I could plug into my arduino, to avoid damaging my arduino if I made a mistake while soldering. Using a shield is optional, but a PCB plate is required to wire the Button, as it requires a resistor.
Then I had to make various components for the casing and the parts that I would need for the design. For the casing I made a wooden case using a laser cutter, with holes to fit the drawbridge and the button. The schematics I used for the laser cutter are included here.
For the drawbridge itself, I used a 3d-Printer to print a square piece with a rounded edge on one side. I included two small holes on the front to pass a string through them, and a hole on the side at the bottom, which is needed to pass a metal bar through to allow the drawbridge mobility. The 3d model I printed is included here. For the metal bar, I adquired it at the metal workshop in my school, but you can look for one at a hardware store.
Finally, for the stepper design, I printed a wheel piece that could attach to the stepper motor. It has a small hole through which you can put the string, wrapping it around the drawbridge and the wheel, and then glueing the hole to fix the string. The 3d model to print is included here. For the stepper design, an additional bar is needed inside the casing, to allow the rope to pass over it and act as a pulley. You can use a metal bar for this as well, but something simpler like a plastic straw will work as well.
It was during this development stage that I found out my stepper motor had stopped functioning, and thus switched to the servo approach, which is why my pictures show a design that includes both the servo and the stepper. I attached the servo on the side of the casing inside to push the drawbridge, then tied both ends of the drawbridge's string together and put them out of a hole at the top for the user to pull. That hole was originally intended for the button, but I used a different hole for it, one I intended first for dice back when I originally planned to make this project a dice tower.
End Result and Conclusion
Attached here is a film of the project in working.
Overall, I am satisfied to have completed this project, though I find it unfortunate it couldn't reach its full potential. I have yet to figure out what the cause was for the stepper motor malfunctioning, as it did work after soldering was done. I may have strained it too much or it may have been from transporting it. Either way, I will take care in future projects to have backups ready for such situations, and to check my supplies and components regularly to make sure everything is still functional.
The process of concepting the drawbridge and figuring out how it would physically work was a fun challenge, so I did enjoy working on the project. It went better than my previous, first Arduino project which was over ambitious and ended up breaking in the end. The main thing I learnt from this project was how to plan a realistic design, do the parts that are prone to errors (soldering) early, and prepare for unexpected problems and setbacks.