After a long wait, I was recently informed that I took second place in the contest! I'm elated to know that someone else enjoyed the finished product.
To conclude my project log, I've written a couple questions for myself for debriefing purposes:
Where did I get stuck?Why?
I was at first stuck on what to make out of the materials given to me. This is definitely the product of my inexperience in electronics, as the project was a blind leap into hacking a pre-existing piece of hardware, and in tone generation through code.
Secondly, once I had an idea of what was possible given the hardware I was given, generating appropriate code for the Trinket threw me for a loop. I had very basic familiarity with the Arduino IDE, and should have done more investigation into micro controllers before I jumped and bought a Trinket. It may have been more appropriate for a first project to build an Atarti Punk Console or some such tone generator that didn't rely on a micro controller. I've since visited the APC as a project to establish more of a foundation in analogue synthesis & tone generation.
If presented with the a similar project/similar parameters in the future, how would I approach it differently?
Before I start buying parts, I need to have a better idea of what I'm going to end up making. I started with a nebulous goal, and experienced a prolonged and frustrating prototyping process. Before I start writing code, I need an outline of what I'd like to achieve, and check that my objectives are obtainable with the hardware I'm using. I didn't have a clue as to what materials I needed, or what the objective of my code was, so for a large part of the process, I was resigned to partially satisfactory prototypes, an abundance of erroneous material, and general confusion.
Now that I have one project under my belt, I plan on getting things working hypothetically on paper before I take a plunge into purchasing. More research next time. Overall, I'm satisfied with the difficult process, I learned a great deal because of it.
The project board, Trinket, and the slightly modified original circuitry all fit nicely inside the gutted body of the card reader.
The project box you see attached to the card reader with 4 wires contains a push button switch for input and a 9V battery that powers the Trinket. I made sure that the push button only triggers the song when the song isn't active using a boolean flag.
In addition to playing a song, the green LED light that formerly indicated a good card swipe now illuminates in time with the song. It is connected in parallel to the beeper.
Due to poor time management, I wasn't able to program a second song, but there is space on the Trinket to include at least one more tune.
The 'I can power the whole board with a Trinket' notion quickly faded when I realized that components on the card reader board were using enough of the power to silence some of the buzzer notes. The first idea I had was to cut the traces from the buzzer, but i discovered that the card reader board was 4 layers. In frustration, I sawed half of the board off. This, combined with I carrying Bruce Hall's method of note entry over into a slightly modified version of Dr. Leah Buechley's beep method, resulted in consistent output to the buzzer.
I then began fitting the new circuitry into the old enclosure.
After taking a second look at the Trinket, I realized that the Arduino Tone Library wasn't supported. "Oh well", I figured, "I'll have to write something myself." Not so. Bruce Hall has a great guide on making the Trinket into a tone generator.
Another look at the card reader convinces me that the Trinket will be able to power the whole board, and provide the needed architecture to determine whether or not a card is being swiped. For the purposes of the project, the contents of the card aren't important, just that the card is present and the music ought to start.
The project originated as a submission for a scholarship contest at the arts conservatory I attend. The department in charge of door access card readers offered a couple thousand dollars in scholarship money for students who re-purpose their old card readers into something else.
soon as I got the email announcing the contest, I signed up with the
intention of hacking the card reader into some kind of noise making
device. From experience on the front end, I knew that there was some
kind of buzzer or beeper that indicated whether the card swipe was
valid, invalid, or caused an error. There also exists 3 LEDs- green, red, and yellow on the reader that correspond to valid, invalid, or error-causing swipes.
After getting a confirmation
email that the supplies were waiting for me, The department in charge of
door access card readers and cards gave me 10 card readers and a funny
look when I asked for documentation.
I found some general installation documentation after a couple Google searches, but nothing in terms of schematics. Somewhat frustrated, I opened one of the card readers up and tried to understand how the circuit functioned. From reading the skeletal documentation, and from what I could discern, the card swipe data is converted by a surface mounted integrated circuit, sent to the controller for processing, and the response is sent back to the card reader to indicate whether the swipe was accepted or not. The buzzer beeps, one of the LEDs light, and if your swipe is valid, the magnetic lock on the door opens, allowing you access.
My original intention was to use all of the existing circuitry and modify the function. Considering that I was missing most of said circuitry without the controller, I decided to instead focus on adding a component that would circumvent the parts of the circuit I didn't understand and instead focus on the parts that were more easily accessible. To do this, I bought an Adafruit Trinket in the 5V flavor. I'm sure that there's a better way of controlling a buzzer and 3 LEDs than with a micro controller, but I have a small amount of experience with the Trinket, and I understand its capabilities well enough to make PWM and LEDs function. Further, the Trinket will allow me to neglect providing power to the entire card-reader apparatus, just the parts that are critical to the functions I intend to utilize. (I hesitate in trying to construct an apparatus that delivers the specified 6-26V DC at less that 100 mA.)