I have got the OE charge state status reading to my Arduino. Attached is a stand alone sketch of the code I am using. The array size was changing as the interval time ran. This sketch just takes the status code and then clears the serial buffer of any remaining data.
Yay!!
Will
Hi Will;
I was able to get my Leaf to the rural property for actual testing (100 miles requires the intermediate charging for 4-5 hours - both ways!). Much to my dismay, the arduino would not communicate with the OE and had to scrap the test. Back at home, I found a loose ground connector inside the OE and once reconnected, the system works fine. I set up a simulation at my residence and all is working. However, I do plan on another (long) trip later this spring to do the final confirmation.
Let me know if you get the "state" information as you want.
Mark
I want to read the State of the EVSE to my diversion control. I have the document " Serial Communications with OpenEVSE" that explains the process to read from the EVSE to a serial terminal. I have this working.
Using the $GS command I duplicate what shows on Step 3 of the procedure on my terminal emulator screen (Terra Term).
My next step was to attempt to extract the charge mode number using the Arduino. I have a spare board and got this working on my bench. I send the $GS command and then use Serial.read to an 8 element array. The state is the 5th element of the array. This works on the bench. When I attempt to use the code to read the OE that I am actually using it does not work. The array size seems to go to 11 bytes from 8 however when I turn the charger on the number of bytes seems to change? The Open EVSE Firmware (Copywrite 2013-2014) Rapi guide indicates that for the $GS command there is an elapsed charge time parameter????? It says valid in state C however the Serial communications document suggests that the states are 1 or 2 or 3 or 4 or 5 not "C".
So the question is - whats going on?
Is there an interval timer that is counting as shown in the RAPI guide?
What is State C?
Is there any command that just gets the State of the OE?
Thanks for any replies.
Will
I have my OpenEVSE working from my Arduino based offgrid solar diversion control. Thanks to Mark and Chris for helping me. Attached is an Arduino sketch with my diversion control removed for OpenEVSE clarity. It is waking up, incrementing and decrementing as required and then back to sleep as required. Yay!!!
I want to change some of the OE parameters so I have ordered a programmer and spare OE board to play with / destroy.
Will
Hi Christopher and Mark,
Thank you for helping me. I found a file named OpenEVSE Firmware which gives me the RAPI code and commands. Thank you for the examples of the serial code to send to the OpenEVSE charger. I do not think I will have any trouble with the help you have given me ( pride goes before fall)
Will
From an Arduino you would simply send the RAPI command with serial.print.
To set current to 6A
serial.println("$SC 6");
20A
serial.println("$SC 20");
or to sleep
serial.println("$FS");
to wake up
serial.println("$FE");
I'll email you a section of code that might help in the sending of RAPI commands - along with some additional comments - about your new Bolt!
Mark
Hi Mark,
Thank you for your reply. What I am uncertain about is the TTL serial communication and the coding of the RAPI commands. I will work with Chris also to get through what I cannot figure out for the OE/RAPI interface. Anything you could send me on that portion only I would appreciate.
If I am just sending TTL serial then I need a data type. I am guessing it is chars. Is that correct?
My diversion control gives me an excess KW amount so I intend to turn the chrger on when there is enough excess and turn it off when there is not enough. As the diversion increases during the solar day I will just bump up the car load in order to hold KW to the HWT at a certain level. Essentially I will divert to the car to control my diversion rate to the HWT. This means that I do not have to measure actual amps. The Midnite Whiz Bang Jr is a very accurate means of measuring current flow to the batteries. By calculating variation between the charge controller amps and WBJr amps one can get a idea of actual system current flow.
It looks like I may be able to get a Bolt tomorrow!!!!!!! Very unexpected. It will be the only Bolt in Manitoba. I will use the Bolt on board level 1 charging which is limited to 8 or 12A @ 120V. I have logic working in my diversion control already that toggles a suitable relay based on power available.
Thanks again
Will
Read your Midnite forum posts - very similar process for me in the arduino/OE development as I don't have an electronics background and did not know what an arduino was when I started! As a result, my IDE coding is "copy"/"paste", and do my best to patch. I can, however, describe the functional steps:
1. A current sensor (50 amp Hall effect) measures the current from the Midnite CC to the 48v battery bank
2. A voltage sensor (a typical 12v arduino sensor with a new resistor soldered to the board) to monitor the 48v batter bank voltage
3. A LE bluetooth shield to communicate commands with my iphone - sort of an emergency shutdown via RAPI.
4. The TX/RX communications link from the arduino to the OE (I use the OE power supply for the arduino also).
5. The current measurement is translated to the OE ampere setting (this is open loop - the battery bank is large enough to stabilize)
6. The OE ampere signal is sent via the RAPI command
6. The voltage measurement is tabularized with the current measurement for an estimated battery bank SOC and if the SOC is below a threshold, the OE is put to "sleep"for a period of time. This is a safety feature to prevent too low battery bank discharge when I cannot monitor the charge cycle.
7. An app on my iphone is used to send sleep, reset, start, etc. if I deem necessary. Otherwise all is "automatic".
8. The system is started daily (and shutdown daily) to extract as much energy from my PV system to the Leaf's charger as possible. This use of my battery bank in this method somewhat defeats the purpose of the Midnite CC as (by design) I keep the battery bank out of "float" - basically "bulk charging" to push as much energy through the CC as possible. I have a small 48v smart charger to do this during night time.
9. I use any (cheap) 220 vac UPS as the inverter - currently an APC SMT3000HV unit as it can monitor all DC/AC voltages, battery condition, amperes, wattages, etc, etc (around the inverter).
I have fully tested the system with "dummy" loads and all works as expected. The hall effect current sensor appears to need a better stabilization routine - I've got it loaded, but not tested. The system is 100 miles from my home (a rural environment), so sometime this summer, I'll do the actual Leaf testing - requires a planned trip with half way recharge!
That's about it. I can give you better descriptions of any functional routines, but would NOT recommend you copy any of my actual coding as I'm sure there are at least ten ways to do each functional routine much better.
A thanks to Chris for helping me through the OE/RAPI interfaces.
Mark
Hi Mark,
Thanks for your reply.Here is a link to the Midnite Solar forum topic that shows the process and code for the diversion control I developed.
http://midniteftp.com/forum/index.php?topic=2511.0
Any additonal information that you would share or "open source" your code will be appreciated. Knowing what hardware you use would be extremely useful. It looks like you are doing exactly what I want to do except I likely would not sleep the OE but instead turn it on and off using the RAPI commands. My email is : willeert@gmail.com. I don't see any way to PM you on this forum.
I have been learning coding and Arduino as I developed the diversion control for my house but do not pretend to be an expert. I ordered the OpenEVSE charger and found the tester that I have also ordered. I like to learn but part of that is not making mistakes if I can learn from others.
Thanks again for your post.
Will
I have a working system using the RAPI command based communications to the OE via an arduino uno board. The system monitors the PV solar production and commands the OE to set the appropriate current. It is open loop except for monitoring the battery bank voltage and then "sleeps" the OE for a predetermined time period. All needed boards, sensors cables are readily available on ebay.
Biggest downside is that the charging system is AC based (level II - 240 VAC). I'd sure like to get something similar with DC "quick charging".
Hi Christopher,
Thanks for the reply. I have ordered the OpenEVSE kit from you. This will let me get the serial communication working and debugged (assuming I can) before I get the car and need to charge it. Here in Canada it is about a 6 - 8 month wait for a Bolt at this time.
I use a serial without blocking system in my diversion control as it has 2 megas that exchange data with each other. I found the system I use here:
http://forum.arduino.cc/index.php?topic=288234.0
I would think that the $SC xx are chars?
Thanks
Will
OpenEVSE uses the same microprocessor as the Arduino Uno both support TTL at 5v so all you need is a little copper.
OpenEVSE TX to Arduino RX
OpenEVSE RX to Arduino TX
OpenEVSE GND to Arduino Ground.
The default baud is 115200. you should be okay at 20' using CAT5/6 wire. If not you could use RS232 to TTL converters on each end.
On the Arduino you can send $SC xx to set the current. To stop charging $FS will put the station to sleep $FE will enable charging.
I have found this document.
Serial Communications with OpenEVSE
I can make this work however I want to go from my Arduino to the OpenEVSE. I do not want to use a PC.
This what I imagine :
Arduino - TTL - OpenEVSE
Will that work?
Distance may be a factor also. I need to go about 20' of wire length.
Thanks for any replies.
Will
I would like to control the charge rate of the OpenEVSE using an Arduino. I do not do wifi but would prefer to wire it using whatever equipment is required. Please could someone point me to the "simple well documented" commands. I do not know emonpi or nodered. I would like to integrate the charging system with my offgrid solar to charge my car so I need a dynamic means of varying the charge rate to match the energy I have available from my solar system. My existing Arduino system can create a turn on/ increase / decrease / turn off signal of some kind but how to get it to the OpenEVSE puzzles me.
Any help with hardware or software that would be required I am grateful for. I have done a bit of work with RS232 interfacing my diversion control with the Midnite Solar Classic charge controller but do not pretend to be an expert. The location of information that could teach me what I ned to know would also be very helpful.
Thanks
Will
Joel Evans
I live in an off grid house and have a hybrid hydro/solar charging system. The solar produces little in the winter and the hydro little in the summer. They are connected to a 12kwh battery bank ( lead acid so only 6kwh useable) . I have a chevy volt that I plug into the house at 12 amps (110v) and it drains the battery until the state of charge gets to 75%, then i unplug it. On the hydro only I can get 30km per day into the car... which would otherwise be wasted ... if I am attentive to plugging it in and unplugging it at very specific intervals. On solar it can produce enough to charge it nearly completely in perfect conditions and if my car is not at work with me. I want to control the charging with the relay output that is present on either the charge controller or the inverter of the off grid system ( which can be programmed to turn on or off at a specific voltage or battery state of charge). Is there a good place to interface the open evse with the 12v relay control present on the inverter/or cc. I have thought of a few:
At the panel: The 12v relay output could turn on or off a relay right at the panel ... this would turn on and off the branch circuit that the open evse would be plugged into. Is it good to cycle an open evse on and off by essentially unplugging it under load. This sort of is like turning the power off on your computer by pulling the plug. It is the easiest though as the inverter relay control is right beside the panel
In the EVSE :A secondary transistor between the transistor and power relay inside the EVSE controlled via a bluetooth or wifi link( or wire) that overrides the power being sent to the vehicle. It would .... or should be a softer disconnect method and the evse would remain powered up . Would the evse throw an error code?
Ground the Pilot: A transistor or relay that connects the pilot to ground inside the evse that was connected to the relay control on the evse would cause the evse to register an error and turn the relays off I think.
Any thoughts on this. Or other methods that may be easier that I have not thought of. I am looking for a soft method of controlling the on off of the evse charging with a 12 volt signal from an off grid inverter.