Digital and Analog
I like working through the labs a few times outside of class because even if I think I get it in theory, the repetition of physically putting it together (and breaking it…) helps me to fully understand. So I know I can set up an arduino to get readings from a potentiometer…
that I can translate that to the layout for a 2 pin sensor (add a resistor!)…
and that adding an LED to the mix to respond to those sensors requires an output pin and some code.
I still need to refer back to all of the pictures I take just to be sure I’m setting it up correctly, but I at least am starting to be able to do some of it from memory. And I’m having fun with this!
Now the reason this blog post is late on a Tuesday when I went through my labs at the end of last week is because of the application I chose to do….
I wanted to combine my Pcomp and Fabrication assignments and came up with the idea of making a lantern that responds to tapping. Depending on how hard you tap, the light will change colors. I figured out what sensor I needed (piezo) and started reading about RGB LEDs.
Problem number one – Tinkersphere isn’t open on Sunday. And walking into most electronics stores asking for parts got me some blank looks. Lesson learned; shop early.
My next problem was just getting the LED to even turn on, let alone be a specific color. But I’m pretty sure it was incorrect labeling to blame on this one (I’m also pretty sure that office hours are going to save me a lot this year). The package indicated a common anode LED but it only started working when we took what was apparently the cathode to ground. But at least my light could now turn on and I could manually set the color.
Now my actual time sink – getting my sensor to work. We could set it up to get readings but unfortunately it’s a little too sensitive and takes in ALL vibration. This is less than useful to me… Some threshold finagling was definitely required and this (along with figuring out a delay for those readings) is what actually took so long. Once I was getting some consistent readings, I taped the sensor onto a piece of my lantern and had to start the process all over again.
The wood completely changed the results I was getting and I had to adjust it AGAIN when I put it together completely. Finally I was working with the piezo taped inside the completed box and threaded out to the breadboard and Arduino. This was giving me something stable! So all I needed to do was move over my LED setup from before and connect the two through the code and some pins. It might look a mess but I promise theres a color coding system in there.
After adjusting tolerances over and over, this almost seemed like the easy part. The taps are still a little unstable but it responds! And I even managed to move everything to a tiny breadboard that actually fits inside of my lantern housing.
Everything is taped together so that I can continue to work on the circuit (you can see it minus all the tape here) but I’m pretty thrilled. I’d even written up a sad draft of this post all about how I couldn’t get this project to work and I’m pretty ok with having to rewrite it right now….