Using an Arduino Due as a mini-QC controller

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
It cannot be emphasized too strongly, that you are
experimenting with DEADLY voltages, and many
unknowns and assumptions, any of which could
be incorrect, and cause severe damage to persons,
or expensive property. You assume ALL the liability.

Also, if you are not competent to do this kind of
experimentation safely, DO NOT do any of these
High-Voltage related experiments.

I would not connect any experimental charger device
to my precious, expensive car without substantial testing,
and logging of its operation with a car-simulator and
suitable test loads.

Toward that end, I an trying to prepare a Val-Serial
Command Language tester for Valery's new isolated
charger, and provide logging of the test data.

I intend to log at least the Output Voltage and Current,
and all the Commands and Responses, along with
Time-Stamps, for examination with my CAN-Do program.
Initially, there will not be any QC car involved, and
I will rely on the charger's own voltage and current
measurements.

The first tests will be with "no load", and just ask the
charger to output a few different voltages. The logs
should show us the response times.

Then, some tests with resistive dummy loads, and
than a test actually charging an "unknown-voltage"
battery of some sort.
 
My first pass at a Valery-Serial Command language:
(the Command, a Response, the Description)

"qsp", "rsp1", "0. Sleeping? Yes",
"qon", "ron0", "1. Powered ON? No",
"qva", "rva100300", "2. Out: 100 V, 30.0 A",
"cst", "rst", "3. Start the Charger",

"qvm", "rvm455", "4. Max Volts?, is 455",
"svm445", "rvm455", "5. Set Max Volts = 455",
"qam", "ram295", "6. Max Amps?, is 29.5",
"sam095", "ram095", "7. Set Max Amps = 9.5",

"qvo", "rvo000", "8. Volts Out?, is 000",
"cvo100", "rv0100", "9. Set Volts Out = 100",
"qao", "rao001", "10. Amps Out?, is 0.1",
"cao050", "rao050", "11. Set Amps Out = 5.0",

"cst", "rst", "12. STOP Charger",

"cia0", "ria0", "13. Set QC-A to Open",
"qia", "ria0", "14. QC-A? is Open",
"cia1", "ria1", "15. Set QC-A to 12v",
"qia", "ria1", "16. QC-A? is 12v",
"qib", "rib0", "17. QC-B? is Open",
"qib", "rib1", "18. QC-B? is Gnd",
"cic0", "ric0", "19. Set QC-C to Open",
"qic", "ric0", "20. QC-C? is Open",
"cic1", "ric1", "21. Set QC-C to Gnd",
"qic", "ric1", "22. QC-C? is Gnd",

"abc123", "res123", "23. For Testing",

--------------
Testing Links to some Google Documents:
(might not work for others, might need Chrome, not IE7)
https://drive.google.com/folderview?id=0B8c-Y92E74ezS1RZMkdZVTU4M1k" onclick="window.open(this.href);return false;

Cheers, Gary
 
The legacy Val-Serial language seems to have only
one Command, which does cover a lot of ground:

M,aaa,vvvv,E

which requests output of aaa Amps, and vvv Volts.

The response is apparently always:

ECHO:aaa,vvv,E<eol>

There is a READY response, and a STATUS response, but
it is not clear what Command is used to request these responses.
 
Quick update -

In addition to http://www.mynissanleaf.com/viewtopic.php?f=44&t=13349&start=500#p347456" onclick="window.open(this.href);return false;, got WiFi and external EEPROM working. You can see both on the board photo in the above post.

EEPROM:
Hardware: Atmel AT25256 (256kbit, 64 byte page size)
Library: SPIEEP as is. Added my own implementation of EEPROM_writeAnything and readAnything for ease of storing / retrieving structured data. Since Due does not have EEPROM on board (such an omission IMO), one has to add an external chip to store anything that is to survive Due reflash (complete flash erase happens on a Due every time the board is reprogrammed).

WiFi:
Hardware: WiFly module by Roving Networks (RN-171XV).
Library: WiFlyHQ. Had to spend some time searching for the implementation of WiFlyHQ library that would work for Due. Then ported our mods to that library that we implemented in our EVSEs (basically an ability to issue generic commands)

Timers:
Library: a small lib found at http://forum.arduino.cc/index.php/topic,146947.msg1115263.html#msg1115263" onclick="window.open(this.href);return false;. Not extensively tested yet but does produce the right frequencies on PWM outputs etc.

Next up SD and this board will be rather functional (microsd connector already on board, connected via SPI - so just need to get the lib working).

Through 'learning by doing' (my favorite method by far), discovered several useful mods to the PCB (implemented in the layout for the next version):
1. Added another relay for the total of 3 high-voltage, 8A max current relays (DPDT). 2 are used in QC analog comms, 1 to be used to drain charger output
2. Added headers for a number of unused digital pins, plus a separate header for Serial comms with the charger
3. Added WPS button for WiFi to enable one-button config
4. Added I2C RTC (http://datasheets.maximintegrated.com/en/ds/DS1307.pdf" onclick="window.open(this.href);return false;) with battery backup
5. Added 3 high-current FET-buffered outputs
6. Added 3 analog inputs with RC filters and option to feed 5v input (via an onboard divider)

Now on to tweaking the main charger code:
* The main task will be to move the PWM management code into a timed interrupt running a PID loop
* Same function will check Serial buffer for commands from QC controller and will update target current accordingly
* Same function will send voltage & current measurements back to QC controller over Serial
* We will start with 20Hz for that interrupt and will go from there if needed. Given 10Hz command frequency over CAN, 20Hz should be a good start

I think we can go through this by end of this week. Fingers crossed ;-)

V
 
Back
Top