ESP32 based CAN project

pete_d

Member
VIP Member
T6 Pro
I’ve been tinkering with an ESP32-based CAN listener for my 2017 Transporter as part of a bigger project. I’m looking at ideas for what else I can get from the convenience CAN bus, so I thought I’d share what I have so far and hopefully others doing similar things might be willing to share too.

I did started tis thread off some time ago, and i have finally got around to having something working! CAN bus or LIN Bus

The larger project idea is to build a Raspberry Pi-powered “home assistant” type thing for the camper. I'm calling it VannyPi! It’s up and running, but very much beta at the moment. The Pi collects data via BLE from the fridge and night heater and talks to a Renogy Core One unit via WebSockets and gets things like shunt, DC to Dc charger and mppt information. It interfaces with my this ESP32 CAN module over BLE. There is also an ESP32 screen up front providing quick-view information for all of the above, as well as a GPS compass and levelling information from a gyro attached to the base of the bed.
All of this information is presented in a PWA (basically a mobile phone app) that uses Cloudflare to provide secure remote access. The van has a portable 5G router in it for this… and for the kids’ Netflix!
I say it’s in beta because, while everything generally works well, however the Bluetooth connections are still very flaky. I’m currently working through that.

Current ESP-Can bus functionality

The ESP32 is paired with an MCP2515 transceiver on the convenience CAN bus (100 kbit/s), tapped into the back of the radio head unit.

Not going to lie, I did a lot of CAN bus sniffing and then had AI help decode some of it, as I could not work it out myself!
CAN IDSignalsHow to determine the result
0x470Doors & exterior lightsByte 1 identifies the door: 0x00 = all closed, 0x01 = driver, 0x02 = passenger, 0x05 = sliding, 0x61 = tailgate. The lights are considered on when byte 2 equals 0x5C.
0x291Central lockingByte 0 value: 0x89 = locked, 0x49 = unlocked.
0x381Driver window positionByte 2 gives the driver’s window position. 0x00 means closed, any other value indicates the window is moving/open.
0x3B5Passenger/all windowsAppears to report all window movement, but I’m still trying to reliably separate passenger and driver window activity.
0x527Interior lightBit 0 of byte 6: 1 = light on, 0 = off.
0x571Battery voltageByte 0 is converted to voltage using (byte0 / 20) + 5 volts (code currently uses ((buf[0]/2)+50)/10).
0x621Trailer connectionByte 4: 0x83 indicates a trailer connected, 0x80 indicates no trailer. A debounce timer smooths transitions.

Questions for the community​

  • Has anyone else decoded additional CAN IDs on the convenience bus? I know there are more signals out there, but I haven’t had time to reverse-engineer them yet.
  • If you’ve got working code or know of other IDs for the T5/T6 platform, I’d love to hear about them or see your snippets.
  • I think my window decoding is still incorrect/flaky. The driver’s side seems fairly stable, but the passenger side is very hit-and-miss.
If people are interested in the larger project, let me know and I can provide more information on that as well.
The heater and fridge integrations were based on existing GitHub projects, but the Renogy Core One WebSocket integration was reverse-engineered from scratch.
 
This is my kind of geekery
:)

Interested to know more about the bigger projects. Does your setup allow for remote control of the overnight heater and other elements of your setup?
 
Yes, so the fridge and heater are two-way control. The fridge is pretty stable. The heater has Bluetooth issues. (All the BLE issues are in my code, so they will hopefully be fixed.)

Most of my leisure electric switches run through Renogy Smart ZigBee relays, which allows me to control them remotely as well.

I have just bought a bunch of Shelly 3 smart relays, as these can run at 12V and are very open to interfacing with, so I will start using these moving forwards, as the Renogy smart relays can no longer be bought.

All the CAN bus stuff is ready only. It is too complex / risky to start writing on the CAN bus in my opinion for the rewards.

When I have time I will provide greater details of what I have done.
 
Interesting, I planned to do simple CAN controller on ESP32 for DPF controlling. But... have no time now and all parts are waiting :D happy to hear ideas what you do in your car :)
 
I've been playing with an esp32 and I have mine showing the battery stats and solar. I was kind of thinking about making a post on here to sell them to members, or showing people how to make their own.

I only have victron stuff, but brother in law uses eco worthy. So I plan to add this into the stack.

I have put my firmware on GitHub. Not sure if im allowed to link it (it's free).

I guess I would need to see what mods wish me to do. I'm aware some people are not technical, so I'd put one together for others if they want it

17799758582098954478887235937995.webp

17799758977618947629903199763087.webp
 
I've been playing with an esp32 and I have mine showing the battery stats and solar. I was kind of thinking about making a post on here to sell them to members, or showing people how to make their own.

I only have victron stuff, but brother in law uses eco worthy. So I plan to add this into the stack.

I have put my firmware on GitHub. Not sure if im allowed to link it (it's free).

I guess I would need to see what mods wish me to do. I'm aware some people are not technical, so I'd put one together
Well done, cool work.
Please feel free to share.
Thanks.

I'm by no means starting a business here, I have ordered 10 units from Ali express, which I will program for people in the forum if they want them. I could get a few more if I needed.

Working perfectly on victron.

I will post a sales post with proper dets
 
Last edited:
Back
Top