CANopen with two DC...
Clear all

CANopen with two DC motors

2 Posts
2 Users
0 Reactions
Forum 1
Eminent Member
Joined: 9 months ago
Posts: 10
Topic starter  

We are planning to run two MEGAs to control two DC motors using a CAN network from a Raspberry Pi. We have a USB2Can module we are using as a host from the Pi. I think I understand how to initialize the USB2CAN as the host from the linux terminal on the Pi but I wanted to clarify: 


# sudo ip link set can0 up type can bitrate 1000000
# instanciate a SOLO object:
mySolo = solo.SOLOMotorControllersCanopen(0, solo.CAN_BUS_BAUD_RATE.RATE_1000)


In this above code, the 0 is for the host? or is 0 the node of the motor controller?


I'm wondering if there are any examples of running two controllers using the SoloPy library?


Thanks in advance!

Chief Member
Joined: 2 years ago
Posts: 38

You can access motion terminal and give a specific "Device Address" to all the solo units in a way they don't conflict (default is 0) let's say you will set 1 and 2 then to handle the 2 motor you can use the following code:

mySolo1 = solo.SOLOMotorControllersCanopen(1)
mySolo2 = solo.SOLOMotorControllersCanopen(2)

we will in future add new example on this topic to avoid any doubts.


just to extra suggestion:

1) Consider that the configuration of the motor can be find and saved using motion termianal, in this way your Python code is just about the active part of your system. In the example you say just focusing on using set_motor_direction and set_motor_direction  avoiding the part related to "#Initial Configuration of the device and the Motor".

2) I see you share a sensor less program but in general is better to start with encoder or hall sensor in order to have a more clear limit of your system.