2015/09/13

Android control RGB LED using HC-05 Bluetooth module with Arduino (Part III) - Make A Night Lamp

It's been a while since I wrote the RGB LED tutorial on my blog. Not sure if you have done yours.

If you would like to learn the whole project from the scratch, please visit these two tutorial first.
- Tutorial 1
- Tutorial 2

Recently, I have found a night lamp laying around and we were not used it anymore. I thought, umm.. it might be a good idea to DIY RGB LED into this lamp. Let's get started!

This is what the lamp looks like below. It's powered up by a 9V/300mAh adapter. Since Arduino Mini Pro only take 5V or 3.3V, I had to replace a 5V/500mAh adapter from older 2G phones to use with this night lamp.
After I opened the light lamp, there was tiny PCB, few wires, and a very small lightbulb under the transparent cover. I removed most of stuff inside to make room for my Arduino board.














Since this is a night lamp, there is no need to let this lamp too bright. I decided to use 6 RGB LED to be the light source.  Please refer to my RGB LED tutorial 1 to see the how to wire up.
After soldered the LEDs, resistors, and wires, I cut down extra LED legs to ensure they could fit into the lamp.

There were only few things to solder on Arduino Mini Pro pins with RGB LED and signal wires.

HC-05 Bluetooth Module wiring as follow:

  • TX connect to Arduino Pin 11(RX)
  • RX connect to Arduino Pin 12(TX)
  • Remember to connect TX on the HC-05 to RX on the Arduino and RX on the HC-05 to TX on the Arduino, so Arduino can receive data correctly.
  • VCC connect to 5V power
  • GND connect to Ground
All parts were soldered together; including Arduino, wires, RGB LED.














Then, I attached HC-05 Bluetooh module on the the Arduino Mini Pro. 



** Remember to test it the whole thing to make sure it's working before you continue.**
I also cut the porto board in half to save more space below.














Look at the picture where I circled, I needed to keep the original connector to connect to Arduino Mini Pro, so the power plug can be inserted correctly into the lamp plug.















Here is the original PCB module come with the lamp. I just removed the connector with a plier instead of desoldering it.  Believe me, I did try to desolder the connector from the PCB and it was really difficult for me, even with a tiny tool that sucked the soldering away from PCB.


There is a battery compartment under this night lamp. So I decided to put HC-05 Bluetooth module into this compartment to save space.  By doing this, I had to insert 4 wires to go through the tiny hole in the center that was originally holding the light bulb. Since the thickness of the compartment door is quite thin, I could see the HC-05 Bluetooth LED indicator to see if it's connected or not! :)
** Fast flash: Not connected.
** Flash twice per 2 seconds: Connected.


After removed the light bulb, I was trying to find the perfect spot to place PCB and Arduino Mini Pro.  By the way...I almost forgot to solder the connector back to the power wires.

Now, it's time to put all components inside the lamp. I decided to use hot glue to place the PCB with RGB LED on the center and inserted Arduino Mini Pro next to the screw column.
Secure the connector with the original screws and a lot glue to keep them in place using a hot glue gun.
More hot glue to ensure the PCB and connector to fix and secure.


Power it up! Cool, it's working now! I modified Arduino programming a little bit to set my PCB to light up with Blue color as soon as it powered up.

Finally, I placed the cover back and tighten two screws and it's done!  This is my 2nd projects that really worked!

Now, I set next beside my children's bed to let him enjoy this magic night lamp and he loved it! :)

See the working video below:


END


Part III - Android HC-05 藍芽連線控制彩色 RGB LED: DIY 以手機控製夜燈

自從我把製作手機用藍芽搖控 RGB LED 彩色貼到部落格上,也有一段時間了。不知道你是否也依著步驟,DIY了你自己的呢?

如果你想要從頭開始的話呢,你可以先瀏覽前面兩篇來照著做,不會很困難的!
- Arduino + BT + RGB LED 教學 1
- Arduino + BT + RGB LED 教學 2

最近,發現有一個股東會贈品的小夜燈放在角落沾著灰塵,也很久沒使用了。心裡想著,那就把之前的東西塞到這個小夜燈裡,讓它可以像一個正常的夜燈使用,又可以用手機改變頻色,小朋友應該很喜歡!

我手上小夜燈看來如下圖,它是以一個 9V/300mA 變壓器來供電。不過Arduino Mini Pro 只能用 3.3V or 5V, 所以我找了一個早期2G手機用不到的5V/500mA 變壓器才取代。
打開小夜燈的上蓋,裡面的空間還算多,只有一片小小PCB, 幾條線和一個小燈泡。
看來要塞進去這個project全部的零件不是問題。














反正是個小夜燈,用不著太亮,所以我只用了6個RGB LED並聯在一起。
連接方法請參考 RGB LED 教學 1
把 LED, 電阻, 電線焊好後,再把過長的 LED 腳剪斷就行了。

為了方便參考, 這裡是連接的方法,唯一不同的是把 6 個 RGB LED 並聯就行了。

HC-05 Bluetooth Module wiring as follow:

  • TX connect to Arduino Pin 11(RX)
  • RX connect to Arduino Pin 12(TX)
  • Remember to connect TX on the HC-05 to RX on the Arduino and RX on the HC-05 to TX on the Arduino, so Arduino can receive data correctly.
  • VCC connect to 5V power
  • GND connect to Ground
接著把線路和 Arduino Mini Pro 焊上。














接下來,把 HC-05 籃芽模組也一起焊上。


** 別忘了先試試整個電路板都運作正常 **
洞洞板還蠻大一片的,所以把它剪一半掉以節省空間。














底下圈起來的是原先小夜燈用的連結座,我要把這個連結座拆下來,這樣搭配 5V/500mA的變壓器使用剛剛好。















這個是小夜燈上面拆下來的PCB,其實我要的只是那個連結器,其它用不到了。我試過用空空吸錫的小工具把連結器解銲下來。天啊,還真的不容易啦...那位高手再教一下吧!


小夜燈底下有個裝電池的空間(如下圖)。我把藍芽模組 HC-05 經由裝燈泡的洞穿過去,這樣可以節省一些空間。電池座的塑膠門剛好又非常的薄,所以可以這裡看到 HC-05 藍芽連接的燈號。
** 快速閃爍: Not connected.
** 每兩秒閃二之: Connected.


PCB, Arduino 放置的方式如下圖,PCB放在中間,而 Arduino Mini Pro 放在螺絲座的旁邊。

接下來把剛剛接下來的連結座給焊上去。
把連接器旁邊的小螺絲鎖緊,再用很多的熱熔膠把它們固定。
用更多的熱熔膠把 PCB+LED 固定在夜燈正中間。


插上電源試試! 把前面的教學程式稍作修改,該每次接上電源後,讓它點亮藍色的。

最後,把外蓋蓋回去,鎖上螺絲就完成了!這是我做 Arduino 以來的第二個作品可以用在生活中!

現在,我把這個小夜燈放在小孩的房間裡,讓他使用這個可以隨時心情改變顏色!

這是實際運作的影片!

完!

No comments:

Post a Comment