10
Make It Talk! Use MIT App Inventor and a $5 Bluetooth module to wirelessly control an Arduino project from an Android device.

MIT App Inventor + Arduino + Bluetooth

Embed Size (px)

Citation preview

Page 1: MIT App Inventor + Arduino + Bluetooth

Make It Talk!Use MIT App Inventor and a $5 Bluetooth module to wirelessly control an

Arduino project from an Android device.

Page 2: MIT App Inventor + Arduino + Bluetooth

What you will need:● Computer with Internet access● Android smartphone or tablet (JellyBean or newer)● Arduino● HC-05 Bluetooth to UART Serial Transceiver (eBay or Amazon)

● Free account at MIT App Inventor website

https://ai2.appinventor.mit.edu

Page 3: MIT App Inventor + Arduino + Bluetooth

MIT App Inventor: Designer Window

Page 4: MIT App Inventor + Arduino + Bluetooth

MIT App Inventor: Blocks Window

Page 5: MIT App Inventor + Arduino + Bluetooth

Getting the App to your Android Device

● Install Google Goggles● In Settings on device, allow ‘Unknown

Sources’ app installs under Security● From App Inventor click:

o Buildo App (Provide QR code for .apk)

● Scan QR code with Google Goggles and install

Ask me about the AI Companion app! Great for testing! There is also an emulator that can be downloaded

Page 6: MIT App Inventor + Arduino + Bluetooth

#define pins and command codes

initialize the Bluetooth stream and declare variables

Startup the Bluetooth connection and turn off LED

Sit and listen for data to come in over the Bluetooth serial stream

If we see a ‘1’ turn the LED on

If we see a ‘0’ turn the LED off

Arduino IDE

Page 7: MIT App Inventor + Arduino + Bluetooth

HC-05 modules don’t come from a single vendor.

All HC-05s I’ve dealt with are 5V tolerant.

There is a chance though the not all are, some may require 3.3V maximum!

Most Arduinos are 5V output on the GPIO pins.

Except the newest Arduinos!

Arduino Zero does have 3.3V GPIO pins, and most likely all future Arduinos will move to 3.3V.

99% of the time, this circuit will work just fine since all all HC-05s I’ve seen have 5V-3V level shifter...

Default passcode:1234

Page 8: MIT App Inventor + Arduino + Bluetooth

But just to be safe you can add a voltage dividerVoltage divider is built using two resistors.

We will place ours between the Arduino TX pin (pin 11) and the HC-05 RX pin.

4.7K-ohm

10K-ohm

Vout = Vin * [ R2 / (R1+R2) ] = 5V * (10K/14.7K) = 3.4V

Page 9: MIT App Inventor + Arduino + Bluetooth

Shortcut!

github.com/geekcowboy/AppInventor_Arduino_Bluetooth

Upload the .aia file into your App Inventor account by clicking on:

● Projects● Import project (.aia) from my computer

Open the .ino file in the Arduino IDE, tweak as needed, and then upload to your Arduino

head on over to

Page 10: MIT App Inventor + Arduino + Bluetooth

Thank You!

● Luis Picarzo - App Inventor tutorialo whatakuai.com/bluetooth-and-app-inventor/

● Mohannad Rawashdeh - HC-05 tutorialo instructables.com/id/Arduino-AND-Bluetooth-HC-05-Connecting-easily