We will learn more interesting stuff with Arduino and bluetooth. Basic stuff is connecting Arduino to HM-10 Bluetooth 4.0 LE module which also known as Bluetooth Smart and doing some serial communication. This module has has some interesting feature. Beside of it's reduced energy consumption, another feature that quite interesting is that we can use it as iBeacon.
You can learn more about this module by reading the datasheet here. You can tell the difference with the real one is that it has small crystal on it's board.
Mine looks like the one on the left, but it has no crystal component on it. But I can tell you it working just fine.
Here the breadboard wiring created using Fritzing.
Please note that we use digital pin 7 and 8 as serial RX and TX using SerialSoftware library, we can't use TX (pin 1) and RX (pin 0) because it used by computer through USB.
And here what is looks like on real breadboard.
The power led will blinking when it's connected correctly. Note that the module has it's own breakout when I bought it. So it will safe to connect it directly to the Arduino 5V pin. On the market it may sold as just the module. You need to use 3.3V Arduino pin or you can create voltage divider circuit to drop voltage to 3.3V.
Test using your phone by enabling bluetooth. You should see the BT05 on your bluetooth device list like below. Note that this default bluetooth settings. I'll cover how to configure bluetooth on my next post.
To test serial communication between Arduino and phone follow below step.
- Download Arduino sketch here compile and upload.
- Open Serial monitor on Arduino IDE (Tools > Serial Monitor) use 9600 baud rate.
- Download MSMBle from Google Play Store, this app easy to use and just works, not like other app I have installed
- Start the app and scan for existing BLE device.
- Select service for bidirectional communication, so phone and Arduino can talk each other (Service UUID: 0000ffe0-0000-1000-8000-00805f9b34fb)
- Try to send text from MSMBle and it should displayed on Arduino Serial monitor instantly
- Then try to send text from Serial Monitor and it also should displayed instantly on MSMBle app
If above test working, you have basic understanding on serial communication. You can create any device application controlled by phone. From home automation to robotics. The limit is just your imagination.
Here is the video demo.
Next post, I'll post how to control RGB led from Smartphone using bluetooth. Happy hacking!
Readings and resources links:
- Bluetooth HM-10 : https://www.seeedstudio.com/wiki/images/c/cd/Bluetooth4_en.pdf
- Arduino Software Serial : https://www.arduino.cc/en/Reference/SoftwareSerial
- HM-10 BLE module: http://blog.blecentral.com/2015/05/05/hm-10-peripheral/
- HM-10 Arduino sketch: https://github.com/satujamsaja/Arduino/blob/master/hm-10.txt
Comments