Office Arduino Drone Part IV: Bluetooth Success

Steven Reubenstone
Collaborizm Blog
Published in
4 min readSep 18, 2015
All Maker projects, no matter how big or small, having amazing stories behind them!

It’s amazing what can happen when two like-minded individuals with similar passions are put in the same room.

I had a meeting with my startup advisor the other day, Tom, who briefly mentioned (in the small talk part of our meeting, you know the part that comes in the beginning to break the ice after not communicating for a long time) that there are serious issues when attempting to connect the Arduino HC-05 to the bluetooth port on your desktop, and what he mentioned rather casually (though it was a breakthrough for me) is the fact that the iPhone facilitates this connection much better then the desktop for some reason.

After the meeting, I immediately Googled “how to control bluetooth with your iPhone arduino” and I was taken to what I thought was my “grand prize”: a tutorial on how to connect your iPhone to the Arduino’s HC-05 module! I was off to the races. Or not.

So I read this tutorial and realized I was screwed. So all of that inspiration from our serendipitous + inspirational clash was meaningless? I think not. It gave me the energy to keep moving forward.

What happened was, I realized I needed a bluetooth shield to do this successfully (which I do not own), however, I was too inspired off my recent interaction with Tom, not to pursue this and make this work. So I went back to the drawing board with the “old” mac ← → hc-05 connection structure.

Believing in the MacOs ← → HC-05 Connection.

I went back online, and we made an important discovery.

..It’s amazing how important in engineering (or in fact, all facets of life) it is to take a break. It enables your mind to process what’s in your conscious and filter out the nuances and nonsense.

After reading about the sudo terminal again in the tutorial from our previous blog, http://www.instructables.com/id/Arduino-AND-Bluetooth-HC-05-Connecting-easily/, we realized that something was being overcomplicated in my mind → The fact the sudo terminal is doing the identical thing as the Arduino desktop app on mac!

The “ahha” moment. It may have been obvious to a more experienced Arduino developer, but it was not to a beginner.

I realized I could use the regular Arduino App on my computer to allow me easy access to craft and deploy sketches to my Arduino, as well as manipulate my computer’s serial ports, even when those ports were connected over Bluetooth.

So I deployed the sketch to my ‘duino:

— code —

#include <SoftwareSerial.h>// import the serial library

SoftwareSerial Genotronex(10, 11); // RX, TX
int ledpin=13; // led on D13 will show blink on / off
int BluetoothData; // the data given from Computer

void setup() { // put your setup code here, to run once: Genotronex.begin(9600); Genotronex.println(“Bluetooth On please press 1 or 0 blink LED ..”); pinMode(ledpin,OUTPUT);
}

void loop() { // put your main code here, to run repeatedly: if (Genotronex.available()){
BluetoothData=Genotronex.read(); if(BluetoothData==’1'){ // if number 1 pressed …. digitalWrite(7,HIGH); Genotronex.println(“LED On D13 ON ! “); } if (BluetoothData==’0'){// if number 0 pressed …. digitalWrite(7,LOW); Genotronex.println(“LED On D13 Off ! “); }
}
delay(100);// prepare for next data …
}

— code —

I could feel by connection success inching closer now once I deployed the sketch above into my Arduino. Note, I actually tweaked the code to ensure that I could light up my external LED light, as a way to prove I could manipulate the digitalOut voltage pin wirelessly (I’m doing this because this is proof I can control the DC Motor attached to our office drone to reel the pizza up and down.

I opened up the serial control panel and pressed 1. WHALA!! It worked, the LED lit up blue, and then back off again when I pressed 0. It was a magical moment. Real makers don’t give up until the job is done!

NEXT:

We look forward to now pushing all efforts forward towards the next step in this project → The DC Motor Reel Mechanism!

Thanks for tuning in!

--

--

Steven Reubenstone
Collaborizm Blog

Founder of The Nestomir and Collaborizm. Mechanical Engineer, Physics Aficionado, and Builder of Things. Let’s learn as we create.