# Arduino + Cycle Analyst = Miles Left Meter



## Zak650 (Sep 20, 2008)

Goal, develope a real time miles remaining meter like most "retail' electric cars have.

The cycle analyst outputs a data stream the info below is from their manual: 

The pad labeled “*Tx*” contains a serial data stream with the current 
stats of the vehicle. The format is tab-deliminated ASCII text at a 9600
baud rate. After power-up, the CAoutputs a header line, and then at a
rate of once a second or 5 times a second (see section 8.15) it
transmits the amp-hours, voltage, amperage, speed, and distance as​shown here:

The data is at 0-5V CMOS voltage levels, making it easy to interface
directly to other microcontrollers. In order to log the data to a regular
computer or laptop, it is necessary to either level shift the signal to be
compatible with RS-232 voltages and run it to the computer serial port,
or process the signal and connect it via USB, IrDA, BlueTooth, or other
standard. For running into a computer serial port, a MAX232 or a similar RS-232
driver chip can be powered from the * and pads. The resulting datastream can 
be seen and saved with HyperTerminal or other terminal software. 
The following diagram shows a typical setup:​ 
_*9.1 Using the Data Output (V2.1 and beyond)**Tx5V G*_​ 
*Ah V A S D3*
*3.296 47.62 10.04 15.32 8.9132* 
*3.299 47.49 13.22 16.41 8.9175* 
*3.302 47.43 13.45 17.30 8.9220*
*3.306 47.85 6.02 17.52 8.9268*
*3.308 49.36 -1.43 17.17 8.9317* 
*3.307 49.55 -3.69 16.05 8.9365*​ 
ah being used (assending value), voltage, amperage, speed, and distance​ 
It seems the arduino could be used to calculate the remaining miles at any given instant based on the compiled information over the last minute(or some other time frame), the kwhs in the pack, and feed the distance remaining given the current driving mode.​ 
Any thought, suggestions, and ideas to make this happen?​


----------



## TEV (Nov 25, 2011)

Hi,
I am interested in reading data from the serial port of my controller and displaying a few parameters on a LCD.
So far I was able to program arduino to read a low and hi and display the status on LCD for replacing the status lights of the controller and BMS, lately I find out about arduino's ability of reading a serial port and my controller has one ( I can connect with hyperterminal in windows) 
With the right programming I assume that I can get a few of those parameters on LCD but I have no iddea how to do that.

We need someone with programming experience, willing to help.

I think our projects are similar ( reading data from a serial port) and I apologize for piggybacking your thread.


----------



## PStechPaul (May 1, 2012)

I made a controller/monitor that does essentially the same thing, using a PIC18F4420. It has the RS232 IC and a 2x5 header that connects to a 9 pin D-Sub connector for a serial port. I have a SiLabs CP2103 USB-Serial link which enumerates as a serial port. I have found that HyperTerm does not play nice with Win7 so I made a simple Delphi Windows GUI which displays the serial data and has an option to save it. 

I used comma delimited data and I also added a time stamp to each data line, which I have set up for 4 times per second. The CSV file is easily imported into Excel for analysis and graphing. 

I haven't done much with this lately but I'd be glad to share what I have if you want to run with it. Let me know what your skills are and what you really need.

It would be better to add the USB directly to the monitor/controller, and that's what I plan to do. It's as simple as swapping a PIC18F4450 for the 4420 and adding a few parts and the USB stack PIC code. I have another product that already uses this. You can also get the Microchip FSUSB PICkit and add circuitry and code as desired.


----------



## TEV (Nov 25, 2011)

The situation is this :

I have an use Solectria UMOC440TF controller and AC55 motor. Lately I was able to bench test them and because the system it's working I would start converting a Ford Ranger.

I all ready have and Arduino with a LCD display which I intended to use instead of the status lights for BMS and Controller.

The UMOC440 has a DB9 serial port which connected with a PC and using Hyperterminal it's displaying parameters and also you can change some of those parameters.

I just find out that using a serial interface between arduino and the controller serial port I can read the controller parameters and displaying them on the LCD.

What I don't know is how to write the program for Arduino to read the serial port and display only the parameters i choose on the LCD.

When my serial adapter will arrive I think I can write a program to display the data coming from controller, what I don't know it's how to write the program to display only the parameters I choose on LCD.


----------



## ccriss (Oct 18, 2011)

I'm just an hobbist, but I did some experiments with Arduino and I think another interesting option could be : use Arduino to forward the serial data to your Android phone then let the phone do all the math and display the data....

I use the phone to log my trip when I want and I found that solution very useful 

You can see the post and related video to have an idea on how it works..

http://eco-mobilita.blogspot.it/search/label/Arduino Arduscooter 1.0

Bye


----------



## Zak650 (Sep 20, 2008)

Hi Ccris,
I watched your video, great work. I think you are on the right track. I got my Arduino Leonardo today and am looking forward to hooking it up to varius input data like you have demonstrated. Since trying to read numbers while driving may not be the best thing, using a bar graph representation of varius measurements would be a good direction to go. Your phone hook up could display different data in different colors as well.



ccriss said:


> I'm just an hobbist, but I did some experiments with Arduino and I think another interesting option could be : use Arduino to forward the serial data to your Android phone then let the phone do all the math and display the data....
> 
> I use the phone to log my trip when I want and I found that solution very useful
> 
> ...


----------



## ccriss (Oct 18, 2011)

Zak650 said:


> Hi Ccris,
> I watched your video, great work. I think you are on the right track. I got my Arduino Leonardo today and am looking forward to hooking it up to varius input data like you have demonstrated....


Arduino it's easy to use and enough powerful to do a lot of things, I hope you will find Arduino suitable for your project

Thank you for your reply , I thinkl another big benefict is the opportunity to store the trip on the phone, so later on you can copy to the PC and then parse the data and do graphs, get min and max value and so on..


----------



## dtbaker (Jan 5, 2008)

hhhmmm, don't forget that *eventually* you will have to adjust the theoretical max capacity of the pack as cells age. At the 'bottom' it might be tricky to distinguish betwee low voltge from sag under load and plain low voltage from exhaustion that doesn't recover at no-load unless you also capture and factor in the sag under instantaneous load.

or, you can accept that it won't be accurate no matter what.... record mileage at 50%DOD a couple times with your 'normal driving', and just estimate max range from there...

The way I set, and will periodically check, my 'max' is to drive around until I start seeing the pack voltage slow to recover to nominal voltage at a stoplight. That is as low as I ever intend to go.


----------



## Zak650 (Sep 20, 2008)

Hi Dan,

Thanks for contributing to the thread. I read some of your blog and am curious about the dc-dc converter failure. Did you have a diode to protect the dc-dc converter from trying to help drive the car? Jack Rickard has been saying that he thinks it's a probable cause of dc-dc converter failure, as the voltage sags the capacitors in the converter try to add to the packs capacity and help move the car since their voltage is higher than the pack's at the sag point.
Zak


----------



## dtbaker (Jan 5, 2008)

Zak650 said:


> Hi Dan,
> 
> Thanks for contributing to the thread. I read some of your blog and am curious about the dc-dc converter failure. Did you have a diode to protect the dc-dc converter from trying to help drive the car? Jack Rickard has been saying that he thinks it's a probable cause of dc-dc converter failure, as the voltage sags the capacitors in the converter try to add to the packs capacity and help move the car since their voltage is higher than the pack's at the sag point.
> Zak


I don't think this is what caused premature death of my chennic dc-dc. I would GUESS the chennic has a diode on the input side anyway, but hard to tell as they bury the whole thing in potting epoxy. I have come to understand that Solliton, and Zilla controllers MAY be better to have inductors added between the pack voltage and charger as well as dc-dc input. My build was with a Curtis controller, so generally no external inductors are needed.

In my case I suspect it had to do with a couple factors. I purposely requested nominal range of the dc-dc one step below battery pack nominal thinking it would help prevent low-voltage brownout when/if pack sagged. But I think the high pack voltage may have stressed dc-dc. second.... I tried several different ways to soften the start-up sag on the 12v side I was seeing from the vacuum pump. A tiny battery, then a big stereo capacitor, then finally an ATV starting battery. I suspect that the rapid charge/discharge of the big (2f) cap stressed the heck out of the dc-dc.

I have had no further issues while using larger ATV aux battery. Still with my Curtis controller though. Next build(s) using Solliton will have inductors between pack and charger and dc-dc.


----------

