Entire Car Controller.

Technical discussion on converting internal combustion to electric
francisco.shi
Senior Member
Posts: 749
Joined: Mon, 17 Sep 2018, 16:30
Real Name: Francisco
Location: Brisbane, Strathpine

Entire Car Controller.

Post by francisco.shi »

As some of you know I am converting a Pajero which is not a simple car. It has electric lots of things. It a somewhat modern car with enough powered features that it would be nice to have everything controlled via CAN instead of the original huge wiring harness.
It all started with the doors and the AC motorised flaps.
I tried to make a general purpose board that would do everything but that didn't turn out to be a good idea.
So far I got the hardware for the doors more or less done.
I was wondering if there is anyone interested in working towards building a car control system. I know it wouldn't be very useful for simple cars but as the cars available for conversion get newer the complexity of the accessories increases.
In cases where the the car is being restored and there is the chance of doing upgrades it may be a better option to replace the old wiring with a new controller.
There is also the possibility to add modern features to old cars (like electric windows, central locking and keyless entry)
Can I get some options?
Bukes
Groupie
Posts: 130
Joined: Tue, 26 Oct 2021, 19:15
Real Name: Alex

Re: Entire Car Controller.

Post by Bukes »

I’m on board!
(Pardon the pun ;)

Are we open sourcing this? I like openinverter approach - open source everything (including board circuit and bill of materials), but provide pre-built options via shop. It lets the community contribute to the project, while generating a bit of revenue from people that just want a plug and play solution
Bukes
Groupie
Posts: 130
Joined: Tue, 26 Oct 2021, 19:15
Real Name: Alex

Re: Entire Car Controller.

Post by Bukes »

Would be good to take a modular approach - a core set of features that every car needs (like ignition, headlights, precharge, OBD2 etc), but can be expanded with electric windows, keyless entry, etc.
Speeduino is another project that’s open source, takes in some of the sensors we care about, and provides some can support (at the moment just OBD2 out I think).
Bukes
Groupie
Posts: 130
Joined: Tue, 26 Oct 2021, 19:15
Real Name: Alex

Re: Entire Car Controller.

Post by Bukes »

Where do you want to start?

Hmm am I coming across too keen?
francisco.shi
Senior Member
Posts: 749
Joined: Mon, 17 Sep 2018, 16:30
Real Name: Francisco
Location: Brisbane, Strathpine

Re: Entire Car Controller.

Post by francisco.shi »

I have not thought about how to sell it. I can make the software available and sell the hardware. The board I am making has some parts that are not easy to get (like the relays). As for the software there isn't much to it. It comes down more to deciding what messages to send. I have not set a messaging protocol for the door controllers yet.
Originally I wanted to make a board that would do more than just the doors but after a bit of work (and not wanting to think too much) I decided that it is probably easier to make different boards for different applications. The difference is only the output stage. For the doors I am using relays to reverse the direction (it is much easier and uses less space) but for other use cases it may be better to use transistors.
I have got a new board coming which I think will be the final version.
What I think we would need to do is to get a few people currently doing a conversion and make a list of what is required and probably agree on a message format. I am trying to set the boards up such that they can take two methods. One will be a message that specifies what bit to turn on or off. This would allow fancy stuff to be done (like party lights). The other mode is one more generic for example say "left indicator on" then any board that has an indicator and is on the left side of the car will turn the correct output. This last method just makes it easy to do standard functions.
If anyone is interested in the door controllers let me know so I could make them all at the same time.
If anyone has any suggestions on message format also let me know.
Bukes
Groupie
Posts: 130
Joined: Tue, 26 Oct 2021, 19:15
Real Name: Alex

Re: Entire Car Controller.

Post by Bukes »

I’m interested
Has the aftermarket settled on a standard message format that we can adopt? It seems if we invent our own then only our own boards and devices will work with it. If that’s just the way canbus works, then so be it, but it would surprise me if there’s not a widely adopted format. It just seems logical to have one.

What architecture are you thinking? Single high speed canbus? Or several connected at a gateway? Or a low speed star topology?
Bukes
Groupie
Posts: 130
Joined: Tue, 26 Oct 2021, 19:15
Real Name: Alex

Re: Entire Car Controller.

Post by Bukes »

What’s going in the door controller?
Locks? windows? mirrors? Footwell lights? Door open / closed sensor?
Should probably start simple …
francisco.shi
Senior Member
Posts: 749
Joined: Mon, 17 Sep 2018, 16:30
Real Name: Francisco
Location: Brisbane, Strathpine

Re: Entire Car Controller.

Post by francisco.shi »

Heated mirrors, mirror fold in/out, indicator and inputs for central locking, door handle switch (to unlock the car) open/close window switch.
It adds up very quickly.

As far as I know everyone has their own format.
My body controller has 3 can bus channels. One is for critical stuff like inverters, charger, BMS.
One CAN bus channel for other stuff (like door controllers, lights, AC etc) and one CAN bus for external com's (like trailer).

I haven't decided on the message protocol.
Ideally I should get a few people that would be using it and see what their requirements are before deciding.
Bukes
Groupie
Posts: 130
Joined: Tue, 26 Oct 2021, 19:15
Real Name: Alex

Re: Entire Car Controller.

Post by Bukes »

I think multiple bus channels is normal - I think modern Toyotas have 8 or more. Which means we need to include a gateway.
Anyway… until anyone else jumps on board maybe we go forward with what you’ve got (3 channels), and start fleshing out a physical architecture.

So you want to start with the door controller… will each door operate independently or will they be coordinating each other? (ie are all the buttons and actuators together in one place or do we have buttons on one door communicating with actuators on other doors?) assuming central locking, and driver side controls for passenger side mirrors, then it’s the latter.

Which means potentially 3 different door controller boards (driver side, passenger side, and child / back seats). Each with their own set of inputs / outputs, and thus likely their own pcb design and own set of code. Potentially a 4th if you consider central locking for the boot?

do we also need a “body controller” board? Some cars have controls for windows and motors in the middle of the car, not in the doors. Some also alert the driver if a door or the boot is left open, and I guess the interior lights are affected by this too.

My cars a 2door coupe, but has rear seats and will have rear electric windows… might need child control on these. Probably just a partial implementation of the child/back seat board though and not requiring a full board.

Once we’ve sorted that out, then to discuss the i/o requirements for each board. What actuators each will need to control, what messages it will broadcast, and what messages it will respond to.

As for format, it doesn’t seem to matter that much does it? Unless there are existing boards we want to work with, that have canbus interfaces well defined so we can work with them, then we are just communicating with our own devices.

Are the choices just canopen and j1939? Or do you want to go deeper than that and define baud rate etc?
francisco.shi
Senior Member
Posts: 749
Joined: Mon, 17 Sep 2018, 16:30
Real Name: Francisco
Location: Brisbane, Strathpine

Re: Entire Car Controller.

Post by francisco.shi »

My plan was to use the same board on all doors and just have a setting to tell it what door it is on. I am going to have a body controller. My plan so far is the door controller will broadcast the input status. The body controller will decide what to do and will send a message to the door controller. For example, say we have the door window switches connected to the right hand door and the right hand door window button is pressed. The door controller broadcasts the state. The body controller reads it, it decides if it wants to allow the window to be opened and it sends the open command to the right door controller which then actuated the motor.
I already have the hardware built. What is left is to decide on the comms protocol.
I want to start simple and do not try to make it too complex (use a fixed baud rate and at most programmable addresses).
I should have the boards today. I will assemble one to confirm no mistakes and if ok I will make a run for what I need.
The current board has 16 digital inputs, 4 analogue inputs and 16 digital outputs of which 10 drive half bridge relays that alloe for bidirectional control of motors. The other 6 have 5bit own output capability.
The board should be able to be used for other tasks that have the same IO requirements.
Bukes
Groupie
Posts: 130
Joined: Tue, 26 Oct 2021, 19:15
Real Name: Alex

Re: Entire Car Controller.

Post by Bukes »

Cool, what is the processor on the boards? Sounds like the Mega 2560?

Your design makes the software for the doors pretty simple. It’s not really deciding anything for itself, just taking action on an interrupt from the door switches (notify the body controller), and on interrupt from the canbus (execute the body controllers commands, such as activate the relays, etc)

More complexity required in the body controller to compensate, but probably easiest to track state in one controller anyway, so that makes sense
Bukes
Groupie
Posts: 130
Joined: Tue, 26 Oct 2021, 19:15
Real Name: Alex

Re: Entire Car Controller.

Post by Bukes »

Also which canbus controller and transceiver chips are you using?
User avatar
4Springs
Site Admin
Posts: 841
Joined: Thu, 23 Dec 2010, 01:14
Real Name: Christopher Walkden
Location: Selbourne, TAS

Re: Entire Car Controller.

Post by 4Springs »

I'm interested in this project, although I won't be doing anything just yet.
Are you talking only typical car things, or would it extend to the things we put into our conversions?
Things I'd like to control/monitor:
  • Charger (they all seem to use CAN bus now, and all the ones I've seen use the same signals).
  • Charging Socket (what state is it in). Used for interlocking the drive contactor, also for charger control.
  • BMS.
  • Display of some kind, which might just be an alarm output (check engine light).
  • Throttle (assuming that this system would respond fast enough)
Making the code available would be great, assuming that the tools required to re-program are readily available. The frustration I have with off-the-shelf systems is that they never quite do exactly what I want. A mixture of buy the board / program yourself would suit me well.
Thinking about this, it might make it more accessible if the Body Controller was something commonly used, like an Arduino or Raspberry Pie. Not that I have any experience in either of those, but I think the learning curve for those systems is well travelled.
francisco.shi
Senior Member
Posts: 749
Joined: Mon, 17 Sep 2018, 16:30
Real Name: Francisco
Location: Brisbane, Strathpine

Re: Entire Car Controller.

Post by francisco.shi »

Bukes wrote: Sat, 23 Apr 2022, 19:24 Also which canbus controller and transceiver chips are you using?
Atmega328 for processor. MCP2515 for CAN controller and MCP2510 (or it may be MCP2520) for CAN transceiver.
I am not sure how long I can keep using the ATMega because of chip shortages. I have about 100 in stock but not sure when I can get more at a decent price.
francisco.shi
Senior Member
Posts: 749
Joined: Mon, 17 Sep 2018, 16:30
Real Name: Francisco
Location: Brisbane, Strathpine

Re: Entire Car Controller.

Post by francisco.shi »

4Springs wrote: Sun, 24 Apr 2022, 06:27 I'm interested in this project, although I won't be doing anything just yet.
Are you talking only typical car things, or would it extend to the things we put into our conversions?
Things I'd like to control/monitor:
  • Charger (they all seem to use CAN bus now, and all the ones I've seen use the same signals).
  • Charging Socket (what state is it in). Used for interlocking the drive contactor, also for charger control.
  • BMS.
  • Display of some kind, which might just be an alarm output (check engine light).
  • Throttle (assuming that this system would respond fast enough)
Making the code available would be great, assuming that the tools required to re-program are readily available. The frustration I have with off-the-shelf systems is that they never quite do exactly what I want. A mixture of buy the board / program yourself would suit me well.
Thinking about this, it might make it more accessible if the Body Controller was something commonly used, like an Arduino or Raspberry Pie. Not that I have any experience in either of those, but I think the learning curve for those systems is well travelled.
I am starting with the doors because it is the simplest and I will need them. The plan is to have other peripheral boards to do standard functions and try to keep a standard CAN protocol.

I already have a board to control the original dash and to read some of the steering controls (like cruise, indicators, wipers) and I have a customer that makes aftermarket dashes that will work with the body controller.
https://www.google.com/url?sa=t&source= ... Su8oWd1sNs

I am also working on the AC module and hope I will have a module that will do heating and cooling using a a heat pump and will be able to use the heat from motors and inverters to provide cabin heating rather than having a radiator to throw away the heat from the inverter and make heat for the cabin.

For body controller I am using a board with an ESP32 with 3 CAN channels, 8 bits of digital in 8 bits of digital out and 8 ADCs.

I am happy to provide the peripheral boards and modules and make the code available.

The plan is to make the body controller available and for it to be configurable to run different inverters and chargers but it will most likely be sold by Grahame from Suzie auto. He wants to use it on his conversions.
The idea is to provide a body controller that will integrate more like an OEM controller. Things like keyless entry turtle mode GOM cruise control (potentially radar cruise control) one pedal driving, traction control etc.

The problem with allowing people to modify the body controller software is that it can very quickly become a big mess and is also a mission critical system.
Bukes
Groupie
Posts: 130
Joined: Tue, 26 Oct 2021, 19:15
Real Name: Alex

Re: Entire Car Controller.

Post by Bukes »

I wonder if we need to split the body (motor) controller out from the body (interior) controller? Otherwise the cost of the body might be excessive for those who have their own motor control setup. I can develop a test harness for the door boards without a body board… but ultimately I’d need a body board too.

Dashboard is a bit different, depending on how you’ve designed it? If it’s just a listener board, taking RPM etc from Canbus and driving the dashboard lights etc, then that will work unchanged. In that scenario I assume the motor controller has the smarts - monitoring physical sensors and transmitting rpm etc to canbus for dash to use.

But if the dash has the sensors etc hooked in then we may need to split that too
francisco.shi
Senior Member
Posts: 749
Joined: Mon, 17 Sep 2018, 16:30
Real Name: Francisco
Location: Brisbane, Strathpine

Re: Entire Car Controller.

Post by francisco.shi »

I was going to keep the motors and charger on a separate CAN channel and other stuff like doors and headlights on a separate CAN channel.
You can do the testing just by sending messages with any CAN spy device.

For the dash we can use the body controller to do the translation so the dash doesn't have to be modified for different motors/BMS.

The one I have designed has 16bits of digital input and 5 analogue inputs.

I use the inputs to read the controls on the steering but other than that it just listens.
HungryTradie
Noobie
Posts: 14
Joined: Mon, 21 Mar 2022, 12:45
Real Name: Jeff
Location: Bathurst

Re: Entire Car Controller.

Post by HungryTradie »

G'day Francisco, much respect for your skills and knowledge, you are truly one of a kind!

If you get some more software nerds: have you investigated GIT for sharing your project? You may find some Europeans or Yanks that have already done some work on integrating devices to bespoke CANBUS modules.

I'm very very interested in your motor/transfer case/CV coupling to the existing diff. Do you think a single motor could be capable of motivating your Pajero (or my Hilux), or does it absolutely have to be a two motor design?
1HungryTradie
francisco.shi
Senior Member
Posts: 749
Joined: Mon, 17 Sep 2018, 16:30
Real Name: Francisco
Location: Brisbane, Strathpine

Re: Entire Car Controller.

Post by francisco.shi »

I don't know how to use github. But I am happy to upload the project if someone wants to set it up.
I am not sure about a single motor for a Ute. It should work but if I use only one motor it feels very slow. It is almost like trying to start in second gear.
If you have a manual gearbox it would be easier to keep the old gearbox.
Bukes
Groupie
Posts: 130
Joined: Tue, 26 Oct 2021, 19:15
Real Name: Alex

Re: Entire Car Controller.

Post by Bukes »

Hey Francisco, happy to upload to git and share (and walk you through it). It’s pretty simple. Will need either the code or sample board or at least a diagram of the board design in order to get going
Bukes
Groupie
Posts: 130
Joined: Tue, 26 Oct 2021, 19:15
Real Name: Alex

Re: Entire Car Controller.

Post by Bukes »

francisco.shi wrote: Mon, 02 May 2022, 17:21 I don't know how to use github. But I am happy to upload the project if someone wants to set it up.
I am not sure about a single motor for a Ute. It should work but if I use only one motor it feels very slow. It is almost like trying to start in second gear.
If you have a manual gearbox it would be easier to keep the old gearbox.
Github is intimidating, but simple once you get to know it. Certainly far easier than building an entire fricking inverter from scratch, which I note is only one of your very many complicated achievements. Github is a piece of cake compared to those.

Think of it more like Google Drive / One Drive / Drop Box.

You already have a local folder on your computer where you keep all of your project files (code, pcb board design, bill of materials, etc)
Once you create your github account (free), you can create a repository online - this is really just a folder.
You then install the Github software on your computer, and synchronise the two (your local folder on your computer, and the online repository on Github).

The only things you need to really understand to "get it":
- It doesn't just have to be 'code', any file type is fine. Many projects include code, board design files, gerbers, bill of materials, etc.
- The online repository is the master copy / source of truth. Even if the files started on your computer, your computer's copy is no longer the master, and from here on you will manage how your local copy is synchronised with the online master in github.
- If you provide public access to your repository, then people can take a copy of your repository ('fork it' into a new repo they control), and make whatever changes they want. Think of it like a fork in a road or timeline... your main master branch continues unchanged in your repository, while their fork can be changed / modified updated in their repository. You can control the licence under which your code is shared (eg MIT open source licence)
- You always control YOUR repository - Other people can 'pull' updates from your master repo if you update / improve the master branch, but they can only 'request' to 'push' or 'commit' a change back to the master branch: you have control over whether or not you accept those requests.
- Github also helps manage merge conflicts (ie where you've both changed the same file, and the changes don't match when someone tries to merge the change back into the master).


AEVA has a github repository already, although it's barely used. Rob Hills (webmaster) seems to manage it. I've asked if it's possible for both of us to have greater access to it (ie to create new repositories, manage repo access, and review / approve code changes).

https://github.com/AEVA-asn-au
rhills
Site Admin
Posts: 596
Joined: Fri, 25 Jul 2008, 01:57
Real Name: Rob Hills
Location: Waikiki, WA

Re: Entire Car Controller.

Post by rhills »

Bukes wrote: Thu, 12 May 2022, 11:32 ...
AEVA has a github repository already, although it's barely used. Rob Hills (webmaster) seems to manage it...
You're correct, the AEVA Github Organisation isn't used much at present as there's so far not been much call for it. John Clark actually created our presence on GitHub, and it's a little while since we last did any admin activities with it so I'm not sure what powers I have apart from creating repositories.

I do have a fair bit of AEVA stuff in some personal repositories and one of these days I'll work out how to migrate them across to the AEVA Github Organisation area without breaking anything.
Bukes wrote: ... I've asked if it's possible for both of us to have greater access to it (ie to create new repositories, manage repo access, and review / approve code changes).
https://github.com/AEVA-asn-au
Have you? I must have missed that sorry. Where did you ask?

Anyway, I'm not sure I even have the power to add you as a member of the AEVA "organisation" on GitHub as I can't find any obvious way of doing that on the Github site today. It's probably best if you contact John Clark via Github in the first instance, and reference this post.

Cheers,
Rob Hills
AEVA Webmaster
2014 Mitsubishi Outlander Aspire PHEV
Petrol Usage to last refill: Jul 2014 - Mar 2022
Total Petrol: 872.3L
ODO: 85287
Av Consumption: 1.02 L/100km

On order: Tesla M3 MIC LR
rhills
Site Admin
Posts: 596
Joined: Fri, 25 Jul 2008, 01:57
Real Name: Rob Hills
Location: Waikiki, WA

Re: Entire Car Controller.

Post by rhills »

rhills wrote: Thu, 12 May 2022, 18:15
Bukes wrote: ... I've asked if it's possible for both of us to have greater access to it (ie to create new repositories, manage repo access, and review / approve code changes).
https://github.com/AEVA-asn-au
Have you? I must have missed that sorry. Where did you ask?
Ah, I see now, on another thread. Best if we keep it all in the one place, so I'll respond over there.

Cheers,
Rob Hills
AEVA Webmaster
2014 Mitsubishi Outlander Aspire PHEV
Petrol Usage to last refill: Jul 2014 - Mar 2022
Total Petrol: 872.3L
ODO: 85287
Av Consumption: 1.02 L/100km

On order: Tesla M3 MIC LR
francisco.shi
Senior Member
Posts: 749
Joined: Mon, 17 Sep 2018, 16:30
Real Name: Francisco
Location: Brisbane, Strathpine

Re: Entire Car Controller.

Post by francisco.shi »

I understand how it works. I have some version control software I use (perforce) which was installed in my server by someone long ago.

The main difficulty is learning what buttons to press and what software to install and make sure it works.
Bukes
Groupie
Posts: 130
Joined: Tue, 26 Oct 2021, 19:15
Real Name: Alex

Re: Entire Car Controller.

Post by Bukes »

Thanks Rob
Yep, that’s true, Francisco

And it changes from time to time as the software improves, too.

How do you want to move forward with this?
Not much I can do without at a minimum the board design (or a conceptual diagram of the inputs / outputs and the pins they’re connected to)
Post Reply