Plans for ThinkClamp v0.7

ThinkClamp Pre-Ultimatum

In version 0.7, the ThinkClamp hardware and firmware will be completely re-designed.

It will use an inverter RC circuit to reset the TrackPoint using the clock line instead of a pin. This opens up the UART port which allows the MCU to talk to various Bluetooth modules. If this does not work well, the user will have the option to connect the RX line back to the TrackPoint’s reset line like before. Bluetooth communication should not be interfered as many of these Bluetooth modules mostly listens for commands instead of sending out any. Bluetooth modules that can be soldered onto the board includes HC-05, HC-06 and HM-10, in which HID firmware can be programmed.

The board will feature a single cell LiPo charging station with JST 2.0mm connector, which is the battery connector for many remote controlled airplanes and helicopter batteries. Just go to a model shop and try out the batteries until one fits. LEDs are included on-board to indicate whether if battery charging status. Charging will be done through connecting the board to a power source through the micro-USB connector. If a battery is not used, the header next to the BSL button may be connected to allow 5V from the USB to flow straight to the circuit.

The microcontroller is chosen to be compatible with a MSP430F5510 and MSP430F5508. With different firmwares, the board can function as a Bluetooth keyboard and mouse combo or a USB keyboard and mouse combo. The footprint will be TQFP with 0.5mm pitch, which is much easier to solder compared to QFN like the F5502 used in v0.6. The crystal used for USB functions has been replaced with a cheap resonator.

The rows and columns of the keyboard adapter will be connected to different pins on the MSP430, hoping to use its interrupts to save power when user is not typing.

There will be two ways to program the MSP430 as well as the Bluetooth on-board such as the HM-10 using a custom firmware. Debuggers can be connected to the 2.54mm headers or using a TagConnect cable.

HID firmware on HC-06 Bluetooth modules


TL;DR – HC-05/06 shares the same MCU used in the RN-42HID and RN-41HID. You can dump the firmware from these HID modules and transfer it onto the HC-05/06 modules. Doing so may infringe Roving Network’s intellectual property so it’s best if you don’t distribute their firmware. I post this because I found it interesting.

For educational purposes, I’ve been playing with these HC-05, HC-06 Bluetooth modules. They are cheap, widely available and their firmware can be changed. But the best thing about these modules is the microcontroller BC417 that is used to handle all their logic, the CSR Bluecore4-Ext, which shall be referred to from now as BC4-Ext.

CSR BC4 is available in different flavours, so far I’ve heard of BC4-Ext and BC4-ROM. The ‘Ext’ uses an external ROM to store some data, what, I can’t remember. These guys are the core of many Bluetooth modules, including the ones from Bluegiga and Roving Networks.

I have been learning to program these modules to handle UART communication to send HID key codes but it was difficult. The resources on this is quite limited and since Bluetooth 2.0 was so 2004, CSR Support website wasn’t of much help.

I wrote a custom firmware for the HM-10 CC2540/1 but it requires Bluetooth 4.0. For a keyboard and mouse, what good would Bluetooth 4.0 do. Bluetooth 2.0 is much more suitable as it is compatible with almost all Bluetooth devices that has been around for the last 10 years. In slight frustration, I gave in and bought a BlueSmirf RN-42-HID from Sparkfun. After reading the datasheet, however, it turns out they also use CSR BC4-Ext! This is great news.

The BlueSmirf arrived yesterday. After searching for the pinout of the RN-42, I soldered some jumper cables to its SPI pins and used a USB SPI programmer that is CSR-compatible and dump the firmware with BlueFlash. After flashing this firmware onto a HC-06 module, voilà, I now have an exact copy of a RN-42-HID in firmware.

There is still the issue of conflicting Bluetooth addresses, but may that be resolved by changing the PSR settings. Byron’s blogpost gives some steps on how this can be done. And of course, the firmware of the RN-42-HID will not be shared.

Saving a pin with an inverter buffer and a RC circuit

Up to now, I’ve been connecting the ThinkPad keyboard’s TrackPoint RESET line straight to the microcontroller. This takes up a pin and has been preventing me from adding features to the adapter, like Bluetooth or maybe some external serial communication.

Using an RC circuit to create a RESET is not new, but I just thought of it recently and finally got time to try it out. The test circuit below includes some insight into how the circuit works. The capacitor’s value of 20uF is the minimum, it can be higher, or the resistor value can be increased. Either way, increasing either will increase the time required to charge/discharge the RC circuit.

Inverter RC Circuit

Here’s the circuit in action. As you can see, during normal data transfer, RESET line remains LOW. There’s a small jitter after the TrackPoint is reset, but increasing the values of the resistor-capacitor circuit would fix this easily.

Logic Analyzer Test

During planning, I used various online calculators for charging and discharging time. Why bother doing manual calculations. The calculated time is ideal. It can be slightly higher or slightly lower. In this case, the charging and discharging time is slightly higher. Instead of 600us, the time taken to charge is measured to be 633us.