HC-06 bluetooth module controls LEDs on a Skateboard
If you’re going to ride in style, why not control your style through your cell phone via a HC-06 bluetooth module connected to an Arduino?
That’s just what Ben Isaacs did with his skateboard (long board). He controls the LEDs through his phone via a bluetooth module.
This project was submitted by one of our members. You can see more of our member's projects here.
Not a member yet? Sign up here.
The Ride
Pretty sweet looking ride!
Here is the bottom of the board. Is any project truly complete without tape?
What is an HC-06 bluetooth module?
The HC-06 bluetooth module is commonly used for wireless communication in various electronic projects. It is a popular choice for adding Bluetooth functionality to microcontroller-based projects, such as Arduino, to enable wireless communication with other devices like smartphones or other Bluetooth-enabled devices.
The range of communication typically varies but is generally in the range of a few meters to tens of meters, depending on environmental conditions and interference.
It communicates with the host microcontroller (e.g., Arduino) using a UART (Serial) interface. This means you can send and receive serial data wirelessly using this module.
Typically, the bluetooth module operates at 3.3V – so you need to make sure to power it with the correct voltage level to avoid damage – many Arduino boards are available now with a 3.3V operating voltage.
The HC-06 module is a slave-only device, meaning it can’t initiate connections. It must be paired with a master device, such as a smartphone or another Bluetooth master, to establish a connection.
When using the HC-06 module, you typically need to connect it to a microcontroller and write code to handle the communication. Libraries are available for popular platforms like Arduino to simplify the integration process.
Longboard Bluetooth Interface:
This is the phone interface he used to control the LEDs with the HC-06 bluetooth module. The application end of the HC-06 bluetooth was developed by Whatakuai.
HC-06 bluetooth module code:
Ben was also kind enough to share his code:
/* By Benjamin Caspar Isaacs Twitter: @Benjamincreater Attribution to: Great scott This code is in the Public domain */ char blueToothVal; //value sent over via bluetooth char lastValue; //stores last state of device (on/off) void setup() { Serial.begin(9600); pinMode(2, OUTPUT); pinMode(3, OUTPUT); // these are the output pin's for the Led's pinMode(4, OUTPUT); } void loop() { if (Serial.available()) { //if there is data being recieved blueToothVal = Serial.read(); //read it } if (blueToothVal == 'n') { //if value from bluetooth serial is n digitalWrite(2, HIGH); //switch on LED if (lastValue != 'n') Serial.println(F("LED is on D2")); //print LED is on lastValue = blueToothVal; } else if (blueToothVal == 'f') { //if value from bluetooth serial is n digitalWrite(2, LOW); //turn off LED if (lastValue != 'f') Serial.println(F("LED is off D2")); //print LED is on i have commented but you can uncomment it lastValue = blueToothVal; } if (Serial.available()) { //if there is data being recieved blueToothVal = Serial.read(); //read it } if (blueToothVal == 'c') { //if value from bluetooth serial is n digitalWrite(3, HIGH); //switch on LED if (lastValue != 'c') Serial.println(F("LED is on D3")); //print LED is on i have commented but you can uncomment it lastValue = blueToothVal; } else if (blueToothVal == 'f') { //if value from bluetooth serial is n digitalWrite(3, LOW); //turn off LED if (lastValue != 'f') Serial.println(F("LED is off D3")); //print LED is on i have commented but you can uncomment it lastValue = blueToothVal; } if (Serial.available()) { //if there is data being recieved blueToothVal = Serial.read(); //read it } if (blueToothVal == 'a') { //if value from bluetooth serial is n digitalWrite(4, HIGH); //switch on LED if (lastValue != 'a') Serial.println(F("LED is on D4")); //print LED is on i have commented but you can uncomment it lastValue = blueToothVal; } else if (blueToothVal == 'f') { //if value from bluetooth serial is n digitalWrite(4, LOW); //turn off LED if (lastValue != 'f') Serial.println(F("LED is off D4")); //print LED is on i have commented but you can uncomment it lastValue = blueToothVal; } delay(100); }
Nice work Ben – very cool project demonstrating the HC-06 bluetooth module!
Very cool project…Nice Job! My youngest Son just got himself a skateboard. I should swipe it some time and add your ‘goodness’ to it as a surprise! I also just started playing with the HC-06 BT module. It is quite a versatile little addition to my Arduino arsenal.
I agree – great job Ben!
I haven’t checked out the HC-06 Bt module yet, but this has gotten me interested to see how it works.
There are a bunch of free Android Apps on the google play site to interface with the BT module. I have already controlled a relay connected to a table lamp with it. There is also a nice app to receive data sent to your phone from the Arduino. I was monitoring my Arduino LDR ‘Live’ from across the room so I could choose what the best brightness threshold should be ultimately set to. Fun Stuff!!
This is so awesome Ben. Thanks for sharing it. I love the App addition to the Arduino. This is a whole other avenue to travel down. Good job!
Dan
Can you send me the applicaton project file .aia OR send me blocks image.
gvk556@gmail.com
Thanks
You will need to log in using your Google account ai2.appinventor.mit.edu/?galleryId=4854508502384640