Nice work! How did you find the AI with the coding Alibro? (in my day, it was called programming, but hey, I am old)
It is much better than you would expect.
You can use ChatGPT or Claude or a couple of others, but I recently switched browser to Brave because it has adblock built in (Which works great in Youtube BTW) but it turns out the default search engine in Brave gives an AI answer to all searches. The other AI's only allow a small number of interactions before they ask for money or say come back in a few hours. I didn't have this issue with Leo and the results seemed to be as good as ChatGPT or any other.

I was taught in 1980 that a programme was something you watched on BBC1, BBC2 or ITV, a program is a piece of code that runs on a computer.
It may have been an Americanism even then but I stuck with it, also I may have misspelled it but if so I stand corrected. 😊

Edit: I just realised you were referring to me calling it coding. Yeah I struggle with that too cause I'm old too but trying to get down with the kids. 🤣
 
just watched the video - ChatGPT made a LOT of mistakes and it looks as though you really need to know a bit of coding (programming!) to see where it’s gone wrong to correct it. But I guess it gives you a start!
 
just watched the video - ChatGPT made a LOT of mistakes and it looks as though you really need to know a bit of coding (programming!) to see where it’s gone wrong to correct it. But I guess it gives you a start!
Yes I found the same with all of them. I know a little about programming and I can follow the logic even if I don't fully understand everything but as you say it did all the hard work for me so all I needed to do was tweak it a bit.
 
Last few days I've been playing with the VCU firmware trying to figure out if it was possible to have regen.
It should hopefully help improve the range a bit but even more important it should take some pressure off the brakes.
At the moment the brakes are great but probably over worked without any engine braking so a little regen should help.
The reason I haven't done this before is when it comes to Arduino coding I'm thick! My Mrs would say I'm thick in many ways but that's another story.
Anyway I recently watched a video where a Youtuber was using AI to generate Arduino code so figured it was worth a try.



So after several days playing with it I've finally got regen working.
There are two ways regen works in EV's, first when you lift off the throttle which gives a gentle slowing down effect and second when you press the brake pedal which is much stronger. In my case I can't easily have lift off regen because I need to lift off to change gear. In theory I could rig up a switch to stop the regen as I change gear but that's a lot of complexity. Maybe some day.
In the meantime I use the brake light switch to trigger the regen by just touching the brake pedal, it starts low and ramps up over a set time which is currently 850 milliseconds and provides fairly strong retardation, I've seen up to 100A going back into the batteries.
It probably needs a bit more tweaking but for the moment I'm happy it's working so I'll get back to setting up a timer to start charging at 2am for the cheaper leccy.

If you need a switch to indicate that you are changing gear rather than just coasting... maybe you could add a 3rd pedal :rolleyes:

AI is just an exceedingly over used term because it is trendy. Nothing (yet) really is AI.

Originally programs were written in machine code (0s and 1s), then assembler came along to make this "more human readable" that converted it to machine code, then languages like Pascal, Fortran, COBOL etc that took what you asked it to do and spat out assembler or machine code (or intermediate code that was 'intelligently' interpreted at 'run time'. I believe these are 1GL, 2GL and 3GL. Then there were 4GLs, 5GLs etc that took the programming input to a higher levels more separated from the way computers actually perform the tasks requested. These were mainly sold as ways to speed up building programs. What you say about generating code is simply just an extension of this to output Arduino code.

However, what you have found is that everything has limitations and you have had to adapt its output. What you will then find is that if you want to modify your input to this 'AI' - ie give it more requests to fulfil, you will have to start all over again fixing the output it produces to actually work. It won't take your working code and be able to build on it. I'm pretty sure it won't be that 'intelligent'.
 
If you need a switch to indicate that you are changing gear rather than just coasting... maybe you could add a 3rd pedal :rolleyes:

AI is just an exceedingly over used term because it is trendy. Nothing (yet) really is AI.

Originally programs were written in machine code (0s and 1s), then assembler came along to make this "more human readable" that converted it to machine code, then languages like Pascal, Fortran, COBOL etc that took what you asked it to do and spat out assembler or machine code (or intermediate code that was 'intelligently' interpreted at 'run time'. I believe these are 1GL, 2GL and 3GL. Then there were 4GLs, 5GLs etc that took the programming input to a higher levels more separated from the way computers actually perform the tasks requested. These were mainly sold as ways to speed up building programs. What you say about generating code is simply just an extension of this to output Arduino code.

However, what you have found is that everything has limitations and you have had to adapt its output. What you will then find is that if you want to modify your input to this 'AI' - ie give it more requests to fulfil, you will have to start all over again fixing the output it produces to actually work. It won't take your working code and be able to build on it. I'm pretty sure it won't be that 'intelligent'.
I agree that the term is massively over used. AI has been around for years in one form or another. Computers have been playing chess and other strategy games since the ZX80 came out and even earlier so that was a type of AI.

But the difference now is it is so much better it's actually useful. It was able to read my question, recognise the context, interpret what I was trying to achieve and provide an answer. No the answer was not perfect but I couldn't have written the code myself, at least not the clever bit that ramps up the regen over a set time.
For me it is both impressive and scary at the same time because if it can do this today then what will it be able to do in five or ten years.
 
Could you use a clutch switch to disable regen when changing gear ? There must be a mount for one to allow for peeps that added cruise when purchasing new ?
 
The clutch bracket does indeed have a bracket for a microswitch (which is generally unused - I guess a legacy thing from earlier versions of the HDC etc)
 
You guys are probably right and TBH I had considered reinstating the clutch for this but I don't think it would be worth the effort. I've been playing with the settings and it works great as it is, and you know the old saying? "Keep it simple STUPID"
This is especially true where throttle control is involved, I've already had one of the main programmers in Openinverter tell me I'm being reckless using AI to help write code that controls the throttle and he has a point. In my defence I'm able to test up and down my lane before taking it onto the road and the road is a quiet country B road so the testing is being done in pretty safe circumstances.
Also I'm still hoping to get a pedal set from an Auto cause I like the extra big brake. ;)
 
Which two gears do you use most? First and reverse already have switches (for HDC) so adding one to second would not be too much hassle?
 
Which two gears do you use most? First and reverse already have switches (for HDC) so adding one to second would not be too much hassle?
I mostly start off in 2nd and use it up to 30mph, third up to 50mph and 4th thereafter.
But the switch is not the issue, like you said it would be relatively trivial to fit a switch to the clutch pedal and reinstate it. The bigger issue is the coding (programming) of the throttle for lift off regen. It already scares me messing with the throttle control while under braking but at least I have my foot on the brake pedal when that is happening.

Maybe I'm over thinking it and maybe it would be safer to play with the throttle control only and keep the brake as a kill switch for the throttle but for now I'm happy just to have some regen rather than none. I'll give it a month or two and maybe rethink it.

But right now I'm playing with a LM393 that just turned up. I plan to use it to turn on the on board Outlander PHEV charger when the plug is pushed in, so I don't need to leave the ignition turned on all the time. I've never worked with one of these so doing lots of online searching for inspiration.
 
This is a post I put on the OI forum and got a couple of pointers what to do.

"Hi guys
I'm joining this thread because I'm currently trying to figure out a way to automate charging when I plug in the charger cable and at the same time figure out how to start charging at 2am when my electricity is half price.
I'm using an old Nissan Leaf J1772 socket as it came free with the Leaf I stripped.
I do not have a Zombieverter, I'm using a VCU very similar to Gregs 450h VCU from Damien but mine is for a Gen1 Leaf inverter and motor.
I spent a couple of hours messing about yesterday trying to figure out how PP works and managed to confuse myself completely by stupidly having two multimeters connected at the same time. I'd been metering under the bonnet then went to the connector at the back of the car with a different multimeter to check there and didn't disconnect the first meter.
TOP TIP. Never have two multimeters on the same circuit at the same time!!!

Anyway once I realised my mistake it was simple to meter the cable, first without a charger cable plugged in, with it plugged in and for a bonus with the release latch pushed and the results are as below.

These are without the 220R resistor I normally have connected.
2.68k - No cable plugged in (the 2.68k is in the J1772 socket)
140R - Cable plugged in but not charging
145R - As above but charging
400R - Latch pushed on the J1772 handle.
405R - As above but charging

With the PP line connected to ground through a 220R resistor. This is required to charge at a public charger.
205R - No cable plugged in but not charging
85R - Cable plugged in and ready
60R - As above but charging. (This bounced around a bit but settled at 60R)
143R - Latch pushed on the J1772 handle.
93R - As above but charging.

So now I have this data I need to implement it in my car and I plan to use an Aduino Uno for this. I know it would make more sense to use the Due I use to control the charging but when I checked, an Arduino Due draws 120mA whereas an Uno draws 20mA so to save the battery I plan to try and use an Uno. I'm totally hopeless at writing code so mostly copy the work of others or use AI but when I get something working I'll come back."

One of the guys got back and advised I use a LM393 comparator so I have parts on order.
This was also shared so I should be able to sort something next week.

J1772_signaling_circuit.svg.png
 
Or just have a timer on the charge outlet at home so there's no power until 2am ? Add an override so you can still charge at other times if required. The car then cannot charge until 2am.
 
Or just have a timer on the charge outlet at home so there's no power until 2am ? Add an override so you can still charge at other times if required. The car then cannot charge until 2am.
I considered that and even bought an immersion heater timer as my car only ever draws 3kW, but that doesn't resolve the issue of the car being turned on at the ignition switch right through the night. What I do at the minute is start charging by turning on the ignition after plugging in, then set an alarm on my phone for the time I think it should complete so I can go out and check. It does stop charging at the required voltage but I need to turn the ignition off manually.
The new plan is to have a low power circuit running all the time to monitor the charging socket and only when a cable is plugged in, turn on the various bits required for charging. This can also have a timer built in so it only activates at the 2am but can also be over ridden with a switch if I want to charge during the day.

I wrote a list of what needs to be activated for charging which I hope is complete.
AC/DC Charger
Coolant pump
Arduino's that control charging and coolant pumps
Contactors in boot battery box
Negative contactor in HV box
Positive contactor in HV box (positive feed)
VCU (it controls precharge and the negative feed to the positive contactor)
Current sensing shunt.
Inverter (I think the VCU will need to see it active or it won't enable the contactors)
Throttle disable (to avoid the possibility of driving away with the cable plugged in).

I think this is everything, many of these have the same 12V feed so a single relay should suffice for some of them.
I'm planning to splice relays into the existing 12V feed for each device so that they receive 12V through the normally closed contacts when the EVSE is not plugged in, then when it is plugged in and the relays are activated they will be disconnected from their usual supply (which is enabled by the ignition switch) and will instead be fed from a 'Charger 12V' supply. This is to avoid back feed to other devices that don't need to be turned on for charging like the power steering. Please think about this and let me know if it makes sense.

As usual guys I'm using you as a sounding board. Not only do I appreciate your input but it really helps my own thought process putting my crazy ideas in writing.
 
You guys are probably right and TBH I had considered reinstating the clutch for this but I don't think it would be worth the effort. I've been playing with the settings and it works great as it is, and you know the old saying? "Keep it simple STUPID"
This is especially true where throttle control is involved, I've already had one of the main programmers in Openinverter tell me I'm being reckless using AI to help write code that controls the throttle and he has a point. In my defence I'm able to test up and down my lane before taking it onto the road and the road is a quiet country B road so the testing is being done in pretty safe circumstances.
Also I'm still hoping to get a pedal set from an Auto cause I like the extra big brake. ;)
There's no need for a clutch pedal Ali, just use the brake to "blend" the regen with the hydraulic brakes. This is the most basic form of regen, which works just fine for most driver's.

Our Ioniq 5 has loads of different regen settings, but we just leave it in auto mode most of the time, then add more braking with the brake pedal, which adds regen before the hydraulics take over with a harder pedal push.
 
There's no need for a clutch pedal Ali, just use the brake to "blend" the regen with the hydraulic brakes. This is the most basic form of regen, which works just fine for most driver's.

Our Ioniq 5 has loads of different regen settings, but we just leave it in auto mode most of the time, then add more braking with the brake pedal, which adds regen before the hydraulics take over with a harder pedal push.
Thanks mate, You're right about this but it isn't as easy to implement as I hoped. I took the car out for a drive tonight with 4 passengers and found there are several issues with the brake pedal regen. All the testing I had done was on a small country road where it seemed OK but on a main road when approaching junctions it's a bit too strong. I found it difficult to time when to touch the pedal as the car slowed down too much. Also I usually change to a lower gear while slowing for a corner or junction but while regening (is that a word?) this isn't possible so I need to wait until I've lifted off the brake before changing, it's not a deal breaker but not ideal. Also I found if I was a bit too early touching the brake and released it the braking became very not smooth for my passengers.
OEM cars have pressure sensitive brake pedals to increase or decrease the regen whereas I have a switch so I have one setting only and this has to be suitable for all occasions. In theory I can reduce the regen as the car slows but this is harder to figure out than I hoped so initially I'll turn it down a bit and will have another go at it later.
 
Thanks mate, You're right about this but it isn't as easy to implement as I hoped. I took the car out for a drive tonight with 4 passengers and found there are several issues with the brake pedal regen. All the testing I had done was on a small country road where it seemed OK but on a main road when approaching junctions it's a bit too strong. I found it difficult to time when to touch the pedal as the car slowed down too much. Also I usually change to a lower gear while slowing for a corner or junction but while regening (is that a word?) this isn't possible so I need to wait until I've lifted off the brake before changing, it's not a deal breaker but not ideal. Also I found if I was a bit too early touching the brake and released it the braking became very not smooth for my passengers.
OEM cars have pressure sensitive brake pedals to increase or decrease the regen whereas I have a switch so I have one setting only and this has to be suitable for all occasions. In theory I can reduce the regen as the car slows but this is harder to figure out than I hoped so initially I'll turn it down a bit and will have another go at it later.
The worlds on F1 with over exuberant braking.
 
Thanks mate, You're right about this but it isn't as easy to implement as I hoped. I took the car out for a drive tonight with 4 passengers and found there are several issues with the brake pedal regen. All the testing I had done was on a small country road where it seemed OK but on a main road when approaching junctions it's a bit too strong. I found it difficult to time when to touch the pedal as the car slowed down too much. Also I usually change to a lower gear while slowing for a corner or junction but while regening (is that a word?) this isn't possible so I need to wait until I've lifted off the brake before changing, it's not a deal breaker but not ideal. Also I found if I was a bit too early touching the brake and released it the braking became very not smooth for my passengers.
OEM cars have pressure sensitive brake pedals to increase or decrease the regen whereas I have a switch so I have one setting only and this has to be suitable for all occasions. In theory I can reduce the regen as the car slows but this is harder to figure out than I hoped so initially I'll turn it down a bit and will have another go at it later.
I had another thought last night. Went picking up our youngest from work, it occurred to me that I automatically pull the left hand steering wheel regen paddle to slow down quickly.
Would adding a paddle to the steering wheel be advantageous to apply full regen? There are spare lines available on the clock spring to make the connections. All you'd need to do would be work out some form of pull switch to apply regen by hand. Just like me, using a regen paddle becomes second nature.
 
I had another thought last night. Went picking up our youngest from work, it occurred to me that I automatically pull the left hand steering wheel regen paddle to slow down quickly.
Would adding a paddle to the steering wheel be advantageous to apply full regen? There are spare lines available on the clock spring to make the connections. All you'd need to do would be work out some form of pull switch to apply regen by hand. Just like me, using a regen paddle becomes second nature.
Yes mate, that's a good call, I rarely use the channel change buttons for the radio so could try them. The only issue that springs to mind is finding another input on the VCU to use but I'm sure there would be some way to manage it.
In the meantime I've spent more time playing with the settings and I'm getting pretty close to something acceptable so it's going down in the priority list as I still need to sort the charging.
 

Similar threads