Well.. To be honest this was not at all what I was working on right now, but after stumbling about for a bit I feel like I should share some little discoveries I made while poking with my Adafruit Feather M0 Adalogger and a recently bought cheap HC-06 bluetooth card.. So here goes..
The sad background
While working on my 433 enabled door-lock, I got sort of annoyed with that the boards 3.3V was not enough to get any range on my 433 receiver, so I went out and bought a Trinket. After a few hours of trying to get that to work with my mac I gave up... The helpful service at Adafruit told me that the bootloader of the Trinket probably was damaged and gave instructions on how to reset it.. But I did not own the Arduino-board necessary for that trick so I just shoved the Trinket into a dark little drawer where it will have to remain until I've forgiven it.![]() |
| An Adafruit Feather M0 Adalogger |
Next I went and bought a ESP8266-01 WIFI-card and spent around two days with it before shoving it into the dark drawer where it will have to spend some time with the Trinket. I am not sure if the problem was with using a non-standard board (my Feather) or if that card just sucked, but it was a painful experience.
| My worst enemy so far, the troublesome ESP8266-01 |
Enter Bluetooth
I then decided to try my luck with Bluetooth. I went out and bought yet another cheap little card, the HC-06, and this time it worked out fine!| The HC-06 card in all its glory. |
Schematics/Pins
Hooking it up to my feather was pretty easy, the only thing I missed originally was that I should of course switch the RXD/TXD ports so that the TXD port on the HC-06 went to the RX port on my Arduino, and the RXD port on the HC-06 went to the TX port on my Arduino.So the ports go:
| Arduino | HC-06 |
|---|---|
| 3.3V | VCC |
| GND | GND |
| TX | RXD |
| RX | TXD |
![]() |
| This is what my setup looked in real life. |
Pairing
Okay, I hooked up the board to my OS X using an USB cable. The red LED on my Feather turned on and the red LED on the HC-06 started to flash madly.I went into the Bluetooth settings of my OS X and checked for devices. Among the found devices was "HC-06". I selected to pair with it, waited out the inevitable fail :) and then retried now that I got to enter the pairing pin ("1234" without the quotes).
Pairing worked out fine and the red LED on the HC-06 stopped flashing and instead produced a steady light to show it was connected.
After a few seconds the HC-06 disconnected and started to flash wildly again. This did not bother me as I intended to hook it up using the serial monitor of the Arduinio IDE instead.
Coding
So then I fired up my Arduino IDE and configured the Board to be the Adafruit Feather M0 and used the normal port with that.I then took the echo-script I found on an great Instructable by
String message;
void setup()
{
Serial1.begin(9600);
}
void loop()
{
while(Serial1.available())
{
message+=char(Serial1.read());
}
if(!Serial1.available())
{
if(message!="")
{
Serial1.println(message);
message="";
}
}
delay(5000);
}


