Project: Bluefruit Demo

Just for fun, let's control our robot with Bluetooth.

The Bluefruit LE UART Friend from Adafruit Industries is a great little device, it's a Bluetooth Low Energy module with functions written by Adafruit. Its most basic function is to become a simple serial port between your phone and your robot. If you have the skills for it, it could do much more.

Bluetooth Low Energy

If you have a phone, you've probably heard of Bluetooth. It's the radio protocol that wireless devices use to communicate with your phone (most popular use is audio devices like wireless headphones and wireless speakers). Bluetooth a few years ago, people came up with a new version of Bluetooth called Bluetooth Low Energy (also called Bluetooth Smart). Because it uses low energy, it's great for wearable devices and battery powered devices. The older Bluetooth is called Bluetooth Classic.

There are two major smartphone operating systems today: Android and iOS. The problem is that iOS does not work with serial ports that uses Bluetooth Classic, but it does work with Bluetooth Low Energy serial ports. So that's why I decided to use Bluetooth Low Energy instead of Bluetooth Classic.

A big bonus reason for using a Bluefruit from Adafruit is that Adafruit has programmed an Android app and an iOS app ...

... for you to use already. Programming an Android app will involve learning the Java programming language. Programming an iOS app involves learning the Objective-C programming language, and you must own a Mac computer to do it. So using the Adafruit app will save us a lot of time. If you do want to learn how to write smartphone apps, that's a lesson for another day (but try out MIT's App Inventor, it's Android app programming for kids, you don't need to know Java).

Bluetooth Classic serial ports are much cheaper to buy and a bit easier to use. But I don't want to ignore any students that only have iOS phones.

Learn More

Serial Port

Serial port communication is how your Arduino talks to your computer, and how the Bluefruit talks with your Arduino. Serial ports are slower than other data busses but it's still very common today because it's so easy to use. For one way communication, you only need one wire, for two way (full duplex) communication, you need two wires. (or you can be clever and use one wire, and each device knows how to "take turns").

Your Arduino Nano has one dedicated serial port (the RX and TX pins) but it's permanently connected to your computer. This dedicated port is sometimes known as the hardware serial port. To add more serial ports to your Arduino Nano, you can use what's called a software serial port, which uses a technique called bit-banging. There's a library that's included with Arduino IDE called SoftwareSerial that you use when you want to add a software serial port to your project.

If you are wondering what happens when you try to use the hardware serial port for the Bluetooth module, the answer is: it will work. But... since your computer uses the hardware serial port to upload code, it means: if you use hardware serial port for the Bluetooth module, then you need to unplug the Bluetooth module every time you upload code. This will become very annoying so we want to use a software serial port instead.

Learn More

The best way to learn is to do more projects that use serial ports.

Another common device that frequently uses serial port communication: GPS receivers. You can buy cheap GPS modules that you can connect to an Arduino so your robot can know where it is exactly on Earth. GPS modules use serial ports because the computers on small airplanes and boats are very old and not very fast.

NeoPixels

I added a NeoPixel ring. NeoPixels are a brand of LEDs that can show any colour you want, and no matter how many NeoPixels you have, you only need one pin to control all of them. This means you can arrange a strip of hundreds of LEDs and still only use one pin on your Arduino to control the entire strip. This is because each NeoPixel talks to the next NeoPixel beside it (sometimes called daisy chaining).

NeoPixels Projects

Here are some great things other people have built using NeoPixels:

Music to Light

Neopixel'd Dress & LED Sequins'd Shoes and Purse

NeoPixel Clock


I built these projects below myself:

Aquarium Computer

I stuffed my computer into a fish tank. The rainbow lighting effect is created with NeoPixels.


PixelStick

I worked on the team that made PixelStick, it's used for light-painting.


Car Heads Up Display

Heads Up Displays (H.U.D.) are usually something found in jets, I made a much simpler version for my car.

Learn more from the Adafruit NeoPixel Überguide

Homework

These are some prompts for you do learn more on your own. Feel free to ask me to check your answers (there are too many correct answers to write down).




Click Here, to return to the list of classes