Final Project Idea & First Prototype
For my final project with Arduino, I wanted to explore the idea of technology as magic. This isn’t a new idea, and Virilio talks about it in Vision Machine when he discusses travellers in the past impressing others with technological marvels that were seen as magic. Recently I have been looking at a lot of the hard parts of technology, privacy, data-tracking, data-mining, digital identities, artificiality etc. etc. etc. So for this project I wanted to return to the roots of why I love technology so much, its ability to help you create amazing, wonderful, magical things!
For my final I wanted to recreate something mythical/magical from popular culture using Arduino. I was first inspired to do this after watching this AMAZING video of Thor’s hammer using Arduino, electromagnets, and a fingerprint sensor. (check it out!!!)
I also found an AMAZING treasure chest that someone built for their kids!
I wanted to do something similar to this, but because I’m more of a video game nerd than a comics nerd, I decided that I wanted to replicate either (first level goal) a treasure chest from Zelda or (second level goal) the sword of time/Excalibur. Basically, I want to control an electromagnet one way or another to keep a lock closed, either a latch lock or something that would hold a sword.
At first, I thought I would build my own electromagnet, and then I got a little nervous I was going to electrocute myself. However when looking up how to make one, I saw a video of people hacking into an electromagnetic lock they bought from the store, controlling it using commands from their computer (also a wireless Xigby model).
From this video I was inspired to order my own electromagnetic locks off of eBay, both the kind they had in this video (which intimidated me a little) and a smaller one similar to one I saw featured on Adafruit – which provides some tips for use.
However, the big problem I had with these locks was how to power them. I’m not really an expert on Arduino, and I knew that they needed at least 12v to run, while my board only provides 5v max. So I knew I had to run them from an external power supply, but somehow not fry my board. Great….
Luckily I came across a great Instructables on Powering a Solenoid (that is what these locks are) that really taught me about how the current works and what needs to go where so as to make sure you are controlling the current – it turns out that it converts it to heat, ouch burns from the transistor!!!
I had already ordered a switching power supply from Adafruit as per their example but turns out I just need 2 9v batteries wired in a series, which I also learned how to do on Instructables…
So with all of this in mind, and 2 tutorials to kind of pull together into my own thing, I felt confident to try it – and hopefully not fry my board!
The basics of this is that you wire in the batteries to get a max voltage of 18v, plenty enough to power the lock. You then wire in a ground to your board, and a wire to pin 13, which will be used to control the lock. Then you connect the lock, but you have to use a transistor, a diode, and a resistor to get the current right so you don’t fry your Arduino board. I learned that the transistor 3 legs(from left to right) are B, C, E: Base, Collector, Emitter. I had to connect the output pin 13 to the base leg, using a 1k resistor to balance out the current. Then I connected the Emitter leg to the ground channel of the circuit. Finally, I connected the Base leg (middle leg) to the ground leg of the solenoid lock, and the power leg of the solenoid lock to the power that is running the battery.
To finish off the circuit, I had to use a diode to prevent “kickback” voltage that occurs when you turn the lock off and have extra stored current. This prevents the kickback voltage from damaging the circuit. The only thing I got wrong at first is putting the diode the wrong way, since it is polarized and its orientation actually matters.
That’s it! According to the instructable, I ran the blink sketch with both of the locks I have just to see if they are working.
After getting the blink sketch to work on both motors – hooray! – I needed to try controlling the locks more directly, since this will be how I control either of them for my final. I took a look at the code from the first video above, and found they were sending simple keyboard commands to their lock to get it to switch to high and low, so I decided to get that working for now as a placeholder – sensor values can easily be replaced for these later.
Here is a link to the code on my GitHub.
- Build an awesome container for one of these locks to go on
- Decide on which sensor will open the lock. Maybe an RFID if I can get one up and running!!!