USB-C to VESC CAN-forward adapter - cheap and DIY!

Espressif not understanding what semantic versioning is, or how it works, is a never-ending frustration.

1 Like

Just put this together and connected it all up. Pulled 5v from the vesc but I am not getting anything connecting through Canbus. When I scan canbus while connected to the ESP board. Canbus only shows the Express T module. When I connect to the vesc through USB serial it only shows the vesc in the lower left after scanning. Am I’m I missing something?

I had some bad canbus modules, only about 35% of them worked and showed up in VESC tool. Must’ve been a bad batch, AliExpress is great for that.

2 Likes

Ok, I’ll try another board.

Sooooo yeah.

SD Card works, GPS I haven’t gotten to yet. Im kinda annoyed at the whole project for a verity of reasons and I’m sure its just me being tired.

My issues thus far:

  • Using the logging QML App to send data from a FW6+ ESC to the DIY express does not work (for me anyways) which would have made things soo much fucking easier.
  • Modifying the LispBM script/program used by the logging QML App to populate the logs and send data to the logger on the can network to sanity check literally anything, didnt work for shit.
  • I was able to run CAN commands on the DIY Express to retrieve data from the connected device but for some reason sending data from the connected device was not working. I have zero clue what the fuck thats all about.
  • If you’re doing literally anything beside using the C3-Mini as a USB-to-CAN interface these things get actually quite warm. So I question their stability/reliability in the field when actually having to do work (logging/reading GPS).

Some thoughts:

  • Maybe part of the reason why I wasn’t able to send CAN messages to the logger can-bus was because I was powering the DIY Express via USB and just running CAN-H and CAN-L to the transceiver so no common ground reference. I have zero clue if thats likely the issue since as mentioned I was able to retrieve ESC details over CAN (and modify settings, and all that jazz) from the DIY Express.
  • If you’re not running FW6+ on the ESC retrieving data using LispBM presumably isnt going to work? I have anecdotal evidence to suggest this is true - I was getting goose-eggs from a functional board when running (canget-vin dev1) where dev1 was defined as either of the two ESC’s that were in fact getting 45v at the time. Furthermore, the same command on an ESC running FW6 returned the correct voltage. So its a presumption. How Metr gets this information from FW5 ESCs is a mystery to me, I assume some significantly more annoying integration with UART or something to that effect.

Maybe all of my issues are the whole no-common ground reference thing and I’ve burned waaaay to much time on such a simple issue lol. When I’m no longer annoyed at the project (since the board I want to use it on would seemingly be incompatible anyways (fw5)) I’ll make sure to power the ESP from the ESC and see where things go.

2 Likes

Another option for those interested:

https://www.aliexpress.com/item/1005008357057646.html

Although I was able to solder a DIY version, I found it to be a bit tedious (I hate soldering small stuff) and I was one of the unlucky ones who got a bad batch of ESP32-C3s and had connectivity issues when all said and done.

For $35 (CAD) for the Express, SD card, and GPS, it’s not a bad deal.

Salvation for bad RF:

And:

I bought one of these and the wireless reception is quite bad

2 Likes

Oki doki, got this sorted out on my side - I have some stuff to do yet to verify how well it works but bench testing shows:

  • GNSS (GPS) is working and seems to be fairly accurate).
  • Writing the SD Card is functional
  • Date-time/Timestamps are functional when using GNSS
  • Logging from an ESC to the “DIY VEXP” over CANBUS and thus to the SD Card is working.

So here are the things I am unsure about:

  • How easily sharing the logs will be, metr/minne for all the issues I have with it (specifically metr pro and my being a cheapskate) is by far and away a much cleaner and nicer experience than the baked in VESC logs.
    • I know there is another app thats similar floating around but I dont recall the name nor if its designed to parse standard VESC logs or not.
  • Performance in the longer term with some of these C3-Minis. As mentioned they can get really warm. That could pose reliability concerns.
  • Speaking of reliability naturally SD/TF Cards and Vibrations == Not amazing so if you were to build something like this I’d opt for something with a proper card-latch or a bit of hotglue/tape to keep things from wiggling out.

So what all did I end up buying to get this squared away? Everything is from amazon cause… convenient.

All up, we’re looking at 56-60 bucks which is rather expensive when you consider it. Looking at a per-device cost its more around the $17.00 area which is much more palatable.

Compared to the “all up” price a legit express probably wont run you that much more; A Minnie on the other hand is twice the price (though again their App presumably (I’ve never used voyager) is potentially worth the difference). If you had 2-3 or more boards that you wanted logging on and didnt want to upgrade your old metr pro’s for something that can run without a phone needing external GPS or data-storage then this might be worth it.

Very Quick Low Effort Tutorial:

First and foremost, I expect anyone thats going to follow this, to have some clue of what they’re doing and if not, are capable of critical thinking - don’t expect such a nice, generous, humble guy like myself to try and troubleshoot/triage why your shits not working.

Also FWIW I dont want this to sound like I did any real heavy lifting, I didnt. I was able to figure things out and leverage QML/LISPBM app already designed for this task. While I did write my own LISPBM app to learn how things were working, the Logger UI app is significantly more fleshed out than my dogshit “im learning lispbm” app.

The firmware configuration is pretty straight forward:

  • I cloned the repo and made direct changes to the hw_xp_t.h file because, im hella lazy Ill refer to this as the “HW File”.
  • ESP32-C3 Mini → TFCard = Pins 4,5,6,7 (SPI).
    • These need to be adjusted in the HW File to correctly align to the pinout on the C3 Mini for MOSI, MISO, SCLK, SS/CS.
    • Yes its neato that the pins used are the same, yes they are out of order in this HW File if you’re using the C3 Mini. The reason for this is obvious to many im sure, but not everyone. The reason itself is irrelevant.
  • ESP32-C3 Mini → GPS = Pins 20,21 (UART)
    • This should already be set correctly so you shouldn’t need changes here.
  • ESP32-C3 Mini → CANBUS Transceiver = Pins 0,1
    • This should already be set correctly so you shouldn’t need changes here.
  • Follow the steps outlined in the github (VESC Express) to grab the correct Espressif IDF Build and compile the firmware. (make sure you’re using 5.2.2 (see my post above))

Off to the firmware flashing side of things:

  • Connect the ESP32-C3 Mini to your laptop
  • Open VESC Tool
  • Connect via USB Serial
  • ESP Programmer → Custom and locate the following files (created after compiling the firmware). The path should be similar unless you cant help yourself and fuck with things :wink:
    • vesc_express/build/bootloader/bootloader.bin
    • vesc_express/build/partition_table/partition-table.bin
    • vesc_express/build/vesc_express.bin
  • Once files are selected, click on “Flash with USB” or “Flash with Bootloader” (if i recall correctly if no express firmware is on the device USB is required for the first time).
  • It should be quite obvious when this is finished, it should (if i recall correctly) power cycle after finished and you’ll see vesc express in the USB connection list of VESC Tool.

Software Side of things (and getting things working):

  • The SD Card you’re using needs to be formatted in FAT32 else it wont work.
  • Connect to the DIY VEXP
  • Click on “VESC Packages” → Click on “Log UI” → Click Install
  • Go back to “Welcome & Wizards” → App UI on the right side should show.
  • Click “Test SD Card” This should return successfully if your SD Card is detected and writable. If its not setting anything else up at this point is pointless. Figure out why your SD Card isnt working before moving on.
  • If you have GPS you can check “GNSS” if you don’t having this enabled will break the logging functionality.
  • You can Log Local Values Though I have mine disabled.
  • Check “CAN Values” and if you have CAN enabled BMS “BMS Values” as well.
  • Set the Logger ID to -2
  • Log rate 10hz (10/s) is plenty AFAIK.
  • Check “Start Log at Boot” because… duh.
  • Click Save Settings

This should be all you need to do to get this running, by setting “Check CAN Values” you’re telling the logging app to scan and retrieve CANBUS attached ESC values.

Where do I plan on going from here (cause everyone asked /s):

I will be running this setup in my 4wd board “soonish” and as a result will be working on a case for all the parts - naturally this means instead of bread-boarding Ill need to sort out soldering everything in a nice package. Alas, some additional stuff from me that might/maybe/probably show up(eventually):

  • When I have the case sorted out and the assembly process reasonably frame-worked, ill update and provide another low effort guide and STL files.
  • I’ll consider the idea of properly updating a hardware target file and adding it to the official repo (which means also precompiled firmware). ← This is less likely but something I’d like to do never-the-less.

This was a fun project for me and helps me learn a few things that I may want to take into a different project. If you have questions/comments/concerns LMK, obviously if you’re having troubles feel free to ask but dont hold your breath that ill fall over myself to help.

4 Likes

To visualize the logs you could use this site: Vetr.at About
It is run by a guy that uses it for efoil vesc logs.

Good callout, the one I think I was thinking about was “Yours Truly” but a more in depth glance than a cursory look suggests this is long since been abandoned.

Can anyone upload the design file for SolidWorks, fusion360 link doesn’t work anymore

I don’t know why F360 decided to kill my link. Maybe only valid for 1y?! Anyways, here is the new link: https://a360.co/43I2jyl Additionally I attached the files as STEP and F3Z:

USB-C to VESC-CAN v2.f3z (673.1 KB)

USB-C to VESC-CAN v2.step (2.9 MB)

2 Likes