In this Instructable I will demonstrate how to create a multicolored lamp controlled via Bluetooth using an Arduino, HC-05 Bluetooth module and Android device or Teraterm for computers with Bluetooth. The code for the lamp currently enables the user to choose off, yellow, red, green, blue, and the ability to fade red, green, or blue.
Bill of materials
1.) Arduino and Power Source
3.) HC-05 Buy it here URL: http://www.amazon.com/gp/product/B00JP05S6C/ref=oh_aui_detailpage_o05_s00?ie=UTF8&psc=1
4.) 2X 330Ω
5.) 1X 100Ω
6.) 24X Jumper Wires*
7.) 8X Common Cathode RGB LED's**
8.) 1X Yellow LED***
9.) Android device with Arduino Bluetooth Controller or a computer with Bluetooth and Teraterm.
10.) Arduino Bluetooth Controller if that link doesn't work (my last 'ible taught me not to trust the embed tool) use this URL: https://play.google.com/store/apps/details?id=eu.j...
11.) Teraterm (Windows) and if this link doesn't work, URL: http://download.cnet.com/Tera-Term/3000-20432_4-75...
*Depends on the amount of RGB's you use.
**You can use as few or as many as you like 1-8 can use the same resistor.
***Can be any color.
SAFETY AND DISCLAIMER:
I assume no responsibility for YOUR actions if this is illegal where you live, don't do it, If you some how manage to hurt yourself replicating this experiment how manage to use a computer is beyond me. If you break your stuff replicating this, it's your fault.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: The Code
The reason i'm having you flash the code onto the Arduino first is because you have to have the Rx and Tx wires to and from the Bluetooth module disconnected while the code is applied to the Arduino. you can perform this step last,, just remember to disconnect the Rx and Tx wires. For those of you who can't get new libraries to work or always have that error code about a library not existing, this code doesn't include any libraries except for what's already in the Arduino program, so you just flash the code, connect the wires and it'll work.
I made this code basing it off of a motor control code I found on an Instructable by RuiSantos: https://www.instructables.com/id/Arduino-Control-DC...
And I also used the Fade example Library, I feel I did enough work on the code to call it my own, that's why only my name is on it feel free to edit it just give credit where credit is due.
Step 2: Wiring the Circuit
First, run a red wire from 3.3V to the Red line on the breadboard and connect the Blue line to ground, then Yellow to the Rx (pin 0) on the Arduino to the Tx pin on the Bluetooth module and Orange from the Tx (pin 1) to the Rx pin on the Bluetooth module, remember it must be Tx to Rx and Rx to Tx If not the data you try to send won't go through and it won't work other than the Yellow status light coming on.
Bluetooth module: Red - 3.3V
Black - Ground
Yellow - Tx (on module)
Orange - Rx (on module)
Pin 0 = Rx pin - Color: Yellow Connect to: Bluetooth module Tx pin
Pin 1 = Tx pin - Color: Orange Connect to: Bluetooth module Rx pin
Pin 8 = Yellow LED
Pin 9 = Red LED
Pin 10 = Green LED
Pin 11 = Blue LED
Step 3: Using Arduino Bluetooth Controller
1.) Obviously you need to download the app
2.) Turn on Bluetooth and search for "HC-05" then pair, the password will be "1234" unless you've changed it yourself.
3.) Then open the app and follow the pictures above for the rest.
Step 4: Using Teraterm
After enabling Bluetooth and making sure no other devices are paired:
1.) Click "Serial"
2.) In my case it's COM14 So I click on that.
3.) Click "OK"
4.) Click anywhere in the black void of the Teraterm window.
5.) At this point the led on the HC-05 should be blinking twice quickly then off for a moment to signal that it is paired, if blinking rapidly then it isn't paired.
Note: I don't remember having to put in the passkey when using my computer, so you may not have to.
Step 5: Sending the Commands
When I was writing this code it took me two hours to realize that you can't send words such as "yellow" only numbers 0-9 seem to work but I don't have much experience in programming so for now 0-9 will have to do.
Here's the list of commands.
0 - All: off
1 - Red: on
2 - Green: on
3 - Blue: on
4 - Yellow: on
5 - Red: Fade
6 - Green: Fade
7 - Blue: Fade
Sending "8" or any letters results in pausing the program for some reason.
Step 6: Get Creative!
I'm going to work on the RGB's mixing colors next, and I need to make/find a good diffuser (fancy word for lampshade) maybe even put RGB strips on the ceiling, let me know what your ideas are and I may include them in updates to this 'ible.
Participated in the
Make it Glow!