In Chapter 5, Building Your Own Traffic Light Controller, we already developed a traffic light controller. However, we controlled the lamps/LEDs directly from an internal app in Raspberry Pi. In this section, we will build an app that controls actuator or sensor devices on Raspberry Pi remotely via Bluetooth.
For testing, we will use three LEDs as actuator devices, which are controlled from the Android app via the Bluetooth module. We will use the HC-06 Bluetooth serial device, and the price is cheap. This module uses a Universal Asynchronous Receiver/Transmitter (UART) to send and receive a Bluetooth packet. You can get this module from eBay, Amazon, or your local electronics store: