# DRV8302 + ODrive Botwheels + Pi Pico Shaking Motor in torque and open loop velocity

**URL:** https://community.simplefoc.com/t/drv8302-odrive-botwheels-pi-pico-shaking-motor-in-torque-and-open-loop-velocity/7194
**Category:** hardware support
**Tags:** raspberry\_pi\_pico, drv8302
**Created:** [May 15, 2025, 9:09pm UTC](https://community.simplefoc.com/t/drv8302-odrive-botwheels-pi-pico-shaking-motor-in-torque-and-open-loop-velocity/7194 "2025-05-15T21:09:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![barrett-land](https://community.simplefoc.com/user_avatar/community.simplefoc.com/barrett-land/32/8713_2.png) [@barrett-land](https://community.simplefoc.com/u/barrett-land)
#### Post date: [May 15, 2025, 9:09pm UTC](https://community.simplefoc.com/t/drv8302-odrive-botwheels-pi-pico-shaking-motor-in-torque-and-open-loop-velocity/7194/1 "2025-05-15T21:09:07Z")

</div>

Hi everyone, I am having a lot of trouble with getting these ODrive Botwheels running. The main problem is when I try to run the wheel in torque or open loop velocity mode the wheel shakes very erratically. In all other modes the wheel does not move no matter what the target is set at. The motor also gets very hot when idling even though my current limit is set at 5A and the ODrive website says the wheels are rated for 5A continuous. The psu I am using is 24v.

Here is a picture of my setup:

 ![IMG_5799](https://community.simplefoc.com/uploads/default/original/2X/b/b53865812375500e9818fdbf4143668771179805.jpeg)

I am running simpleFOC on a Raspi Pico connected to the DRV8302 aliexpress board ([https://www.aliexpress.com/i/2255799940116021.html?gatewayAdapt=4itemAdapt](https://www.aliexpress.com/i/2255799940116021.html?gatewayAdapt=4itemAdapt)) controlling a singular ODrive Botwheel ([ODrive BotWheels – ODrive Robotics US](https://shop.odriverobotics.com/products/botwheels?variant=40926828068934)).

Here is my code in Arduino IDE:

```auto
#include <SimpleFOC.h>

// DRV8302 pins connections
// don't forget to connect the common ground pin
#define INH_A 0
#define INH_B 1
#define INH_C 2
#define EN_GATE 16
#define M_PWM 17 
#define M_OC 18
#define OC_ADJ 19
#define H_A 3
#define H_B 4
#define H_C 5

// motor instance
BLDCMotor motor = BLDCMotor(15);

// driver instance
BLDCDriver3PWM driver = BLDCDriver3PWM(INH_A, INH_B, INH_C, EN_GATE);

// hall sensor instance
HallSensor sensor = HallSensor(H_A, H_B, H_C, 15);
// channel A and B callbacks
void doA(){sensor.handleA();}
void doB(){sensor.handleB();}
void doC(){sensor.handleC();}

// commander interface
Commander command = Commander(Serial);
void onMotor(char* cmd){ command.motor(&motor, cmd); }

void setup() {

  // initialize sensor sensor hardware
  sensor.init();
  sensor.enableInterrupts(doA, doB, doC); 
  // link the motor to the sensor
  motor.linkSensor(&sensor);

  // DRV8302 specific code
  // M_OC - enable over-current protection
  pinMode(M_OC,OUTPUT);
  digitalWrite(M_OC,LOW);
  // M_PWM - enable 3pwm mode
  pinMode(M_PWM,OUTPUT);
  digitalWrite(M_PWM,HIGH);
  // OD_ADJ - set the maximum over-current limit possible
  // Better option would be to use voltage divisor to set exact value
  pinMode(OC_ADJ,OUTPUT);
  digitalWrite(OC_ADJ,HIGH);

  // configure driver
  driver.voltage_power_supply = 24;
  driver.init();
  motor.linkDriver(&driver);

  // choose FOC modulation
  motor.foc_modulation = FOCModulationType::SpaceVectorPWM;

  // set control loop type to be used
  motor.controller = MotionControlType::torque;

  // controller configuration based on the control type 
  motor.PID_velocity.P = 0.2;
  motor.PID_velocity.I = 20;

  // velocity low pass filtering time constant
  motor.LPF_velocity.Tf = 0.01;

  // angle loop controller
  motor.P_angle.P = 20;
  
  // angle loop velocity limit
  motor.velocity_limit = 50;
  // default voltage_power_supply
  motor.voltage_limit = 24;

  motor.current_limit = 5;

  motor.voltage_sensor_align = 1;

  // use monitoring with serial for motor init
  // monitoring port
  Serial.begin(115200);
  // comment out if not needed
  motor.useMonitoring(Serial);

  // initialize motor
  motor.init();
  // align sensor and start FOC
  motor.initFOC();

  // set the initial target value
  motor.target = 2;

  // define the motor id
  command.add('M', onMotor, "motor");
  
  _delay(1000);
}

void loop() {
  // iterative setting FOC phase voltage
  motor.loopFOC();

  // iterative function setting the outer loop target
  // velocity, position or voltage
  // if target not set in parameter uses motor.target variable
  motor.move();

  // user communication
  command.run();
}

```

I am pretty much at a loss at this point so any help would be appreciated.

---

<div class="post-metadata">

### Author: ![Jose\_Aldahir\_Espinos](https://community.simplefoc.com/user_avatar/community.simplefoc.com/jose_aldahir_espinos/32/8644_2.png) [@Jose\_Aldahir\_Espinos](https://community.simplefoc.com/u/Jose_Aldahir_Espinos)
#### Post date: [May 16, 2025, 10:43pm UTC](https://community.simplefoc.com/t/drv8302-odrive-botwheels-pi-pico-shaking-motor-in-torque-and-open-loop-velocity/7194/2 "2025-05-16T22:43:04Z")

</div>

Maybe try to change the phases for the HallSensor, I never used one of these sensors, but I read some solutions for problems that the motor doesn’t spin or spin wrong.

I mean, the phase A, B, C must be in the correct order

---

<div class="post-metadata">

### Author: ![barrett-land](https://community.simplefoc.com/user_avatar/community.simplefoc.com/barrett-land/32/8713_2.png) [@barrett-land](https://community.simplefoc.com/u/barrett-land)
#### Post date: [May 19, 2025, 3:38pm UTC](https://community.simplefoc.com/t/drv8302-odrive-botwheels-pi-pico-shaking-motor-in-torque-and-open-loop-velocity/7194/3 "2025-05-19T15:38:29Z")

</div>

I was able to get the hall sensors to work correctly but I am still running into the shaking issue. The shaking issue occurs in both open loop angle and velocity and when I try and run the motor in closed loop angle or velocity it just refuses to move at all unless I physically try to spin the motor in the correct direction then it stutters while spinning then comes to a complete stop shortly after. I have tried adjusting some PID settings but I can’t ever get it to have a different outcome. Do you think it could be a bad motor?

---

<div class="post-metadata">

### Author: ![Jose\_Aldahir\_Espinos](https://community.simplefoc.com/user_avatar/community.simplefoc.com/jose_aldahir_espinos/32/8644_2.png) [@Jose\_Aldahir\_Espinos](https://community.simplefoc.com/u/Jose_Aldahir_Espinos)
#### Post date: [May 19, 2025, 6:46pm UTC](https://community.simplefoc.com/t/drv8302-odrive-botwheels-pi-pico-shaking-motor-in-torque-and-open-loop-velocity/7194/4 "2025-05-19T18:46:25Z")

</div>

Maybe the problem is in the PCB, I had a similar problem with a custom PCB, my motor doesn’t spin and only spins if I move with the fingers.

I wrote the solution in the topic:  
[Custom PCB doesn’t move the motor - hardware support - SimpleFOC Community](https://community.simplefoc.com/t/custom-pcb-doesnt-move-the-motor/7118/38)

Almost try with another motor.
