loading

Bluetooth Low Energy is fantastic for wireless communication between devices - unfortunately, the documentation is less than fantastic. We're here to fix that!

We will be working with RFduino, a cheap microcontroller ($15 ea.) that includes a built-in BLE module. The RFduino works with Arduino sketches, so if you have previous experience with Arduino it's very easy to learn.

Our code demos the RFduino through a couple of simple echo programs, where we send a message to the RFduino, and it "echoes" it back. For Linux users, we have a python program that utilizes the "hcitool" and "gatttool" Linux commands; for Android users, we have an an echo app for those running 4.3 or higher.

Like this Instructable? Don't forget to follow us, favorite it, and check us out on Facebook!

Materials:

The cost of this project will vary depending on what you have at hand - if you already have an FTDI programmer and some soldering tools, all you need is the $15 RFDuino, two 1k resistors, and a 10nF capacitor!

For those looking for an easy start, we recommend buying the following:

Time required:

  • 15 minutes to download, install, and run the echo programs with the development kit

Skills needed:

  • Basic Arduino coding (uploading a sketch and installing a library)
  • Using a Linux terminal (the proper commands will be provided)
  • Coding in Python
  • Basic Android programming (adding permissions, editing a layout, debugging on a hardware device)

Step 1: Try It Out!

First, download the code at our Github repo, and move the RFduinoEcho folder to your sketches folder. You will also need to install the RFduino library and drivers.

RFDuino:

After the libraries and drivers are installed, connect the RFduino to your PC. If you bought the dev kit, it should be as easy as plugging it into the USB port. For those going for the $15 option, you'll need to use an FTDI chip/programmer to emulate the RFDuino's USB shield (see schematic). This means soldering wires to power, ground, GPIO0, GPIO1, and RESET on the RFDuino (pins 8, 6, 11, 12, and 9 respectively). Hook these pins up to power, ground, RX, TX, and DTR on your FTDI module, with a 1k resistor in series on each of the RX/TX lines and a 10nF capacitor in series on the DTR line, to emulate the schematic.

Now upload the Arduino code to the RFduino. If all goes well, nothing will happen initially, but when you connect/disconnect to the RFduino it will notify you via serial.

Linux:

Before you use the python code, you have to find the name of your bluetooth device. To do this, run "hcitool dev" to determine the name of your computer's bluetooth device - this will list the bluetooth devices on your computer (in the format of "hci#"). If there is more than one device, the first one will probably be the computer's built in bluetooth transceiver, and the others will be dongles or other Bluetooth devices.

Then, run "python rfduinoecho.py " in the Python folder. The script will search and connect to the RFduino, and then prompt you to enter a string. It will send the string, receive its echo, and print it.

Android:

Import the project into your Eclipse workspace. Make sure you have your Android device plugged in and ready to debug. If you're not sure how to do this, Google has great instructions. Click the "Run" button in Eclipse to run your program.

Press the "Connect" button to connect to the RFduino. You should see the words "Connected" at the top. Next, type the string you want to send in the text box that has the prompt "String to send." Then press the "Send" button to send the string to the RFduino - The RFduino's response will appear underneath "Echo."

So now that you've got it all working, let's dive in to the gory innards!

<p>Thanks for this. That's also the best price I've seen for the RFduino.</p>
<p>Nice stuff guys. You got anything to run the python code on windows 7?</p>
We don't have code for windows at the moment. We do know that <a href="https://code.google.com/p/pybluez/" rel="nofollow">pybluez</a>&nbsp;may have support for win7, so that might be worth a look.
<p>Thanks for the response. However, I have a troubles with Arduino code. When I upload everything on my RFDuino, I dont see any Bluetooth network available on my PC or phone. Why is that so?</p>
<p>Hi, the python code in the png is incomplete, and in the github repository there aren't python file, can you provide us the full source?</p><p>thanks so much</p>
<p>Hey, sorry about that - the python code is now up on the repository!</p>

About This Instructable

10,990views

32favorites

License:

More by FabricateIO:Home Automation with Amazon Echo voice control Cheap Arduino Controlled Light Sockets - Reverse Engineering RF Eye-Glowing Robotic Skull 
Add instructable to: