After I soldered all components on the perfboard, let's complete this project today! First, I need to find a way to provide power to our perfboard. Many people on the internet recommended to use a mobile phone charger instead of making one themselves due to safety concerns. So I got a spare HTC charger for my project as shown below.
Carefully cut the microUSB end and pelled the shielding off the cable. In there, you will be four wires with GREEN, WHITE, RED, BLACK. Solder the RED and BLACK to positive and negative on your perfboard.
After soldered the wires, plug charger and test your board to see if it's working.
My bedroom light looks like this below. It has a switch located at the entrance of the bedroom. The switch works like this. For every switch on/off, it cycles through 3 lights/off, 5 lights/off, 2 lights/off, night lights/off.
Carefully loosen the screen on the bottom and remove the decorative glass away.
Remove the center long screw as well as all light bulbs. Then remove two fixing screws on the light base set, but there are two more wires inside we need to take care!
Carefully remove the isolation tape and detach the 110v wires with a utility knife.
Tip: If you look at the photo below, I tight a red wire to the steel beam and the light frame. Therefore, you don't need hold the light frame and try to detach isolation tape at the same time. This save me a lot of effort.
Position the perfboard in an idea location without blocking the light bulbs from installing and removing later as well as avoid the screw's holes and wires.
Since there is limited space on the light frame, I placed the phone charger inside the light base and the perfboard outside the light base. Drill a hole on the light base to allow the USB charging cable to go through.
Place an isolation material between light base and perfboard (I found a piece of plastic from a cookie case) and tight them together with a cable tight.
Drill a hole on the light base and tight the perfboard and light base with a screw as shown below.
接線的方式如下圖，由天花板上的110V 正負極各接到手機的變壓器，它會提供5V電源給電路板。另外110V負極再接到燈座本身，正極接到電路板的繼電器模組 "常開"，再由"共用"極接回到燈座上。
Phone charger retrieves power from 110v power line from the celling. Phone charge constantly provide power to the perfboard. See the illustration below for my complete wiring.
When connect 110v power line to phone charger, please make sure the isolation is done properly. I used the isolation tape and tight them 3~4 times to ensure it's isolated. After all, there is no reason to risk your life or property for the sake of DIY.
As mentioned before, I placed the phone charger inside the light base.
如下圖：110V負極再接到燈座本身，正極接到電路板的繼電器模組 "常開"(左側)，再由繼電器模組"共用"(中間)極接回到燈座上。一定要接繼電器模組 "常開"，不然你原來的電燈開關就會失效了！
See below: Connect 110v positive to relay "NO or Normally Open" on the left, and COM "Common connection" in the middle should connect back to 110v negative.
See the wiring below, both positive and negative are now connecting back to the celling 110v wire.
Ok, before you tighten the light frame and decorative glass back to the celling, try to put on few light bulbs and test out the remote to see if they are working as expected. See the red circle below, that's the IR receiver that I used an extended wire from my perfboard to the rim of the light to get better IR reception.
I tried use the TV remote to change the LED color on the perfboard.
Change the color agagin with my TV remote.
Please check the fully functional system in video as below.
This is first practical Arduino project that I have done by myself!!