-
Notifications
You must be signed in to change notification settings - Fork 0
[T ELEC 0] ODrive
We chose to use brushless motors that are cheap and powerful but it is difficult to control them. That's why we need an ODrive which is a high performance motor control. It can also control the encoders.
- We used the ODrive Version 3.5 48V. You can visit the official website for more information about the board ans its features.
- You will also need a Stm32 to communicate with the ODrive.
- And a CAN transceiver: the MCP2551.
The ODrive Tool is the accompanying PC program for the ODrive. It’s main purpose is to provide an interactive shell to control the device manually, as well as some supporting functions like firmware update.
We followed the instructions on the official ODrive documentation that you can find [here].(https://docs.odriverobotics.com/#downloading-and-installing-tools). Make sure that you follow the instructions correctly. The problem we encountered is that we had several python version installed. You need to only have the version specified.
We chose to use CAN to communicate with the ODrive. The stm32 will send orders to the ODrive to controll the motors.
As ODrive is in opensource, most of the features are developed by the community. We used a firmware that implemented a simple CAN protocol. You can find the project here.
Once you downloaded the project, you have to generate the .elf file to flash it on the ODrive. To do that, simply type make in the folder that contains the Makefile. We encountered several problems for this task, the main one is that we had to install tup and libfuse-dev. To install tup, you can check this tutorial.
And to make things easier we bought a ST-link to flash the firmware. Just connect it to the ODrive and the computer and follow the instructions of the official documentation.
Explain code once it works ` #include "mbed.h" Ticker ticker; DigitalOut led1(LED1); DigitalOut led2(LED2); /** The constructor takes in RX, and TX pin respectively.
- These pins, for this example, are defined in mbed_app.json */ CAN can(PD_0, PD_1); CAN can2(MBED_CONF_APP_CAN2_RD, MBED_CONF_APP_CAN2_TD); char counter = 0; Serial pc(SERIAL_TX, SERIAL_RX, 115200); void send() { pc.printf("send()\n"); if(can.write(CANMessage(1337, &counter, 1))) { pc.printf("wloop()\n"); //counter++; pc.printf("Message sent: %d\n", counter); } led1 = !led1; }
int main() { can.frequency(250000); pc.printf("main()\n"); ticker.attach(&send, 1); CANMessage msg; while(1) { pc.printf("loop()\n"); if(can1.read(msg)) { pc.printf("Message received: %d\n", msg.data[0]); led2 = !led2; } wait(0.2); } }`
- Home
- [History]
- [Tutorials]
- [TOOL]
- [MECA]
- [CODE]
- [ELEC]
- [MAKE]
- 3D Modeling
- Laser cutting
- 3D Printing
- CNC Extrusion
- [Tools 101]
- [Articles]
- [Type of motors]
- [Type of sensors]
- [Choice of microcontroller]
- [Eurobot 2019 Strategy]
- [Ressources]
- [Cloud]
- [Other Repositories]
- [Youtube Channels]
- [Miscellaneous]