查看“Microduino Intelligent Music Box”的源代码
←
Microduino Intelligent Music Box
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{| style="width: 800px;" |- | ==Outline== *Project: Microduino smart music box *Purpose: You can build a smart music box with Microduino modules, playing music via iPodtouch as well as setting alarm clock. *Difficulty: High *Time-consuming: Four-hour *Maker: Microduino Studio-YLB&&Microduino Studio-PKj ==Bill of Material== *Microduino Equipment {|class="wikitable" |- |Module||Number||Function |- |[[Microduino-Core+]]||1||Core board |- |[[Microduino-USBTTL]] ||1||Program download |- |[[Microduino-Audio]] ||1||Music storage |- |[[Microduino-Amplifier]] ||1||Function |- |[[Microduino-RTC]] ||1||Time |- |[[Microduino-BT]] ||1||Bluetooth transmission data |- |[[Microduino-OLED]] ||1||Display |- |[[Microduino-Duo-v]] ||1||Extension for lower height |} *Other Equipment {|class="wikitable" |- |USB cable||1||Connection |- |Loudspeaker||2|| |- |iPodtouch packing box||1||Frame |- |Knife||1||Cutting |- |Glue gun||1||Fixing |} [[File: Intelligent_music.jpg|800px|center|thumb]] ==Document== [[https://github.com/Microduino/Microduino_Tutorials/tree/master/Microduino_Advanced_Tutorial/Microduino_Audio_ble Microduino_Audio_ble]] ==Buildup== ===iPodtouch Package Change=== *Step 1: Make sure the size of OLED and cut a hole on the paper of the panel with a size same as the OLED. [[File: iPodtouch_steup-1.jpg|600px|center|thumb]] *Step 2: Fixate OLED on the panel [[File: iPodtouch_steup-2.jpg|600px|center|thumb]] *Step 3: Make holes for the operation of USB power supply, music change and button control. [[File: iPodtouch_steup-3.jpg|600px|center|thumb]] ===Overall Buildup=== *Step 1: Fixate Microduino-DUO-V and two loudspeakers at the bottom of the box. Make sure the USB interface on DUO-V facing the front opening of iPodtouch. Meantime, Connect DUO-V and OLED with a 4pin connector. [[File: iPodtouch_Module_steup-1.jpg|600px|center|thumb]] *Step 2: Put the storage card on Audio-KEY-SD [[File: iPodtouch_Module_steup-2.jpg|600px|center|thumb]] *Step 3: Stack Microduino-Audio on the music box by facing the side with a hole. [[File: iPodtouch_Module_steup-3.jpg|600px|center|thumb]] *Step 4: Download program for the core board by stacking core+ and USBTTL. [[File: iPodtouch_Module_steup-4.jpg|600px|center|thumb]] *Step 5: Download all the libraries and programs needed, put the libraries in the library folder of Arduino IDE. If have no Microduino IDE, please refer to: [[Microduino Getting start]] *Step 6: Re-open Arduino IDE, open the downloaded program, select the right board after compiling and download again. (“Ctrl+U” for program download.) *Step 7: After the download, you can get rid of USBTTL and stack Core+, RTC and BT modules together. [[File: iPodtouch_Module_steup-5.jpg|600px|center|thumb]] *After that, put the whole stacked boards into the box. [[File: iPodtouch_Module_steup-6.jpg|600px|center|thumb]] *Step 8: Next, wield the two loudspeakers to Microduino-Amplifier through wire and then stack the system on the side with Audio module. [[File: iPodtouch_Module_steup-7.jpg|600px|center|thumb]] *Step 9: Connect DUO-V and OLED. [[File: iPodtouch_Module_steup-8.jpg|800px|center|thumb]] *At last, close the box and get ready to test. [[File: iPodtouch_Module_steup-9.jpg|600px|center|thumb]] ==Copy Music== *Step 1: Connect Audio and your computer with a USB cable and you can see a new disk. The disk can be treated as a memory card you install on Audio-KEY-SD and Audio is like a card reader. [[File: music_steup-1.jpg|600px|center|thumb]] *Step 2: Create a new folder in the disk and name it as “01” and then cope music to it. (From 001-099, you can save 99 pieces of music in one folder.) [[File: music_steup-2.jpg|600px|center|thumb]] ==Power-on Test== ===Dial Wheel Key Control=== Dial wheel key has three functions: Regulate upwards, downwards and press down, just like an old MP3. We can select corresponding menu by regulating upwards and downwards and then confirm by pressing down. *Step 1: In the power-on state, the default display includes logo, time and alarm clock. [[File: Audio-KEY-SD_ctrl -1.jpg|600px|center|thumb]] *Step 2: If the time goes wrong, please enter “Set Clock” and set the right time. [[File: Audio-KEY-SD_ ctrl -2.jpg|600px|center|thumb]] [[File: Audio-KEY-SD_ ctrl -3.jpg|600px|center|thumb]] *Step 3: Play music, enter “Set Tone” and play music. There are ten pieces of music by default. Users can change according to personal needs. [[File: Audio-KEY-SD_ ctrl -4.jpg|600px|center|thumb]] *Step 4: Enter “Set Alarm”, you can set the alarm. [[File: Audio-KEY-SD_ ctrl -5.jpg|600px|center|thumb]] *Step 5: You can set font size by entering “System”. [[File: Audio-KEY-SD_ ctrl -6.jpg|600px|center|thumb]] ===iPodtouch Control=== *Step 1: Prepare an iphone device and LightBlue downloaded in App store. Step 2: Set IOS device and start IOS device’s Bluetooth function. Step 3: Open LightBlue and find “Microduino” in “Peripherals Nearby” and click to connect. [[File:ble-Connection- Microduino.png|300px|center|thumb]] [[File:ble-Connection-new.png|300px|center|thumb]] Step 4: LED indicator blinks 100ms every 5s after successful connection and meantime, you can see that on IOS. Slide to the bottom, and select “Characteristic 6”. [[File:ble- Characteristic-0.png|300px|center|thumb]] [[File:ble- Characteristic.png|300px|center|thumb]] Step 6: Click “HEX” on the top right and select “UTF-8 String”. [[File:ble- HEX.png|300px|center|thumb]] [[File:ble- UTF-8 String.png|300px|center|thumb]] Step 7: Select “Write new value”, input data you want to send and then choose “Done”/ [[File:ble- Write.png|300px|center|thumb]] [[File:ble- Write-1.png|300px|center|thumb]] [[File:ble-Write-1.png|300px|center|thumb]] ==Program Description== *Bluetooth control instruction iPodtouch and BT module transmit data through ble protocol. In the main program, Core+ receives data from Bluetooth and process through analysis and gives different commands to Audio module. <source lang="cpp"> while (mySerial.available() > 0) //Judge if there is serial port input { comdata += char(mySerial.read()); //Read character delay(2); //Wait for serial port cache } if(comdata=="play") audio_play(); else if(comdata=="stop") audio_pause(); else if(comdata=="up") audio_up(); else if(comdata=="down") audio_down(); else if(comdata=="vol+") audio_vol_up(); else if(comdata=="vol-") audio_vol_down(); comdata = ""; </source> *Dial wheel key detection Key detection adopts analog value to judge. Since the return values of up- and down-regulation as well as pressing down, we can tell the state from the value and execute accordingly. <source lang="cpp"> 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_SELECT; else uiKeyCodeFirst = KEY_NONE; </source> ==Note== *Users need to install Microduino hardware support package. If not, you can refer to: [[Microduino Getting start]] *Microduino-Audio consists of two boards—one is cpu for music play, the other is dial wheel key with memory card base for music storage and simple control. *Here, phone control only adopts IOS device to debug. You also need IOS device capable of support Bluetooth 4.0. (iPhone4s and higher, iPod touch 5 and higher, iPad 3 and higher, iPad mini and higher) If adopting Android device to debug, the system needs to be 4.3 or higher so that it can be communicated with BT module. You also need to download serial port communication assistant to ==Video== http://v.youku.com/v_show/id_XODM1MDIxMDg4.html |}
返回至
Microduino Intelligent Music Box
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
Welcome
首页
创客大赛
大赛详情
3D打印
安装月球车
图形化编程
操控月球车
升级月球车
编程工具下载
软件下载
Arduino
Processing
Mixly
Scratch
模块套件
Microduino 102
mCookie 102
mCookie 202
mCookie 302
IBC
其他
应用套件
四轴飞行器
平衡车
小车CUBE
音乐播放器
刷卡音乐播放器
wifi气象站
彩虹音乐触摸灯
分贝检测仪
迎门汇报
LED点阵时钟
LED点阵屏幕
硬件
mCookie
Sensor
Microduino
MicroWrt
MicroNux
MicroRobot-Core
MicroRobot-CoreESP
ideaBoard
ideaBox
MicroMV
MicroAI
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息