A Musical Charger, or Why Arduino Bugs Me

You know those fun little project ideas that pop into your mind out of nowhere, and are just so silly that you feel compelled to do them? Quick, easy, fun little silly things? I thought this project would be that. It seems I was mistaken.

My silly little idea was to take a phone or other battery charger, add an electronic brain and a buzzer, and have it play a little tune whenever it was plugged in. Simple, right? I’ve seen similar things in other projects, and I thought this would be a quick and easy weekend diversion. Well, I had to go and make it complicated. Because I was only playing a very simple tune on power-up, on one pin, a full Arduino seemed like massive overkill. For size, simplicity, learning something new, and the sheer stubbornness of using something that wasn’t an Arduino-loaded ATmega238p, I chose to put the program on an ATtiny85.

I bought the Tiny AVR Programmer from SparkFun Electronics, along with an ATtiny85 for the microcontroller. Step one was installing USBtinyISP and the relevant ATtiny files to enable the Arduino IDE to program the tiny85. That took enough troubleshooting when it didn’t work the first time that getting the programmer’s light to blink felt incredibly fulfilling.

Testing the blink sketch. The buzzer waits patiently nearby.

For the program, I thought I would take the lazy route. First, I modified the music code from Circuit #11 in the SparkFun Inventor’s Kit to play the tune I wanted. Hooray, that was easy! According to the Arduino IDE, the code size was plenty small enough to fit on the ATtiny85. So, I found the pin assignments for the ATtiny85, hooked things up via the programmer (that’s a really handy feature) and tried uploading the code. Instead of music, I got a bunch of strange clicks.

Several hours of research and I think (or maybe guess) that it’s a library issue. I’ve tried adding things, checking code, and I’m down to *shrug*. Which brings me to my first gripe about Arduino.

Arduino, at least in my experience, is marketed as both beginner-friendly and powerful, both of which are true. However, the step between the “it just works” stage of absolute beginner-dom and “I know everything” expert is where I am, the “So how does it do that?” kind of point. But the dirty details are so neatly hidden that one can start digging and immediately encounter so many technical details without explanation that it’s overwhelming. Simply put, I have not found help for the middle-ground people. When I have asked for help from the Arduino experts, I get brushed off or blasted with such detail that my eyes glaze over. Which leads to my second gripe:

The fandom.

Yes, a microcontroller can have a fandom, and Arduino’s is along the rabid fanboy type. As the saying goes, “When all you have is a hammer, everything looks like a nail.” And for Arduino fans, everything looks like it needs an Arduino. Why bother with another microcontroller, a full computer, a basic circuit, or math when you could program everything in one familiar environment? Why bother with a screwdriver or a bulldozer when you have a hammer? Suggest this to most Arduino fans and you’ll be labelled a heretic.

Anyway, the musical charger is still a work in progress. I guess I will use an Arduino to keep things simple. It’s not what I wanted, but I know it will work. Which, I guess, is why so many stick with Arduino in the first place.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s