Wireless Serial Communication Using Bluefruit

Introduction: Wireless Serial Communication Using Bluefruit

Here is a simple step by step guide to replace your wires with a bluetooth low energy connection:

It took me a while to figure this out because there is hardly any documentation on doing this with modern bluetooth low energy tech such as the Bluefruit module. My goal was to be able to wirelessly collect data from an accelerometer connected to an Arduino, the data being recorded on either my laptop or my smartphone for analysis.

Step one: download the programs to read UART

Mac - I am using Adafruit Bluefruit LE Connect, it is free on the App Store and documented in this blog post:

https://blog.adafruit.com/2016/06/06/bluefruit-le-...

IOS / Android - I am using the same Bluefruit LE Connect software but simply the IOS version, check the App Store

Windows - There is a wonderful program available on GitHub here:

https://github.com/adafruit/adafruit-bluefruit-le-...

Step 1: Wiring Your Bluefruit Module

Here is the basic wiring diagram, the Adafruit libraries Ill be linking too in the next step are setup for this wiring configuration so I recommend not changing it. I have used this with an Arduino Uno and Pro Mini and they essentially function the same.

Step 2: Setup the IDE for Bluefruit

If you haven't already, you will need to download a few libraries to use when programming the module, here they are:

https://learn.adafruit.com/introducing-the-adafrui...

If you don't know how to install a library its super simple just unzip the file and place it into your documents/Arduino/Libraries folder and restart the IDE.

Step 3: Write and Upload Your Program

Here is a short program I wrote that sends a message over bluetooth for the receiving device to view, the most important part is that you set your serial RX / TX pins accordingly and add another parallel serial line.


#include

const int rxpin = 10;

const int txpin = 9;

SoftwareSerial Serial1(rxpin, txpin);

void setup(void) {

Serial.begin(9600); //this is the normal wired serial monitor connection you can view with the Arduino IDE

Serial1.begin(9600); //this in the second string that is sent to the Bluefruit module, it has to be 9600 baud

}

void loop() {

Serial.println("MyNameJeff");

Serial1.println("MyNameJeff");

delay(1000); //this prints in both places so you should see this incredibly important message either way

}

Step 4: You Did It!

Hopefully you are now looking at the UART feature in your chosen application and are pleased with the messages its giving you, you should see something like these images up here, if not try rewiring your circuit or factory resetting your module by holding a GND pin to the DFU pin for 5 seconds until the blue and red lights flash.

Share

    Recommendations

    • Metalworking Contest

      Metalworking Contest
    • Fix It! Contest

      Fix It! Contest
    • Tiny Home Contest

      Tiny Home Contest

    Discussions