islandmagic / bb-link

B.B. Link, the BLE to Bluetooth Classic adapter for Kenwood TH-D74 / TH-D75 Radios
GNU General Public License v3.0
36 stars 3 forks source link


๐Ÿ‘‰ Check out the new ready-made version that plugs directly into USB-C!


B.B. Link, the BLE to Bluetooth Classic adapter for Kenwood TH-D74/5 Radios

Some devices, like the Kenwood TH-D74 radio only support Bluetooth Classic serial profile. iOS devices only support Bluetooth Low Energy (BLE). They are not compatible and as such, you can't pair those devices together. This code provides a way to create an adapter that can interface a device that exposes a serial profile over Bluetooth Classic, to an iOS device via BLE. Its main purpose is to enable iOS app that supports AX.25 packet like RadioMail or APRS.fi to use the TNC built in the radio as a modem.

For a detailed "how-to build" this adapter, watch this video: https://www.youtube.com/watch?v=xLze6qDOLww. After you're done, come back and follow the instructions here as they are continually updated.

Hardware

The adapter is based on the ESP32 microcontroller, which provides support for both Bluetooth Classic and Bluetooth Low Energy (BLE). There is specialized code tailored for the TinyPICO development board, which serves as the standard implementation. This code can be altered to work with other ESP32-based boards as needed.

Note: Compatibility is limited to ESP32 microcontroller. Boards like the TinyS3, which use the ESP32-S3 chip, do not support Bluetooth Classic. If you don't use the TinyPICO, make sure to choose a board that features the ESP32 microcontroller.

Material

  1. TinyPICO Buy
  2. 600 mAh LiPo Battery model 602248 (6x22x48mm) Buy
  3. 3D Printed case
  4. Brad fastener as touch button (8mm head)

Power Options

The adapter can be powered via USB, such as through a USB adapter or a portable power bank, or alternatively, it can be connected to a LiPo battery for use on the go. The TinyPICO will charge the battery when plugged into USB.

Capacitive Touch Button

The installation of a capacitive touch button is not required but recommended if you need an on/off switch while using a LiPo battery. To install, connect a wire to pin number 4 on the TinyPICO board; this will serve as the on/off control.

Cases

You can 3D print a case to house the battery and the board. Here are a couple of option that attach via the mounting holes for the belt clip.

  1. Horizontal

This is the orignal design from WH6AZ, functional but primitive. Can work as a stand alone box if you don't feel like attaching to the radio.

https://github.com/islandmagic/bb-link/tree/master/enclosure

  1. Vertical

This design is a beautiful contribution from F4LFJ. It features a slick design that allows the case to attach vertically. There is enough clearance to insert and remove the battery from the radio.

https://github.com/islandmagic/bb-link/tree/master/enclosure/contribs/F4LFJ

Software

  1. Install Arduino IDE 2.x https://www.arduino.cc
  2. Add additional library source in Arduino IDE. Settings > Additional board manager URLs: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
  3. Install the esp32 by Espressif Systems board library. This code has been tested with version 2.0.15.
  4. Install the TinyPICO helper library
  5. Install FreeRTOS library
  6. Install ArduinoQueue library
  7. Install ArduinoLog library
  8. Clone this repo
  9. Flash the code to the TinyPICO board
  10. Download B.B. Link Configurator app on your phone
  11. Download RadioMail on your phone https://radiomail.app

Rig Control

By default, the adapter will set the radio to KISS mode and automatically respond to RadioMail's instructions to switch frequencies, enabling seamless operation. If you prefer the adapter not to alter radio settings during use, toggle off the 'Control Frequency' option in the configurator app.

Operating Instructions

Powering On

  1. Wake the adapter by briefly pressing the touch button. An amber light will indicate that it is awake.

Pairing with a Radio (one time only)

  1. Turn on adapter
  2. Open B.B. Link Configurator app on your phone
  3. After a few seconds, B.B. Link appears in the list of nearby adapters. Select it.
  4. Set the radio in Bluetooth discovery mode. Navigate to 'Menu -> Bluetooth -> Pairing Mode' on the radio.
  5. Tap 'Paired Radio' on B.B. Link app
  6. Wait a few seconds, the name of your radio should appear in the list. Select it.
  7. After a few seconds a PIN prompt should appear on the radio. Press 'OK' to accept. This step is only necessary once; afterwards, the adapter will automatically try to reconnect with the radio.
  8. Successful pairing is indicated by a breathing blue LED on the adapter.

Pairing with iPhone or iPad

  1. Make sure B.B. Link Configurator app is fully closed
  2. Open the RadioMail app. Proceed to 'Settings -> KISS TNC Modem -> Default TNC'.
  3. B.B. Link should be visible in the discovery screen.
  4. Select B.B. Link and tap 'Done'.
  5. Navigate to the connection screen and choose a packet station.
  6. A solid blue LED on the adapter signals that RadioMail has connected. Red and green LEDs will flash to indicate data transmission and reception.

Powering Off

User Interface

Touch Button Functions

LED Indicator

The dotstar tri-color LED is used to indicate various states:

Data Activity:

Error Conditions:

Battery Status Indicators:

Battery Indicator

The charge level of a LiPO battery can be difficult to determine without additional circuitry due to their non-linear discharge curve. A basic battery indicator is provided based on the battery voltage level:

  1. Upon waking up, the adapter displays the battery level for a few seconds. A solid green light indicates the battery is considered full, while a flashing green light suggests the battery needs charging.
  2. When the adapter is idle (indicated by an amber LED), a short tap will activate the battery level display.

Battery Saver

To save energy, the adapter automatically enters a low-power sleep mode after a certain period of not being used, for instance, when no phone is connected, during which it consumes approximately 40 ยตA. While active, the adapter's power consumption is around 140 mA, allowing for continuous operation for up to 4 hours on a 600 mAh battery. In standby mode, with no active bluetooth connection, it uses about 80 mA. Additionally, the sleep feature is disabled when the adapter is connected to USB power, ensuring that the adapter can stay on for longer durations and can be used while it is being charged.

If the battery voltage falls to a critical level, the adapter will automatically shut down to prevent damage to the circuit.

Factory Reset

You can reset the adapter to its default configuration. This will clear the list of previously paired devices and restoring default settings. Simply tap 'Reset Adapter' in the configurator app.

Alternatively, you can reset the adapter by connecting it to a computer. Here's how to do it:

  1. Launch the Arduino IDE on your PC.
  2. Connect the adapter to your PC using a USB cable.
  3. Navigate to the Serial Monitor within the IDE.
  4. Type R into the Serial Monitor and send the command.
  5. Monitor the response in the Serial Monitor which will confirm the clearing of the previously paired devices.
  6. After the process is complete, disconnect the adapter from your PC.

Troubleshooting

Known Issues

  1. The ESP32 library is limited to discovering Bluetooth Classic devices exclusively prior to establishing any connections. After connecting with a device, the discovery capability is no longer available. To initiate a new scan, the adapter must be rebooted. If you intend to pair with a different radio, ensure that the radio previously paired with is turned off before powering on the adapter. If not, the adapter will automatically re-establish a connection with the previously paired radio, preventing it from discovering new radios.

How to Contribute

This project is open source, so everyone's contribution is welcome. Here's a quick guide to get started:

The source code for the Configurator app is available as well.