damian.lo wrote: βWed Jan 01, 2020 3:16 pm
On the CAN port interface I hope will be visible some data so later I will connect this to inverter.
Hi damian.lo, Have you tested CAN messages on the board yet? What program/hardware are you going to use to do this?
Re: Leaf Gen 1 Inverter Board
Posted: Wed Feb 05, 2020 2:30 pm
by damian.lo
No, for now no. It's waiting until I will win with v3 board + leaf adapter in my BMW 116. In practise it will be almost the same, because I want to take throttle signal and read by v3 board. I hope I will do this in this week.
For Damien's board I was thinking to use his sketch and modify this to read/write signals from my car. Look at this - at the end of program he wrote instrument cluster steering program. Unfortunately my programming skill is very far from Damien's so it will be longer period
If you need other info from me - feel free and ask here.
Re: Leaf Gen 1 Inverter Board
Posted: Thu Feb 06, 2020 9:04 am
by james@N52E01
Thanks damian.lo, good luck with the V3 board and I will send you a message if I get stuck.
Re: Leaf Gen 1 Inverter Board
Posted: Wed Mar 04, 2020 10:47 am
by james@N52E01
Does anyone know the default voltage range for C1 and C2 throttle inputs on this board? I canβt find this information in the arduino code.
Re: Leaf Gen 1 Inverter Board
Posted: Mon Mar 09, 2020 1:22 am
by Thatguyoverthere
On the board, both throttle inputs are halved by a resistor divider, which accounts for the common 0.8V-4.5V output from most hall effect pedals. The ATSAM processor has a max 3.3v input for the Analog input pins (I believe). Note the digital inputs which are 12v in, but get resistor divider'd to approx. 3v. So you'll have to fiddle with the code to calibrate different throttle pedals, but just make sure whatever lands at the pin is under 3.3v.
Re: Leaf Gen 1 Inverter Board
Posted: Sat Mar 14, 2020 9:18 pm
by Cookie6000
Took a while but, got the board back from resoldering the microcontroller. Nice job too. Today I finished soldering the remaining items including wiring up and labelling the VCU connectors.
After that, I proceeded with getting on with the Arduino IDE with the board connected up. When I connect up my FTDI or Arduino Due, no problem. They setup just fine and you can see them. However, when I connect the Leaf VCU, I just get USB connection errors. I try and update drivers with no success. All drivers are up to date.
Damien M did say that there was the odd chance that a crystal could be reversed on the board as their orientation markings changed depending on manufacturer. Does this look like that or is it something more basic I am missing? Tried on two laptops now. Due and FTDI work fine, Leaf VCU not.
Re: Leaf Gen 1 Inverter Board
Posted: Sun Mar 15, 2020 2:54 pm
by Jack Bauer
The crystal is backwards. That Damien M guy sounds like a moron.
Re: Leaf Gen 1 Inverter Board
Posted: Sun Mar 15, 2020 3:22 pm
by Cookie6000
Thanks JB. I'll be sure to tell it to his face next time I see him
Re: Leaf Gen 1 Inverter Board
Posted: Mon Mar 16, 2020 8:53 pm
by Cookie6000
Crystal flipped. Still nada. R2 and R3 are correct at 39ohm. Dilbert suggested checking as they might have been 3.3ohm.
Next step?
**EDIT - did a bit of a tidy up. small bridge. Can see it now on COM port 8... onto the next stage. As you were...
Re: Leaf Gen 1 Inverter Board
Posted: Fri Mar 27, 2020 1:59 pm
by Cookie6000
Good few nights this week to get where we are now. Followed arbers instructions flashing the ESP8266 via the FTDI board all the way down to the last line - connect your board to Johannes board...
Am I correct in saying that the Johannes web interface will work with the @evbmw Leaf VCU or have I missed a beat? Reason I ask, James (project Fig-leaf) and me have been working together to get to this point and where we see this when we both connect up our inverter and boards. No settings.
Should we be doing everything through IDE or should http://192.168.4.1/ be working? All ready to go...
Re: Leaf Gen 1 Inverter Board
Posted: Fri Mar 27, 2020 6:33 pm
by Jack Bauer
So folks where exactly did it say that I had implemented a fully featured interface for this thing using the inverter web front end? I think it's a really cool idea by the way but sadly my attempts to clone myself have been .... well.....messy so far thus I have not done so.
Now, it is your lucky day as I have just been doing some donuts in the grey goose and have posted a new firmware AND a Wifi display on the github. You will however have to wade through my feeble attempts at C programming to calibrate your throttle etc.
Re: Leaf Gen 1 Inverter Board
Posted: Fri Mar 27, 2020 7:13 pm
by johu
Is the VCU already using the STM32? If so I think it wouldn't take me long to port the firmware to "libopeninv" and thus make it fully compatible with the existing web interfaces (mine and Dimas)
EDIT: just checked - SAM3X so no easy porting
EDIT2: actually the vital parts are hardware-independent. Make some noise if you want me to tackle it.
Re: Leaf Gen 1 Inverter Board
Posted: Fri Mar 27, 2020 8:00 pm
by Cookie6000
Jack Bauer wrote: βFri Mar 27, 2020 6:33 pm
So folks where exactly did it say that I had implemented a fully featured interface for this thing using the inverter web front end? I think it's a really cool idea by the way but sadly my attempts to clone myself have been .... well.....messy so far thus I have not done so.
Now, it is your lucky day as I have just been doing some donuts in the grey goose and have posted a new firmware AND a Wifi display on the github. You will however have to wade through my feeble attempts at C programming to calibrate your throttle etc.
Soooo you're saying there's a chance.... Yes, I may have jumped into the wireless interface side of the control with some blind optimism... so no. no, you never ever ever uttered it. I think I have watched so many hours of VCU centric youtube and so many threads in here, they all melded together to convince me otherwise. Since you have thrown up a new treat though, we are more than willing to jump all over it and give it a blast
johu wrote: βFri Mar 27, 2020 7:13 pm
EDIT2: actually the vital parts are hardware-independent. Make some noise if you want me to tackle it.
How much noise do I/we have to make? How many evbmw boards are out there do you think at this stage JB? I know of at least 5 or 6 projects in motion or pending including mine that use the evbmw Leaf VCU. Probably more that have not revealed themselves yet. Let me know how I can help if any.
Re: Leaf Gen 1 Inverter Board
Posted: Fri Mar 27, 2020 11:10 pm
by james@N52E01
johu wrote: βFri Mar 27, 2020 7:13 pm
Is the VCU already using the STM32? If so I think it wouldn't take me long to port the firmware to "libopeninv" and thus make it fully compatible with the existing web interfaces (mine and Dimas)
EDIT: just checked - SAM3X so no easy porting
EDIT2: actually the vital parts are hardware-independent. Make some noise if you want me to tackle it.
Noise! Lots of noise!
Re: Leaf Gen 1 Inverter Board
Posted: Sat Mar 28, 2020 1:50 pm
by Cookie6000
Ploughed ahead and flashed the leaf vcu with the new firmware update as outlined below. Tricky finding the ISA.h libraries but found the zip file here in the end at the end of the page: http://store.evtv.me/proddetail.php?prod=1kshunt
I found though when compiling, an error appeared referencing ISA2.h library
Opened the .h and .cpp file that were causing the error and removed the '2' in 3 locations in the code and all ran fine then. I am a basic programmer but it made sense to me to do it. Correct me if I made a balls. Now I have a vcu newly flashed with all the updated features added complete with slower flashing led for ref.
After that, via the FTDI board, I flashed the ESP8266 as before -
1. Solder GPIO0 to 0
2. Verify code in Arduino IDE - Set - Erase Flash: "Sketch + WiFi Settings"
3. Flash code onto the ESP8266 - all good, flashing green led
4. Solder GPIO0 to 1 to seal bridge back for operation
All good. Connected the Olimex up to the board and the inverter. Powered up inverter and board. All flashing as it should.
Connect up the laptop to the WiFi module, check.
Question 1 - Not sure what I am looking for yet. Is there a separate IP address connect similar to 192.168.4.1? I don't see any in the code, only the html references here.
Question 2- In the IDE, when I hardwire the VCU and open the Serial Monitor, I get Voltage info fed back on the screen. Should I remain on the Native USB Port or change to Programming port to send torque commands? Sorry for these questions that might seem fundamental. Learning this side of the build as I go. Thanks
Re: Leaf Gen 1 Inverter Board
Posted: Sun Mar 29, 2020 9:14 am
by Jack Bauer
So as we now seem to have a complete lack of understanding coupled with confusion as to how the Leaf VCU works i'll jump in here and try my best to explain. I hesitiate as it seems sometimes that for every answer I give two more questions pop up but here goes.
1) The Leaf VCU is designed to run a Gen1 or Gen2 Nissan Leaf inverter and motor in stock form via CAN messages. No inverter modifications are required.
2)The Leaf VCU DOES NOT operate with the openinverter WiFi interface.
In order to configure the VCU to run your motor it is necessary to modify the software to accept your throttle input. The VCU provides for single or dual channel throttle pedals and in its stock for on github is configured for a BMW E46 hall effect pedal. In order to change this the subroutine responsible for reading the pedal input will need to be modified. Here is the routine :
void readPedals()
{
ThrotVal = analogRead(Throttle1); //read throttle channel 1 directly
ThrotVal = constrain(ThrotVal, 145, 620);
ThrotVal = map(ThrotVal, 145, 620, 0, MaxTrq); //will need to work here for cal.
if(ThrotVal<0) ThrotVal=0; //no negative numbers for now.
if(digitalRead(Brake)) ThrotVal=0; //if brake is pressed we zero the throttle value.
//Serial.println(ThrotVal); //print for calibration.
}
Once this has been done the VCU will now respond to throttle commands and send torque requests to the inverter.
the latest firmware on github looks for a 12v input on IN1 as a start request. It will then control the precharge and main contactors and inverter power via the three low side driver outputs OUT1,2 and 3 as per the comments in the code.
WiFi : A web interface via wifi that runs on the same Olimex ESP8266 module as the openinverter has been released on github. Once loaded and powered up a wifi access point called wifipowernet will appear. Connect to this and goto 192.168.4.1 to see the interface. Goto 192.168.4.1/admin to change the wifi access point settings.
ISA CAN Shunt : The latest release firmware also provides for connectivity with the ISA Can shunt for data display over the wifi interface.
I have created a task here requesting help with documentation etc not that I really expect much : viewtopic.php?f=18&t=643
I can't explain everything to everyone.
Re: Leaf Gen 1 Inverter Board
Posted: Sun Mar 29, 2020 10:22 am
by Cookie6000
Appreciate it Jack
I am 95% there, everything connected up as it should. This fills in the last few gaps including the use of an alternative pedal. If it helps, I will work on a step by step for the Open Tasks Leaf VCU thread you just started from the aspect of my build to date.
Re: Leaf Gen 1 Inverter Board
Posted: Sun Mar 29, 2020 10:43 am
by Jack Bauer
Much appreciated:)
Re: Leaf Gen 1 Inverter Board
Posted: Sun Mar 29, 2020 10:50 am
by Kevin Sharpe
Cookie6000 wrote: βSun Mar 29, 2020 10:22 am
If it helps, I will work on a step by step for the Open Tasks Leaf VCU thread you just started from the aspect of my build to date.
That would be a great help
Re: Leaf Gen 1 Inverter Board
Posted: Sat Apr 04, 2020 9:45 am
by Cookie6000
Looking to calibrate the ThrotVal values in the evbmw Leaf VCU for the Leaf pedal. The values 145,620 in the code are from the E46 pedal Damien used in the E46. The E46 signal o/p from having a search are C1 1.64v - 4.64v and C2 0.8v to 3.8v, the latter being the same as the Leaf and Touran pedal Johannes uses. Just want to be sure I calibrate the Leaf pedal correctly.
ThrotVal = analogRead(Throttle1); //read throttle channel 1 directly
ThrotVal = constrain(ThrotVal, 145, 620);
ThrotVal = map(ThrotVal, 145, 620, 0, MaxTrq); //will need to work here for cal.
What do these ThrotVal values reference to and how do I find the relevant Leaf/Prius/a-n-other pedal ThrotVal so I can put a 'how-to' together for future users adapting the Leaf VCU to their project. Thanks.
Re: Leaf Gen 1 Inverter Board
Posted: Thu Apr 09, 2020 11:01 pm
by Thatguyoverthere
The "map" in the code takes the 145, 620 that you get from the ADC input (throttle) and makes a corresponding value from 0 to MaxTrq (maxtrq is defined later in the code as 2000). The 145, 620 are the values that the ATSAM sees that has been converted from the ADC input. Just as an example, the pedal might output 1.6v at 0% throttle, and the uc sees that 1.6v as 145. To calibrate the throttle, uncomment (remove the two //) in front of the serial println throtvalue and open your serial monitor to see what values you get.
Re: Leaf Gen 1 Inverter Board
Posted: Fri Apr 10, 2020 1:08 am
by Thatguyoverthere
I made a short video to try to explain the process for calibrating the throttle.
void readPedals()
{
ThrotVal = analogRead(Throttle1); //read throttle channel 1 directly
ThrotVal = constrain(ThrotVal, 145, 620);
ThrotVal = map(ThrotVal, 145, 620, 0, MaxTrq); //will need to work here for cal.
if(ThrotVal<0) ThrotVal=0; //no negative numbers for now.
if(digitalRead(Brake)) ThrotVal=0; //if brake is pressed we zero the throttle value.
//Serial.println(ThrotVal); //print for calibration.
}
void readPedals()
{
ThrotVal = analogRead(Throttle1); //read throttle channel 1 directly
//ThrotVal = constrain(ThrotVal, 145, 620);
//ThrotVal = map(ThrotVal, 145, 620, 0, MaxTrq); //will need to work here for cal.
if(ThrotVal<0) ThrotVal=0; //no negative numbers for now.
if(digitalRead(Brake)) ThrotVal=0; //if brake is pressed we zero the throttle value.
Serial.println(ThrotVal); //print for calibration.
}
digitalWrite(13,!digitalRead(13));//blink led every time we fire this interrrupt.
Serial.print(inv_volts_local);
Serial.print(F(" Volts"));
Serial.println();
Serial.println(HV_Flag);
digitalWrite(13,!digitalRead(13));//blink led every time we fire this interrrupt.
//Serial.print(inv_volts_local);
// Serial.print(F(" Volts"));
// Serial.println();
// Serial.println(HV_Flag);
to make the serial monitor easier to read.
You'll notice the values printed in the serial monitor have a wider range than what the code has constrained them to
---ThrotVal = constrain(ThrotVal, 145, 620) ----
This is so you can decide the usable range/travel from your throttle pedal, so set accordingly
Once you determine what range of values you want to use, replace them wherever there was 145, 620 in the .ino.
REMEMBER TO UNDO THE COMMENT/UNCOMMENT CHANGES BEFORE YOU UPLOAD THE NEW CODE! OTHERWISE THE THROTTLE MAY NOT WORK!
Re: Leaf Gen 1 Inverter Board
Posted: Fri Apr 10, 2020 7:09 am
by Jack Bauer
Excellent write up. Thank you.
Re: Leaf Gen 1 Inverter Board
Posted: Fri Apr 10, 2020 10:50 am
by Cookie6000
That's brilliant.
Thanks for the detailed breakdown. Will have a go at that later
Re: Leaf Gen 1 Inverter Board
Posted: Sun Apr 12, 2020 7:13 am
by james@N52E01
Thanks for the help so far, nearly ready to try turning the motor. Iβve been through the inverter and resolver plug wiring diagrams and everything appears to match with what is connected to the board. Does anyone know what the 5v and second ground connectors are for on the inverter plug? I canβt find corresponding wires on either the inverter or resolver connectors.
FFA59A29-2F9A-4812-90A0-A5A7555B9158.jpeg (16.3 KiB) Viewed 18591 times