2023-11-18, 04:29 AM
Hi All,
I'm new to the forum for the most part but I thought I would start a thread on my build of a motor controller.
I am way more experienced with STM32 SoCs than with Arduino so I thought I would try porting Sean's motor.ino to STM32.
Here are the particulars:
RPi 4 running tinypilot.
Using the STM32CubeIDE which is very good and FREE.
Using the STM32F103 on the Blue Pill available for under $10 on ebay.
I have ported it to use the IBT-2 43 amp motor controller available from amazon for ~$5
Wiring it up is very simple. No need for PCB.
Progress:
I have spent some time going through Sean's Motor.ino code and also McNugget's version to use IBT-2. A thank you for all their efforts. McNugget's exponential analog filters, YES, right out of the FFT book!
I have a working STM32 project code on a desk top simulator- 12V motor driving a rudder position pot.
Latest version includes a complete USB stack sending analog data for logging.
I am continuing to simplify the code removing timing related complications.
It currently communicates with Pypilot on server with no errors just fine. It just gets the motor controller timeout message since current isn't reported.
Advantages:
Runs at 72MHz, don't have to worry about timing much.
Currently run 5 channels of analog through DMA at a rate faster than needed.
12bit ADC.
Hardware PWM.
All setup code is handled by IDE at HAL level.
Everything runs on 3.3V. No 5V to 3V worries. (although opto-isollators aren't a bad idea)
IBT-2 has built in short circuit and under voltage protection.
Cheap.
Oh, did I mention, CHEAP.
What I have not completed:
Right now only Rudder analog is used, Other analogs- current, voltage, temp not implemented. I'm not sure I need them in my application.
I have not implemented rudder limit switches since I have analog rudder position.
I have not implemented a watch dog timer but this is trivial (on the list).
I am not implementing EEPROM write and read as this is only needed for multi-controller environments.
If there is interest in this I will branch on github, if not it will be my solitary project. I would appreciate feedback on interest or those conversant with STM32 that would like to help.
Thanks,
Brad
I'm new to the forum for the most part but I thought I would start a thread on my build of a motor controller.
I am way more experienced with STM32 SoCs than with Arduino so I thought I would try porting Sean's motor.ino to STM32.
Here are the particulars:
RPi 4 running tinypilot.
Using the STM32CubeIDE which is very good and FREE.
Using the STM32F103 on the Blue Pill available for under $10 on ebay.
I have ported it to use the IBT-2 43 amp motor controller available from amazon for ~$5
Wiring it up is very simple. No need for PCB.
Progress:
I have spent some time going through Sean's Motor.ino code and also McNugget's version to use IBT-2. A thank you for all their efforts. McNugget's exponential analog filters, YES, right out of the FFT book!
I have a working STM32 project code on a desk top simulator- 12V motor driving a rudder position pot.
Latest version includes a complete USB stack sending analog data for logging.
I am continuing to simplify the code removing timing related complications.
It currently communicates with Pypilot on server with no errors just fine. It just gets the motor controller timeout message since current isn't reported.
Advantages:
Runs at 72MHz, don't have to worry about timing much.
Currently run 5 channels of analog through DMA at a rate faster than needed.
12bit ADC.
Hardware PWM.
All setup code is handled by IDE at HAL level.
Everything runs on 3.3V. No 5V to 3V worries. (although opto-isollators aren't a bad idea)
IBT-2 has built in short circuit and under voltage protection.
Cheap.
Oh, did I mention, CHEAP.
What I have not completed:
Right now only Rudder analog is used, Other analogs- current, voltage, temp not implemented. I'm not sure I need them in my application.
I have not implemented rudder limit switches since I have analog rudder position.
I have not implemented a watch dog timer but this is trivial (on the list).
I am not implementing EEPROM write and read as this is only needed for multi-controller environments.
If there is interest in this I will branch on github, if not it will be my solitary project. I would appreciate feedback on interest or those conversant with STM32 that would like to help.
Thanks,
Brad