How To Send Data Via Bluetooth
Find out how to send data via Bluetooth with the Touch Board
Bluetooth is one of the most common wireless communication and using Bluetooth technology with the Touch Board allows you to send data from the Touch Board to your computer. You can use this data for programs to further enhance your projects and create Bluetooth smart sensors. All you need is the Touch Board and the HC-05 device to turn your Touch Board into a Bluetooth device. We use the Touch Board Pro Kit as it comes with the Proto Shield but you can also use a breadboard and wires.At the moment this tutorial focuses on macOS computers only, but we’ll update this tutorial for Windows as soon as we can!
Setting up the Touch Board
First, we connect the HC-05 Bluetooth device to the board. We use the Proto Shield from the Touch Board Pro Kit, but you can also a breadboard, headers and wires. If you don’t know how to solder headers to the Touch Board, please use our soldering tutorial. To connect the board to the module, we use a breadboard and jumper wires. Follow this wiring diagram to connect the Bluetooth module to the Touch Board.
Upload the code
If you haven’t set up your Touch Board, then check out the Touch Board set-up tutorial.We are going to use the “SimpleTouchBluetooth.ino” sketch, which you can download the sketch from our GitHub repo, open it in the Arduino IDE and then upload it to your Touch Board.
Connect to the Bluetooth module from a computer
On your computer, go to System Preferences and then Bluetooth. The HC-05 module should appear and you should be able to click “Pair”. You then need to click under “Options” and enter “1234” as a code. You have now established a Bluetooth connection to the Touch Board.
Receive data
Let’s give it a test. If you now open Terminal, enter ls /dev/tty.*
to see a list of all available devices connected to the computer. Our Bluetooth module appears as “/dev/tty.HC-05-DevB”.Next, enter screen /dev/tty.HC-05-DevB
. If you now touch the electrodes, it should appear within the terminal window!
Now that you are able to send data from the Touch Board to your computer with this wireless technology, you can incorporate this into your project. For example, you could use Processing, to then use the incoming data for projection mapping. Or you can create a smart sensor with IFTTT or communicate with a whole range of electronic devices.If you want to use Bluetooth speaker or Bluetooth headphones, check out our tutorial, where we use a Bluetooth adapter.