Smartphone A/V Remote Control Schematic Circuit Diagram
Smartphone: The Ultimate Multipurpose Device:
With a Smartphone in hand, you have the power to browse the Web, send emails, text messages, chat, download and enjoy music, capture and share photos and video clips, watch TV stations, navigate unfamiliar places, place bets, and surprisingly, even make phone calls to anyone globally. What makes this device truly versatile is its capability to host tens of thousands of Apps, transforming it into the most universal and adaptable control and communication tool ever crafted.
Among these Apps, there are options that enable you to command the latest generation of home A/V equipment equipped with WLAN technology. The WLAN interface seamlessly channels signals from the Smartphone, enabling direct equipment control without the need for additional hardware. However, it’s worth noting that older A/V equipment typically relies on the conventional IR remote control interface, posing a challenge as Smartphones do not come equipped with built-in IR transmitters.
Intelligent Bluetooth-IR Adapter: Bridging the Gap:
A crucial component lacking in this setup is an intelligent adapter capable of communicating with the phone via Bluetooth and transmitting IR signals to control A/V equipment. Intelligence, in this context, refers to the device’s capacity to ‘learn’ a sequence of commands. This implies the necessity of a learning process. The adapter must recognize the specific variant of the remote control in use, understanding which button corresponds to each feature of the controlled equipment. While basic, low-cost universal remote controllers come pre-programmed with numerous command sets for various equipment brands.
They usually only handle fundamental commands like PLAY or STOP. These basic remotes lack editing capabilities, and learning functions are typically exclusive to pricier universal remote controllers. Some advanced ones can execute macros, involving a series of commands, such as activating a DVD player, TV, and AV receiver while configuring the correct video and audio channels. This Bluetooth-IR adapter allows similar procedures. Although higher-quality universal remote controllers now support programming via PC, we opted for a more cost-effective approach in this project. In this design, the adapter is programmed by directly capturing IR signals from the original remote controller.
This means that the IR remote transmitter is placed in front of the IR adapter’s receiver and the command transfer. How this is exactly accomplished will be covered in more detail later, first, we will take a closer look at the hardware.
A radio-linked controller
The circuit diagram given in Figure 1 indicates that there really isn’t too much hardware used in the adapter design. It basically consists of a small Atmel type ATmega88 microcontroller together with some peripheral components:
A 24C512 EEPROM with 512 kBit memory and I2C interface to store the programmed codes.
- An infrared receiver module type TSOP32236
- Two IR transmitter diodes type TSAL6200 driven by a ULN2803 driver chip.
- A two-character 7 segment display with an HC595 8-bit shift register to show the programmed codes and program status.
- Three pushbuttons UP, DOWN and ENTER, for programming and operating.
- In-System-Programming interface K1.
- A relay with changeover contacts driven by the peripheral driver chip.
- Voltage regulators for +5 V and 3.3 V
BTM-222 Bluetooth Module: A Standout Feature:
While you’ve likely encountered many of these features in various circuits, the true standout in this setup is the BTM-222 Bluetooth module from Rayson. A detailed description of the module is available in the datasheet [1]. This module is compact, portable, user-friendly for programming, and, perhaps most importantly, quite affordable, with a price tag of approximately $10 each. As we steadily transition toward a more wireless future, devices like this are likely to play a pivotal role in facilitating communication between all sorts of peripherals.
The BTM-222 is a class 1 device, offering an impressive range of up to 300 feet. Examining its block diagram in Figure 2 reveals numerous serial interfaces, with the UART being the favored choice for microcontroller communication. The BTM-222’s UART, along with the USB interface, ensures a consistent data throughput at the full data rate of 921 Kbit/s. When used with a microcontroller, the BTM-222 UART necessitates minimal additional components. The communication parameters come preconfigured in the standard 8N1 setting:
- Baud rate 19,200 Baud
- 8 data bits
- No parity
- 1 stop bit
Effortless Module Configuration with UART:
Configuring the microcontroller is a breeze as it simply needs to open the corresponding UART channel. If necessary, the module’s parameters and properties can be accessed through the ‘AT command’ set of instructions, offering detailed control and customization options. Further information on this aspect can be found in the BTM-222 data sheet [1]. All configured settings are stored securely in an internal flash memory, ensuring persistence across power cycles.
Internal Components and Signal Handling:
Internally, the ‘blue’ core of the module operates at a clock frequency of 16 MHz, providing robust processing power. The output signal undergoes processing through a balun before entering an RF power amplifier, resulting in a robust signal output of +18 dBm at the aerial. For signal reception, the BTM-222 skillfully switches the received signal to a low-noise amplifier block (LNA), followed by a band-pass filter, effectively mitigating out-of-band signal interference. Remarkably, the BTM-222 doesn’t necessitate an external aerial; a short length of PCB track is sufficient. In this setup, a brief piece of wire has been utilized for this purpose.
Module Status Indicators:
The module offers several valuable status output signals, enhancing its usability. Notably, LED D5 on pin 11 serves as a data status indicator, providing crucial feedback on the data transmission process. Additionally, LED D6 on pin 13 functions as the connection link status indicator, offering insights into the module’s connectivity status. Although there is an operating voltage status indicator output available from pin 14, it remains unused in this specific application.
BTM222 set up:
Initially, the Bluetooth module needs to be configured with the correct parameters. First, remove jumpers JP2 and JP3 to disconnect communications with the microcontroller. Connect the BTM-222 to a PC using, for example, a TTL232R cable from FTDI, connected to K3. The cable carries a 5 V line (connecting to pin 1 of K3) which must not be allowed to make contact with the BTM-222 supply (this is at 3.3 V, and its upper limit of 3.6 V must not be exceeded). It is therefore important to leave pin 1 of K3 unconnected and power the Bluetooth module from the board power supply.
Configuring Bluetooth Module Using Terminal Emulation:
To begin, run a terminal emulation program like HyperTerminal or Hterm on a PC (as depicted in Figure 3). Select a (virtual) COM port to which the Bluetooth module is connected and configure the serial port settings according to the specifications provided for the BTM-222 serial interface. Confirm the module’s responsiveness by issuing the ATI command, which should trigger the display of all module settings on the screen. In case there’s no response, meticulously check the 3.3 V supply, ensure the COM port settings are accurate, and validate the connections on K3 (ensure TxD/RxD are correctly switched).
If uncertainty persists about the module settings or if suspicions arise regarding the BTM-222’s operational status, you can reset the module to its factory settings by pulling pin PIO4 high for a minimum of three seconds. Modify the UART settings to 4800 Baud (ATL = 0), enable even parity (ATM = 2), and opt for no handshake flow control (ATC = 0). Remember to adjust the terminal emulator settings after each parameter alteration. Feel free to customize parameters like the module name or the Bluetooth connection PIN code to your preference.
Pairing with the Smartphone:
Next, power on the Smartphone (or any other Android device), ensuring the BTM-222 has been successfully detected. Enter the required PIN for establishing the connection. Once all configurations are in order, power off the remote control unit, disconnect the PC, and position the two jumpers in locations JP2 and JP3. This ensures seamless operation of the Bluetooth module with the Smartphone or other Android devices.
The Remote App:
Once the Remote_Control.APK App has been installed the Android Smartphone will be capable of remote control. Bring up the App to begin pairing with the BTM 222 module. Choose the Bluetooth device using SELECT DEVICE and use CONNECT to establish a connection to the device. LED D6 lights up indicating that the module is connected to an Android device and D5 flashes when data is being received.
Interpreting Bluetooth Commands:
When a transmitted value ranging from 0 to 99, accompanied by a line feed character, reaches the adapter, it specifies the referenced memory location. In playback mode, the commands received from the Bluetooth module undergo evaluation. The process is straightforward: upon receiving ‘2/n,’ the adapter promptly jumps to memory position 2, fetching and transmitting the stored command – in this instance, raising the volume of device 1. It’s important to note that commands 73 and 74 don’t emit an IR signal; instead, they control a relay. Command 73 activates the relay contacts for a duration of two seconds, while command 74 alternates the relay contact state between off and on. Connector K2 facilitates the connection to these contacts, enabling the external equipment to be toggled on and off.
Figure 4 shows the App running in all its glory on a Smartphone. With the left/right arrows at the top, you can choose between five different devices. For each device, you can choose to enter a name in the text box and store it with the Save button. The name is retained so it appears when the App is next started. In addition, you can add a description to the functions 1 to 10. Press the EDIT button, choose the button to edit and enter the text. Press SAVE to store the text. This sequence is the same for every device.
Camera, action!
The controller software is divided into two parts; the programming mode and the operational mode. In programming mode the remote controller infrared command signals are recorded in the adapter memory in the following manner: First, it is necessary to clear the serial EEPROM. This is accomplished by pressing all three buttons simultaneously and applying power to the adapter. When the seven segment displays show dE (delete) the three buttons can be released. The complete erase process takes a few minutes before 00 is shown in the display.
Recording Commands in Programming Mode:
To initiate command recording in programming mode, press and hold the ENTER button (connected to pin PD6) before supplying the voltage. During this state, Pr on the seven-segment displays will flash three times, indicating the programming mode is active. Proceed to select a memory position between 0 and 99 using the UP/DOWN buttons (connected to pin PD5 and pin PD7) and confirm your selection by pressing ENTER. The display will show a symbol, indicating it’s ready for recording.
Now, position the remote controller within 2 to 10 cm of the IR receiver, and press the required command button on the remote controller once (and only once!). It’s essential to complete this process swiftly to minimize the possibility of recording interference. Once successfully recorded, the display will confirm the recording with “io..”. Each device can have a macro recorded, with each macro capable of containing up to six commands. These macros are stored in the same manner as individual commands.
When the IR signals are recorded the pulse widths are stored as Unsigned integer Variables, buffered and then saved to the EEPROM. To program another command it is necessary during the confirmation display (io. flashing) to hold the ENTER button after programming to generate a μC reset. With no other button pressed during reset, the program automatically jumps into playback mode. Now using UP/DOWN buttons you can select the command you have just stored and press ENTER to transmit it over the IR diode to switch the A/V equipment. This will show if the command was correctly stored.
On the PCB:
A PCB for the remote control adapter is available from the Elektor shop [2], where you can also order a preprogrammed microcontroller. Use this link to find the compiled App and the firmware source code. A look at the PCB layout should allay any fears for the home constructor; although the Bluetooth module has SMD outline connections are spaced at 1.25 mm and are relatively easy to solder by hand with a standard fine tipped iron. Correct placement of this module is important prior to soldering.
Identifying and Mounting the Bluetooth Module:
The Bluetooth module’s orientation is crucial for correct placement. Pin 1 is distinguishable by a small round dot on the metal screen and should be positioned near the PCB’s PC1 label. The thick pads located along the long sides and ends are at ground potential and are connected to the module’s continuous earth plane. Once the module is soldered in place, the other through-hole components can be installed. It’s advisable to use sockets for mounting the IC components. The two seven-segment displays, the three push buttons, D5, and D6 are all fitted to the underside of the PCB.
Placing all the ‘HID’ (Human Interface Device) components on the same side of the board simplifies the installation process when placing the unit into a case. An ordinary short length of cable serves as a suitable aerial. While the optimal length for 2.4 GHz (13 cms band) communication is around 3.1 cm (λ/4), the exact length is not overly critical for this application, which requires relatively short-range communication. The key consideration is to ensure that if the unit is enclosed in a metal housing, the aerial extends outside the case to maintain effective signal transmission.
Internet Links
[1] www.mikrocontroller.net/wikifiles/f/fc/ BTM222_DataSheet.pdf [2] www.elektor.com/120043 [3] http://appinventor.mit.edu