When troubleshooting an issue, I wanted to read the Bluetooth output of the CurrentRanger. I realized that I didn't have a TTL to USB cable, but I did have a Bus Pirate. It took me a little while to figure out what to do in order to read from the CurrentRanger, so I thought I'd put together a little guide for anyone else in this position.
PreliminariesInstall a terminal program capable of VT100 emulation. I happen to have a ZOC7 license so I used that, but you can get PuTTY for free, or other programs for non-Windows operating systems.
Also, plug in the bus pirate at least once and have Windows install the FTDI drivers. (This step is unnecessary on Linux.) I had to go to Device Manager and right-click the device and select "Update driver" and have Windows Update download the driver for me
twice before the device showed up correctly. This is what it should look like:
Note: You may also want to use a USB optoisolator
like this one to protect your readings from noise.
Hooking up the bus pirateSolder some M/F headers on the CurrentRanger's serial header. For UART you're going to want to connect the
black wire to the Tx pin, the
grey wire to the Rx pin, and the
brown wire to the ground pin. Some 24AWG wire-wrapping wire will fit perfectly into some standard 0.1" headers and into the Bus Pirate leads. Power your CurrentRanger off.
Configuring your terminal emulatorConfigure your terminal emulator to use the COM port which shows up in device manager. The data rate should be 115200 8/N/1 (that's 8 bit words, no parity, 1 stop bit). RTS/CTS and DTR/DSR should be off. Flow control should be off. Your terminal emulator should emulate the VT100.
Using the bus pirateOpen up the connection and type
? and press enter. You should see this:
Type
m to change modes, and select
3 (UART). It will prompt you with various questions to configure the UART connection.
For serial speed, we need 230400 baud, but this isn't one of the built-in options so select
10 (BRG raw value). For the raw value, enter
16. Note that this is different from the baud needed for your computer to talk to the Bus Pirate- here we're configuring how the Bus Pirate will talk to the Current Ranger.
For data bits and parity, stop bits, and receive polarity, use the default values.
For the output type, select
2 (Normal). Now the UART connection should be ready:
Also, your CurrentRanger should have turned on, all on its own! Unfortunately,
it's expecting an "OK" response from the Bluetooth module within the first second of power-on, so we have to be quick. Type "OK" (including the quotes) into your terminal quickly and press enter. This may take a few tries to get right.
Now enter
{ to start the live display of data. You'll see a bunch of
*Bytes dropped* messages because the data transmission is too fast for the Bus Pirate's buffer to keep up. So enter
} to stop the display.
We can use the UART bridge macro to dump the data as soon as it comes in, with no buffering. Type
(1) and press enter to start the data dump!