Before you get started, let's review what you'll need.
- Raspberry Pi 3 (Recommended) or Pi 3 Model B+ (Supported).
- MATRIX Voice ESP32 version - Buy the MATRIX Voice.
- Micro-USB power adapter for Raspberry Pi
- Micro-SD Card (Minimum 8 GB)
- Micro-USB Cable
- A PersonalComputer to SSH into your Raspberry Pi
- Internet connection (Ethernet or WiFi)
The MATRIX Voice ESP32 version has an ESP-WROOM-32. This tiny module allows for standalone applications with WiFi and Bluetooth. We require the Raspberry Pi for the initial setup.
The environment we're setting up in this guide will end with our PC serving as the development environment for our apps. The apps will then be sent to the Raspberry Pi which will deploy them to the MATRIX Voice for standalone deployment.
This guide goes over how to set up two MATRIX Voices to communicate via Bluetooth Low Energy, both acting as a server and client.
First, follow our MATRIX Voice ESP32 PlatformIO guide to learn how to upload & run code (over the air) to the ESP32.
Now that you're familiar with our ESP32 workflow, clone the repository for this project.
1. Configuring platformio.ini if you want WiFi connectivity
git clone https://github.com/matrix-io/esp32-arduino-bluetooth
Open the folder
bluetooth_server located in
esp32-arduino-bluetooth repo folder with PlatformIO and change the following values of
Do the same for the
platformio.ini file in the
bluetooth_client folder in
All the steps to compile & deploy your code can be found in the guide linked in Step 1. Below is some helpful information.
Source Code for Bluetooth server:
Source Code for Bluetooth client:
This program is meant to have two MATRIX Voices communicate with each other through Bluetooth Low Energy to change their LEDs' colors.
The characteristic created by one of our MATRIX Voices allows the other MATRIX Voice to write to it, so by powering both at the same time, the device with the client side code will change the value held in the characteristic of the device with the server side code. The server MATRIX Voice will switch its LEDs between blue and red.
You're all set! Feel free to play around with the example, add WiFi, voice, and/or hook up more devices to the system. Alternatively, you could also combine the server and client side code into one program so that the communication is bidirectional.
P.S. If you want the Arduino IDE setup, follow the directions in the
arduino branch here.