Introduction: Connect Arduino to Open Frameworks Via Bluetooth

About: We're a group of designers, coders, and makers -- Alex Tosti, Lucy Matchett, Nicole Messier, and Joselyn McDonald. We enjoy physical computing, coding, Snacks, Our Mac books, surprising interactions, Listeni…

This instructable will cover how to connect adafruit's BlueFruit to the arduino and then establish a line of communication with OpenFrameworks. For the purpose of this guide we are just using a photoresistor to show how you can recieve information from the arduino into OF, but you could use any sensor you wish!

Materials

Arduino Uno

BlueFruit Ez-Link

Capcitor uF50v

Wires!

9v battery and adaptor for Arduino

Photoresistor

10k Resistor

Code / Libraries

Arduino Software

Open Frameworks

Arduino Tester Code to check connection!

Our OpenFrameworks code!

Step 1: Hook Up Arduino to BlueFruit

Refer to Schematic for how to connect everything to the arduino!

BlueFruit

GND -- Arduino GND

VIN -- Arduino 5v

TX -- Arduino RX

RX -- Arduino TX

DTR -- Capicitor +-- Arduino Reset

9v Battery

Either with an adaptor to the Arduino's power input

OR

Positive -- Arduino Vin

Negative -- Arduino GND

PhotoResistor

First leg -- Power

Second leg -- Resistor -- GND

Second leg -- A0

Step 2: Connect Bluefruit to Computer

Once you have your Ardunio all hooked up you need to establish a bluetooth connection with your computer. We aren't too sure about doing this on a PC but if you go on adafruit's website they provide information on setting it up!

If you're on a Mac you're in luck because so are we!

  1. Click on you're bluetooth icon at the top of your screen & make sure your bluetooth is on!
  2. From the drop down menu select Setup Bluetooth Device
  3. A list of near by devices will come up select your Bluefruit it should be named something like "Adafruit Ez-link"
  4. After a connection is made you will get a congratulations message! yay!
  5. Next you will need to select Browse Device from the drop down list
  6. A dialogue box will appear select the "Adafruit Ez-link ..." once again this will connect your computer to the device.

Step 3: Recieving Values in Arduino

Now that your computer and ardunio have a connected bluetooth communication you will want to send information back and forth!

First you will want to load a quick sketch onto your arduino to test that your sensor is working and then that the bluetooth is sending to your serial port wirelessly.

CODE!!!!

We wrote up some quick test code using the photoresistor that can be found here.

CONNECTING

  1. Download and open our code in Arduino
  2. Connect your Arduino set up to the computer with your USB
  3. Run the code so it is loaded onto the board, I would also suggest that at this point checking that everything regarding your code / sensor is working. This code takes in the value from A0 (our photoresistor) and prints it to the Arduino serial console. Check that you are receiving values and that it is behaving appropriately.
  4. Now for the unplugging of the Arduino!!! Disconnect your USB :O
  5. You will now want to change the input on your computers Arduino Console so you can receive the values wirelessly in the Arduino serial console. Go to Tools > Serial Port > /dev/cu/nameofbluetoothdevice
  6. Now click on your serial console to see the magic happen! You will also notice when the bluefruit is sending information the lights will be going crazy which can be a helpful way to debug any issues.

Step 4: Send Stuff to Open FrameWorks!

Now that you know that everything is happy and talking to each other you can send your data to OF to do awesome crazy beautiful things.

We are connecting and sending this data by sending Bytes from Arduino's serial port to OpenFrameworks.

CODE!!!!

***Special thanks Gabor Tankovics for the OF code!!!***

Download ourArduino Code hereand our OpenframWorks code can be downloaded on this page!

Everything is commented to explain what each part of the code does.

The code we have provided is the bare minium of what you need to show how to send data between the two programs. The OF sketch just shows how to recieve the data and print it to the console, but so much is possible!

Please refer to the above diagram of the code where we have highlighted the important connections between the two sketches!

*****Remember to load the Arduino code onto the Arduino board by using the USB first then disconnecting it*********

CREATE AWESOME CRAZY THINGS WITH YOUR NEW WIRELESS CONTROLLER