4 VESCs controlled by a Raspberry Pi 3 over I2C or USB

General topics and discussions about the VESC and its development.
Cristian
Posts: 10
Joined: 06 Jul 2017, 00:29

4 VESCs controlled by a Raspberry Pi 3 over I2C or USB

Postby Cristian » 06 Jul 2017, 00:47

Hi guys,

I just joined the forums looking for a little help to get started.
I want to control 4 VESCs from a Raspberry Pi 3 over I2C preferably. I searched and there are expansion boards to add CAN to the Pi but that would unnecessarily complicate my design. UART is out of the question as the Pi only has 2. USB is also an acceptable solution as the Pi has 4 ports but that would result in a bunch of USB cables wrapped inside the project.

My question is: where can I find some sample code (C++) that I can run on the Pi to control 4 VESCs? (send commands and get status)
The VESCs don't need to talk to each other so I'm sure I don't need a custom application running on them => yay! no need to compile and flash it :)

Many thanks!

pf26
Posts: 278
Joined: 28 Mar 2016, 14:37
Location: FR Valence

Re: 4 VESCs controlled by a Raspberry Pi 3 over I2C or USB

Postby pf26 » 06 Jul 2017, 13:49

You can use the GPIO UART of RPi3 (make sure it is 3.3V and not 5V otherwise add a 1K resistor to Tx of RPi3) to connect to the first VESC, and from there connect the other 3 VESCs using CAN bus. Your UART commands can be relayed by the first VESC.
You first will need to connect each VESC to bldctools to assign a unique ID and disable sending status frames (or lower the rate, to avoid high traffic on CAN bus).

Cristian
Posts: 10
Joined: 06 Jul 2017, 00:29

Re: 4 VESCs controlled by a Raspberry Pi 3 over I2C or USB

Postby Cristian » 06 Jul 2017, 14:54

Thank you!
Does this mean I can still control them independently ? (my assumption was that the slave/s will do exactly what the master does, for the dual motor board scenario) but you gave me hope that I might be able to control them independently :)

pf26
Posts: 278
Joined: 28 Mar 2016, 14:37
Location: FR Valence

Re: 4 VESCs controlled by a Raspberry Pi 3 over I2C or USB

Postby pf26 » 07 Jul 2017, 10:25

Yes you can (control them independently).


Return to “General”

Who is online

Users browsing this forum: No registered users and 2 guests