Using 10-position rotary switch to switch MP3

Hi all,

I am new to arduino but have an okay technical background, yet I am struggling to make my project work. Even though it has been a lot of fun playing around with my Sparkfun Inventors Kit (SIK) and going through the examples, my struggle is putting everything together for the project that is the reason I started down this path.

Basically I am trying to make my own Roman Retro Action Musical box, see amazon link here, and I want there to be a power push button that turns everything on, which includes green and red LED lights + christmas songs + rotating platform, and then 2 knobs to control the music, one that is a 10 position rotary switch (already purchased) that would switch songs on position 1-9, and have no music on position 10 (because always having the music on would be annoying, it might be nice to just have lights and rotating platform), and one knob that controls volume of the music (I have not purchased that knob yet).

Here are the parts I have:
Sparkfun Inventors Kit
MP3 Player Shield with SD card and 9 songs loaded onto it
Rotary Switch - 10 Position with Sparkfun Rotary Switch Breakout to switch songs

Parts I probably still need:
Volume knob (potentiometer?)
amp breakout

I have read several guides and tutorials that seem to similar to what I am trying to accomplish in part, but nothing is exactly the same and thus my struggle to put everything together. Some of the examples in the SIK also touch on the basics of what I am trying to do, but am still a little lost.

Can anyone in hear help guide me in the right direction? In both the arduino code and the physical setup of all the circuits/components. Any help would be appreciated. Thanks!

Is your question about the switch? Use a [u]if-statements[/u] or [u]Switch/Case[/u] to do something "different' depending on the switch setting. (Conditional execution/branching is one of the two most important programming concepts. The other one is looping.)

Rotary Switch - 10 Position with Sparkfun Rotary Switch Breakout to switch songs

Is that a switch with 11 contacts, or a [u]BCD switch[/u] with fewer pins and "encoded" output?

...If it's a BCD switch, you'll have to combine 4 input "bits" to make a byte in order to make a song-selection decision.

Volume knob (potentiometer?)

Make sure to get an [u]audio taper[/u] pot because our ears are not linear and a regular linear pot will be way too loud at the half-way point and it will be hard to adjust. And if it's stereo, you'll need a "stereo" dual pot.

Roman Retro Action Musical box

:smiley: :smiley: :smiley: Before I clicked the link, I thought it was some kind of music box from the Roman Empire! :smiley: :smiley: :smiley:


For now my main question is how to simply setup the switch so what it changes songs with every click. I will worry about getting the motor/lights/volume knob after I get that working.

Here is the switch I have:

and I have the following breakout:

but perhaps this breakout would be better suited?:

Here's a possibility you may not have considered: Instead of a 10-position switch and a volume knob you could merge both functions in a rotary encoder with integral pushbutton (representative sample).

You could use the button to toggle between select and volume functions. Just sayin'.

Thanks for the responses and the suggestion!

As of right now I am thinking about everything being separate because I am probably going to copy the old 1970's tube tv look, that would be a fun wood working project, and I will want seperate big clicky knobs to make it feel authentic, and a power button. I am not sure if the knobs in the roman retro action musical actually work or are just there for looks, but I want to copy that look. Also sort of like this:

Well, if the big UHF/VHF knobs can be just for show you could use the encoder idea with 70s appropriate knobs like the smaller three in your pic. A lot of sets from that era also had small doors hiding less frequently used controls like contrast/color/intensity. You could copy that and conceal the real controls behind a door.

Sounds like fun.

I think you should go for the Rotary Switch Potentiometer Breakout. It will be much simpler to wire that one up because only a single analog pin is needed. Just solder 9 1K resistors to the breakout board.

To interface that knob you need a chain of 1K resistors going from 5V to ground. Then you wire each node of this chain to one of your switch contacts, that includes the 5V and ground. Then you wire the common connector of your switch to an analogue input. In software you read the analogue input and you can work out the switch position from the number you read.

Very crude diagram drawn on my iPad

Very crude diagram drawn on my iPad

Thanks, Mike, that made me chuckle! You should not have drunk that entire bottle of gin first! Or were you being driven across a plowed field at the time?


is what you described basically the setup of the potentiometer breakout board?

here is the schemetics:

if so, I think I will just go ahead and buy that, the hookup guide seems like it may have some helpful information as well

Yes that is what I attempted to draw, although buying one seems a bit over the top nopine resistors will cost you less than £0.20.

No gin involved but first go with note pad app sat up in bed this morning.