- Project Name: Microduino intelligent music box
- Objective: through the Microduino module, to build an intelligent music box, control to play music by ipodtouch, also set the alarm clock. The shell is made of iPodtouch packing box, but also can be controlled by a dial wheel button.
- Difficulty: Senior
- Time: 4 hours
- Maker：Microduino Studio-YLB&&Microduino Studio-PKj
Bill of materials
IPodtouch packing box refitting
- Step one: make sure the size of OLED, in the panel on white paper cut out screen like the size of the screen hole, exposed to see.
- Step two: Make OLED fixed on the panel
- use knife cut out a hole, according to the hardware needs to use the USB power supply, the replacement of the song, the dial wheel button control.
The whole assembly
- Fist step: First to make the Microduino-Duo-V and the two loudspeaker is fixed at the bottom of the box, make sure side of USB interface on the Duo-V towards iPodtouch opening, because of the need to supply. At the same time in the general Microduino-Duo-V interface with OLED adapter cable 4Pin out.
- Step two: make the memory card into the Audio-KEY-SD module.
- Step three: make Microduino-Audio Stack on one side has opened hole, if it is found that the size of the hole is not appropriate, you need to modify it.
- Step four: you need to download code to the core module, and stack USBTTL and Core+ together.
- Step five: down load libraries and code, then put library file to the Arduino IDE libraries folder inside. If you haven’t set up Microduino development environment, please refer to:Microduino Getting start/zh
- Step six: re open Arduino IDE, open the download program, compiled by the choice of a right board , can also use the shortcut “ Ctrl+U” download.
- Step seven: After finish download code, you don’t need USBTTL module, and then Core+, RTC, BT module stacking together.
- After stack all module together, put it into the box.
- Step eight: then you need put two speaker welding on the Amplifier module through a wire, and then stacke on the side of the Audio mocule.
- Step nine: Link the base plate of the Duo-V interface and OLED together
- Finally, cover the box, ready to test.
- Step 1: use the USB data cable connect Audio module of USB interface and the computer, a new disk can be found in your computer, the disk that you installed on a Audio-KEY-SD memory card, Audio module at the equivalent of a U disk.
- Step two: create a new folder on disk, and named the 01, then copied all songs to the folder, renamed: 001-099, a folder can max save the 99 songs.
The dial wheel button control
The dial wheel button has three functions, to increase, to decrease and press down, just like the old tpye MP3 player. We select the corresponding menu by pressing down and up.
- Step one: Power on default display logo, time, alarm clock, alarm clock open state, and opening time.
- Step two: if the time is wrong, set the time used to enter the Set clock, including the date and time.
- Step two: playing music, into Set tone to playing songs, programmed set 10 songs, the user can make it changes.
- Step three: set the alarm, enter the Set alarm setting the alarm clock is opened or not, and the alarm time.
- Step four: enter the System can be set to display font size, a total of three level(0-2), and it can control sound volume form 1~30.
- Step one: prepare a iPhone device, go to App store download LightBlue
Step three: begin to set up the IOS equipment, enable Bluetooth function;
Step four: open the LightBlue, in the “ Peripherals Nearbyl” found &ldquo tab Microduino&rdquo, click start connection;
Step five: connect the successful LED indicator light every 5 seconds duration 100 milliseconds, you can see the connection state on ISO, and then slipped the bottom, select “Characteristic 6”；
Step six: click on the upper right corner of the “HEX”，select “UTF-8 String”；
Step seven: Select “Write new value”，Input the send data you want, and then select “Done”
- play music ：play
- Pause music：stop
- previous sound：up
- next sound：down
- volume up：vol+
- volume down：vol-
- Bluetooth control instruction
IPodtouch and Bluetooth module through the ble protocol stack for wireless transmission of data, in the main program, the core of the Core+ received from the Bluetooth transmission over the data, through the analysis and processing, and control Audio module implement different commands to control the pause, play and other functions.
while (mySerial.available() > 0) //whether serial input
delay(2); //Wait for the serial buffer
comdata += char(mySerial.read()); //Read characters
comdata = “”;
- The dial wheel key detection
Key detection is used to be judge by the value of simulation, up-regulated, down regulated, press the return value is not the same, through this value, we know which state, according to the state of implementation of the corresponding action.
if (analogRead(A6)>300 && analogRead(A6)<400)
uiKeyCodeFirst = KEY_NEXT;
else if (analogRead(A6)>200 && analogRead(A6)<300)
uiKeyCodeFirst = KEY_PREV;
else if (analogRead(A6)<100)
uiKeyCodeFirst = KEY_NONE;
uiKeyCodeFirst = KEY_SELECT;
Pay attention to the problem
- Users need to install Microduino Hardware support package，If not please refer to：Microduino Getting start/zh
- The Audio module is composed of two boards, one is the core with the processor to play music, a dial wheel buttons plus the memory card base, used to store music files and simple control.
- In this case mobile phone control only debugging by IOS equipment, also need to be able to support 4 Bluetooth IOS device (over iPhone4s above, iPod touch 5, iPad 3 or above, more than iPad mini); if you use the Android equipment debugging, system can only communication with BT module above 4.3 version, and need to download to debug serial communication assistant.
Display video in Chinese: