Cheap CA Data Logging with Phone or PC

teklektik

100 MW
Joined
Mar 26, 2011
Messages
4,019
Location
CT, USA
How to Log Cycle Analyst USB Data on the Cheap

One of the nice Cycle Analyst features is data logging via the serial TTL port at either a 1Hz or 5Hz rate. This capability is expanded in V3 which offers additional data columns. Although Grin Technologies offers the Cycle Analogger to log this serial data, many find it a bit of a challenge to justify financially - particularly for limited use for tuning or curiosity. Fortunately, there is nothing special about the data stream and other inexpensive logging options are readily available. Here's a quick rundown of the data and how to capture it for no more than $5...

The Data

The CA V3 outputs the following data in <tab> separated format - ready for import into spreadsheet apps for manipulation and plotting (Excel, free Open Office, etc). The V2 log is similar - just fewer columns and flags...
  1. Ah
  2. Volts
  3. Amps
  4. Speed
  5. Distance
  6. DegC
  7. RPM (cadence)
  8. Human Watts
  9. Nm (rider torque)
  10. ThrIn Volts
  11. ThrOut Volts
  12. Acceleration
  13. Flags (preset #, Thr Fault, Ebrake, LVC, Limit flags)
Here's a snippet of captured log after import into Excel using <TAB> as the delimiter:

CAV3_SampleLog2.pngView attachment UsbTerminal_2015_12_09.txt
The Interface Specification

The CA uses a serial port at TTL levels (0-5V) that runs at 9600 baud, 1 start bit, 8 data bits, 1 stop bit, no parity, and no handshake. Logging the data requires no program intelligence for flow control and is simply a matter of picking off the data bytes as they arrive. This same serial interface is used to download firmware and update Setup configuration by means of a USB-to-TTL serial cable.

The Cheapest Hardware Interface

Although there are posts that pursue use of Bluetooth connection to the CA as a means of accessing the data stream, the least expensive approach is to simply use the existing Grin Tech USB-to-TTL serial cable and driver to get data out instead of putting firmware in. This requires no special configuration of the CA and provides the log data stream in a convenient format via a standard USB connection to any device that has an FTDI USB driver.

PC Data Logging

On Windows, the USB cable driver installed with the Setup Uitility for firmware updates makes the CA data appear on a conventional (virtual) COM port. There are many free applications available that can capture and analyze serial port data. However, for simple data logging it's really only necessary to capture the stream - not analyze it - which makes a 'serial terminal emulator' a pretty good choice since these typically provide session logging as a feature - exactly what is needed.

The Unix utility 'putty' is an easy choice if you are running Linux. It is also available for Windows as 'PuTTy' (link). PuTTY lets you setup and store session/port configuration so you can open the CA connection and begin logging with a single click.

Although a PC is certainly handy for bench testing, a laptop stuffed in a backpack is perfectly workable for a few data collections on a frequently used commute or to test some controller or motor changes. Many investigations are one-time affairs and the inconvenience of a laptop is inconsequential compared to obtaining the data.

Android Phone/Tablet Logging

Android phones can be hooked up using the same strategy as the PC technique: plug in the USB cable and run a serial terminal emulator. Rooting the device is not required.

The tiny mini or micro USB connector on the phone or tablet simply needs a straight-through adapter to allow connection of the standard CA programming cable. These are readily available as 'USB OTG (On the Go) cables for about $5 - (search Amazon, etc). They have no electronics and just change the connector sex:

UsbToGo2.jpg
Plug the standard CA programming cable from the CA to the USB OTG cable and the 'electronics' part is done ( Whew! :shock: ).

Next choose a USB terminal emulator - one free example is 'USB Terminal' from the Play Store (link) which supports FTDI cables. Load up the app, configure the logging and data protocol options mentioned above then turn on the CA. Log data will begin scrolling down the screen and to the log file. Unfortunately (for this particular app), the CA <tab> column separator is not displayed on the screen, but importantly, it is passed through to the data log file. Log data can be retrieved in the same fashion as photos, etc. Either transfer the files to a cloud drive, pull the SD card, or use a conventional USB cable to connect to a PC and extract the files device-to-device.

While this direct-connect approach doesn't offer the flash and convenience of a bluetooth connection, the price is right. The standard CA programming cable is very long and easily allows the phone/tablet to be placed in a pocket, backpack, or in a trunk bag on the rack. This is a nice solution for occasional use to evaluate/compare tuning and cooling experiments where ongoing daily convenience is really not a determining consideration.

So - no more excuses - put your CA and programming cable to work and get logging!!!
:D
 
This is exactly what I have been researching for the last couple of days. I want to log the data from the CA V3 to a USB stick drive. Idea being, I will periodically remove the data from the USB stick rather than requiring constant connection to a phone or PC.

The closest board I've found to doing this (i.e. has a microcontroller on it, chip to convert serial to USB format and file storage on USB stick on the one board) describes it's capabilities as:

Configuration

Default setting: 9600 baud (agrees to CA Manual, but is configurable anyway)
1 start bit (this is what I'm not sure about. CA Manual says 8 bit of data... not sure what the start bit is and whether it needs to be 8 bit)
1 stop bit ( agrees to CA Manual)
no parity ( agrees to CA Manual)

Do you think this might work?
 
Lurkin said:
This is exactly what I have been researching...
...
Do you think this might work?
Actually, this thread is the opposite of what you were discussing in your thread. You specifically do not want to use a phone or the CA programming cable, but rather want to use a some other data logger as a direct replacement for the Analogger. This thread is about cheap proven methods for non-techies to get logging functionality out of stuff they already own. No research, no hardware, and no experimenting required.

That said, I have added a bit of information about the start and data bits to the original post. The number of start bits is seldom mentioned because it rarely if ever is other than 1.

Without a careful review of the particular device you are considering, I can only say that it seems that it should work. I encourage you to pursue it and report your results back in your thread for folks who are looking for less expensive Analogger replacement devices.

Justin encouraged posting up this phone logging technique - he is more interested in getting folks into testing and logging data than he is in selling Analoggers. Any approach that works - whether by phone or other device - will increase the utility of your CA and offer insights not possible by simply eyeballing the screen.
 
This looks very interesting. Does the CA store a certain amount of data, then you plug it into your computer/laptop/cell and it streams it into the excel file or notepad. Or is it just live monitoring without recording?
 
markz said:
Or is it just live monitoring without recording?

This. A separate storage device to convert the serial live information into an appropriate format and record to a file system is required. A cellphone is the cheapest, most practical way of doing this currently.
 
Thanks @teklektik, 8 years later, this post was still very useful: I confirm this was very simple using putty on Ubuntu Linux. I used the CA utility to check the USB port number, which for me was /dev/ttyUSB0
On the main putty screen, I had to select "Serial", which let me enter the USB port number. I went to "logging" under the "Session" menu to enable file logging (and rename the output file).
I also had to change the default fonts (server:fixed) which would cause an error and crash the application (under Window/Fonts), which I set to FreeMono (but I guess anything would work which has not to do with an inexistent server).
And before hitting "open", I made sure the save the configuration to something useful (idea: "cycle analyst logger"), so that I can then double click on it and start aquiring data immediately. I could check that the CA records my torque sensor. I have yet to actually use it while cycling.

EDIT: there are now (I use v3.15) 14 columns in the output, which are documented in the CA manual (section 7: logging): "Ah V A S D Deg RPM HW Nm ThI ThO AuxA AuxD Flgs"
 
Last edited:
FWIW, there are also cheap serial logging boards available, like these:
that record to a memory card.


"
This product is a data recorder, which can be recorded on the memory card through the UART universal serial port. This function is similar to the black box to record the data from the main device to the serial port and save the data in text form on the memory card. This product can be used for the flight control board with cleanflight firmware, connecting to the corresponding serial port, and by setting up the software cleanflight configurator of the host computer, the important running data of the UAV can be recorded on the memory card. Blackbox flight data recorder software is used to replay the flight records.


Note: after the first plug in the memory card, the memory card will produce the config.txt file, which changes the baud rate parameter of the serial port. This parameter can be modified. Please keep the baud rate of the flight control or the main circuit's serial port to be consistent with the baud rate of the recorder.


Parameters:


Input voltage 3.3V~12V (recommended as 3.3V~5V)
The memory format is FAT32, supporting the maximum 64GB memory
UART serial interface
Baud rate adjustable
The default bootloader is pro Mini atmega328P 5V 16mhz
Technical parameters:

1 supports storage in fat16/fat32 format TF card, storage capacity can reach 32G

2 has a simple command line interface

3 change the config file in the TF card on the computer (if it is a new card, the first power on the card after the insertion of the card, that is, the config file will be automatically created), which can change the settings, such as the baud rate. You can change the serial port settings without using any special tools to make use of your needs.

4 three modes: new, add, command

5 baud rates support 2400, 4800, 9600, 19200, 38400, 57600, and 115200..

6 the minimum connections guaranteed to run are VCC, GND, RX

7 two LED lights indicate the running state

8 input voltage 3.3V to 12V, preferably 3.3 to 5V.

The 9 idle current is 2mA, and the maximum recording rate is 6mA."
1703644705280.png
 
Back
Top