Monday, April 18, 2016

Lab 5: Bluetooth Lab


Part 1


Many of us have utilized several bluetooth-enabled technologies, as the advantages of this wireless communication have caused it to become a widely used tool. Radio frequency (RF) communication operates at a frequency of 2.4 GHz and allows for data transmission through a "sending" and "listening" module. Bluetooth devices that are communicating are "paired" together so that only one particular listening module receives information from a specific sending module.

With regards to this class, we will receive two modules that are pre-programmed to communicate only with each other. Then we will connect the serial input and output of the Arduino to the serial input and output of the bluetooth module. We will use SofwareSerial to set up the software serial connection.

The purpose of this lab is to set up a bluetooth transmitter and receiver and create a wireless button to buzzer connection.

In the first portion, we set up the bluetooth transmitter so that the Serial Monitor would print "H" when the button is pressed and print "L" when the button is released. Rather than work with one Arduino, the signal will be wirelessly delivered. Since we didn't want the transmitter to be sending a continuous stream of letters, like what usually happens, we made use of an if statement so that the "H" or "L" would only be displayed once. Below is an image of our circuit.



For this part, our code is attached here.

Then we had to create a bluetooth receiver. After connecting the second bluetooth module to the other Arduino Board, setting up the LED, and writing a program for the LED to turn on if the Serial Monitor had an "H" (and off when "L"), we obtained our results. Below is an image of our circuit.



The code is attached here.

Finally, below is a video for this portion of the lab.

 Next, we wrote a program so that our transmitter could print different numbers to the serial port once every second. For example, the number would increment every second. Then, the integer value would be transmitted onto the LCD screen.

The code is attached here. Here is the video for this part of the lab.



Part 2


In this portion of the lab, we will acquire a continuously varying signal from a sensor and then send this signal wirelessly. We will use an inertial measurement unit (IMU) as our sensor, which can measure acceleration, rotation rate, and magnetic field all around three axes. It also has an on-board micro-controller that can perform calculations and provides data combining all of the detailed measurements.

We started off by installing two libraries developed by Adafruit, created the apparatus, and then used the program by Dr. Bogen. Then we wrote the program to monitor the IMU's orientation about a specific axis and map the orientation angle into a tune on an Arduino device that is located away from this apparatus.

Some issues we faced: the provided code gave instructions on calibrating the IMU but we were unable to find a rotation that calibrated the IMU. Soon enough, we figured out that if the IMU and the circuit board was rotated into different positions and then held there, it would eventually calibrate.

In order for the tune to play, we had to associate each orientation angle with a different frequency that would then result in a unique sound. First we converted the angle values into tone frequency values. Then we broadcasted these values using the bluetooth module (and this was through our transmitter-Arduino). Next, we had the second receiver-Arduino collect the data from the transmitter-Arduino. Then, the tones were played.

Our new circuit was a little different:




Our video is shown below.

Finally, the code is attached here.

No comments:

Post a Comment

Disqus Shortname

Ads Inside Post

Comments system