Introduction: Remote-Controlled Cool Neon El Wire
In this Instructable, I will demostrate how to control the Cool Neon El Wire using a simple Android app, via Bluetooth.
I was looking at El Wire Instructables where the EL wire is attached to stuff like shoes, clothing, signs and I thought it would be great if lights could be controlled using a mobile app. This is really easy to do!
What you will need:
- Cool Neon Shield
- Bluetooth Module for Arduino
- Connecting Wire
- Cool Neon EL Wire
- 6V Battery
- A Computer (for coding and/or powering the Arduino + Shield)
Step 1: The Setup
The setup is pretty easy...
- Mount the Cool Neon Shield onto the Arduino.
Mount the Bluetooth tranceiver onto the breadboard
Using connecting wire, connect the Tx and Rx pins (i.e., digital pins 0 and 1) of the Shield to the Tx and Rx pins of the Bluetooth module.
Again using connecting wire, connect the +5V and Ground from the Shield to the +5V and Ground pins of the Bluetooth module
NOTE: some Bluetooth tutorials mention that you cross the connection (i.e., Tx to Rx and Rx to Tx). My module works Tx to Tx and Rx to Rx. You can try one way, and swap the connections if it doesn't work.
NOTE: Remember to unplug the Bluetooth module when loading your program onto the Arduino. The Tx and Rx pins are actually the same as the Serial port used to communicate with your computer through USB, therefore the Bluetooth module will mess up the communication (You'll get a error saying "..not responding.." or something.
Step 2: The Software Logic
The software logic behind this works as follows:
An Android app gives the user the ability to connect to and disconnect from the Bluetooth module. When connected, a serial link will exist between the smartphone and the Arduino + Shield.
- The Android app has 10 switches will be used to control the 10 EL wires, which will be connected to the shield. Of course, the order of the switches will correspond to the wires (i.e., turning the first switch on will turn on first wire e.t.c.).
- When a switch is pressed on the app, it will send a command in form of a character to the Arduino.
The Arduino board listens to the Serial port. When a character is received, it controls the lights accordingly.
- The characters I'm currently using are A through to T... A means Light 1 on, B means light 1 off, C means light 2 on, D means light 2 off... This is really bad code and is definitely the wrong way of doing things. The reason I'm doing it this way is because I can't seem to get the Arduino to process the commands with 2 or more characters. So I had to compromise and use this lousy method. But it works! So... yeah!
Step 3: The Arduino Sketch
Upload the attached code to the Arduino. Remember to unplug the Bluetooth module before uploading.
This code really needs to be improved. So if you can write better code to process command from the Android app, please do! And let me know!
Step 4: The Android App
Extract the attached zip file and import the project folder in your environment. Then, connect your Android smartphone to your computer and run the app. A shortcut to do this is to open the "bin" folder of the extracted project and copy the CoolNeonRemote.apk file to your smartphone via bluetooth or USB. You can use the shorter method if you don't want to look at the code or you don't have the Android Development Kit + IDE on your computer.
If you are interested in the code, here is a quick description. The project has two main classes:
- MainActivity, which, as the name suggests, is the main activity.
- BtInterface provides all the utility tools to manage the Bluetooth connection, such as connecting, disconnecting, and listening and sending messages over the Serial port.
IMPORTANT: The name of the Bluetooth module is hard-coded in the app's code, in the BtInterface class. Mine is "HC-06". If your module is different, you should change that name.
ALSO: The Bluetooth module should be paired with your phone prior to attempting connection. To do so, power the Arduino with the Bluetooth connected and turn on the Bluetooth on your smartphone. Search for the module and when you find it. Click on it. If a password is asked, it is usually "1234" or "0000".
Step 5: Final Step
Finally reconnect the bluetooth module (if it is stilll disconnected from the previous steps), connect the EL wires and the 6V battery power. Power the Arudino + Shield using the USB (or whatever external power source you're using). Just remember that the Arduino+Shield and the EL Wire use different power sources.
Once everything is connected, you're good to go.
Step 6: Demo
Here is a demo video... Sorry for the poor quality (Dark room + Bad Camera).
We have a be nice policy.
Please be positive and constructive.