61. Arduino BT interfacing

In this project, we will be taking a look at how we can connect to an Arduino Uno using 2 Bluetooth modules. The way the setup works is that the computer interfaces with the Bluetooth module by sending the module itself a bunch of commands, such as knowing the MAC address from the other Bluetooth module. Once it established the connection, then the computer will be able to send bits of data wirelessly through the receiving Bluetooth module. The Arduino will collect the bits of data from the Bluetooth, and display it to the OLED screen by an i2C interface.

<Completed unit>

To get started, you will need to set up the HM-10 Bluetooth modules so that one is considered a central (Transmitter end) and peripheral (Receiving end). For the transmitting end, you will need to connect the Bluetooth module to the USB serial cable, so that the computer can make serial communications to the Bluetooth module itself. It still uses the 4 wires-similar to the number of connections used for the USB, but the connection is somewhat different.

<Transmitting unit>

You will also need the code from python that can interface the Bluetooth module, and make sure that the Bluetooth module is connected to the right receiver. That way, it can ensure that the data was sent to the receiver that you wanted it to connect, to and not to an unknown receiver with the same Bluetooth module.

<Another view>

For the receiving end, you will need to connect the Bluetooth module to the Arduino so that the Arduino can collect the data and output it to the OLED. The Bluetooth module has to be wired in a way so that it receives the proper voltage, otherwise, It can damage it. The OLED must be wired the same way as in project 61. For the aspect of coding, you will need to have the BT. function implanted in the Arduino sketch, which is where the data is received. You can also make it so that whatever bits of data you have, such as characters, you can convert them into a string. Since we are using an OLED, it's important to make sure that the data we received from the Bluetooth module gets sent to the OLED.

<Underside of the receiver>

By this point, you are ready to send in characters to the OLED by Bluetooth communication. Make sure that you got the MAC address of the receiving Bluetooth module so that you can implant it into the transmitting code. Without it, the BT module will have no way of connecting to the desired module.
Once you do get it to work on pairing, you can try sending in characters, and see your OLED showing up your characters using Bluetooth!


Comments

Popular Posts