Page 1 of 1

Raspberry Pi ECU - smart 12V charging?

Posted: Thu Sep 17, 2020 1:35 am
by Isaac96
I keep dealing with a dead 12V battery in my car. There is certainly some power drainage going on, but it's rather a pain to test that all alone. Plus, I like adding more software complexity to solve hardware problems.

So, since I already have a Raspberry Pi running a dashboard for me, I've decided to make the Pi act as the central ECU for the vehicle.
With a CAN adapter connected via SPI, it will compile efficiency numbers from the odometer (somehow) and the ISA shunt. It will display all the metrics I could ever want.

And now it will control the DC-DC converter, which is a Volt model -- both when the car is on and running, and when the car is powered off completely (yes, I will leave a Pi on all the time, it idles at 0.4W) and keep the 12V battery from dying, probably using a crontab to run every 6 hours or so.

Now I am in need of more information, or at least brains to pick.
Does the Volt DC-DC draw any power when not given 12V to its logic side? I know there is a bleeder resistor but that is negligible.

I can read the 12V current and voltage, as well as setting the voltage, over CAN. Should I work on a smart charging algorithm of sorts instead of just slamming 13.5 volts for 20 minutes? I could certainly set up some sort of constant-current system, probably looping fairly slowly.
If the battery is at 12.6 volts and I set the DCDC to 12.2, will there be a backflow issue?

At some point I'll probably get around to testing all these ideas, just wondering if anyone has some previous knowledge or some educated guesses :)

-Isaac

Re: Raspberry Pi ECU - smart 12V charging?

Posted: Thu Sep 17, 2020 1:49 am
by slow67
I think Jon Volk on here set his VCU to check battery voltage every 15 minutes. If it was under a set voltage it turns on the DC to DC until an upper voltage is set.

Re: Raspberry Pi ECU - smart 12V charging?

Posted: Thu Sep 17, 2020 7:24 pm
by jon volk
Yup, I have a teensy3.6 running as my VCU. Take a reading off a voltage divider on an analog pin. If it drops below 12.2vdc, car kicks the dc/dc on for 15 minutes. Works great. Im not sure how much power the dc/dc draws when idle, but the convenience of never coming to a dead car outweighs anything it might draw.

Re: Raspberry Pi ECU - smart 12V charging?

Posted: Thu Sep 17, 2020 8:23 pm
by Isaac96
Awesome. I'll probably do the same then (will use a comparator since the Pi has no ADC). Also thinking about waking the BMS up at the same time to grab some pack data in case the car gets left for a long time.

Re: Raspberry Pi ECU - smart 12V charging?

Posted: Thu Sep 17, 2020 9:42 pm
by arber333
Damn guys, aren't you complicating things just a tad bit, don't you think?
Consider this, Volt DCDC efficiency drops with light load to as low as 70%! When I tried to do the same it kept heating up from 1A load.

What I do now is wire one 12V acdc tablet psu or some other psu which can draw power from 230Vac and create 2A of 12.6V or 13.6 if you are lucky.
This is then connected all the time and is a negligible load on HV. It also powers my fluid pump while I charge the car.

Re: Raspberry Pi ECU - smart 12V charging?

Posted: Thu Sep 17, 2020 10:30 pm
by Isaac96
Well I'm thinking of running a pseudo-CC-CV curve of sorts. I'll turn the DCDC on at 12.6, and if current is less than 5 amps it will increase voltage, over 20 amps reduce voltage. At any rate it will shut off after 20 minutes max. And this can run every 6 hours or so.
I do want my Pi running 24/7 since it will be doing all sorts of things - coulomb counting for one, since the ISA gets reset by the CHAdeMO controller.

Re: Raspberry Pi ECU - smart 12V charging?

Posted: Thu Sep 17, 2020 11:57 pm
by jon volk
In my case so didn’t want to rely on having the car plugged in at all. If I brought the car to the airport for a week long work trip, it would be dead upon return with the small 12v battery I have. It’s a fringe case, but one I want to account for.

Re: Raspberry Pi ECU - smart 12V charging?

Posted: Fri Sep 18, 2020 1:27 am
by Isaac96
That's what I'm dealing with -- my car's undergoing cooling mods and it died after 6 days (even with a full 70ah battery). Also adding automation is fun :)

Re: Raspberry Pi ECU - smart 12V charging?

Posted: Fri Sep 18, 2020 5:02 am
by arber333
Hm... you think of using DCDC CAN reports to find its status and guide it to a better state?

When i took one crashed Ampera for the sum of its parts i found it has a current sensor on 12V negative terminal. It is just one thick wire and ideal to place current sensor there. Maybe you could first monitor where your leak is and what would drain your battery over time.

Another thing... my 12V battery kept failing when i turned the key to start the car, due to large load of EHPAS and all the fans. Even with added 2A 12V PSU. Now i changed the start logic.
First i turned the key to the first position. Some prearanged power comes online. Then i turn to the 2nd position and most of the logic in the car wakes up. Now to this i added simpBMS enable and DCDC enable signals with CAN msg. So now i get full 14V power before i start the car with the intention to drive.

Re: Raspberry Pi ECU - smart 12V charging?

Posted: Fri Sep 18, 2020 8:39 am
by celeron55
Here's a different opinion: I think it's good safety practice to only connect anything to the HV battery after the main contactor, and only switch on the contactor if the ignition key is turned on or a charging cable is connected.

This way it is much less likely someone or something could get a shock from the system when the car is not in use, and disconnecting the 12V battery can be used for disabling the majority of the HV system. Personally I put the main contactor inside the battery enclosure, this way everything beyond the battery is dead.