This is part of an on-going series of posts about littleBits projects. littleBits is available in the Adafruit store – Starter Kit, Extended Kit, Deluxe Kit, Synth Kit, Arduino Module, and Arduino Starter Bundle.
How it Works
To select which song you would like to play, just insert one of the 4 song cartridges into a slot on top of the box. Embedded in each cartridge is a light filter with a different opacity. Inserting the cartridge triggers an LED to shine light through the filter and onto a light sensor. The Arduino reads the light value from the light sensor and determines which song cartridge was inserted.
The left side of the diagram shows the song cartridge card reader, and on the right, are the audio controls and the speaker. The envelope and delay knobs can be adjusted change how the music sounds.
The housing for the jukebox was made with laser cut cherry wood and MDF. Find the template files on the littleBits project page.
For the song cards, we experimented with translucent materials in our shop, including regular printer paper and the silver anti-static bags that our modules ship in. The important part was to make sure that each card had a different level of translucency.
The Arduino Sketch
Check out the sketch here. The code is programmed to play 4 different songs that correspond to four different analog input values (from the light sensor). To create the songs, this sketch uses the pitches.h library. The individual notes for each song are stored in an array called melody. The durations for each note (i.e. quarter note, half note, etc…) are stored in an array called noteDurations. A value of 8 produces an eighth note, a value of 4 produces a quarter note, and so on. Interested in translating sheet music into values like we did in sketch? Check out this great tutorial from GarageLab.
Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.
Join us every Wednesday night at 8pm ET for Ask an Engineer!
Learn resistor values with Mho’s Resistance or get the best electronics calculator for engineers “Circuit Playground” – Adafruit’s Apps!
Maker Business — Transforming Today’s Bad Jobs into Tomorrow’s Good Jobs
Wearables — Snap a picture
Electronics — To Y5V or not to Y5V?
Biohacking — Ticks are Spreading an Allergy to Meat
No comments yet.
Sorry, the comment form is closed at this time.