this post was submitted on 18 Oct 2023
3 points (100.0% liked)

MICROCONTROLLERS

848 readers
1 users here now

Everything microcontrollers: projects, questions, new releases, etc.

dragontamer's Beginner Guides:

Beginner Series I: What is a Microcontroller?

Beginner Series II: The "Generic" Microcontroller

Beginner Sidenote: Microchip's Signal Chain Design Guide

Beginner Series III: Skills and Complexity Tiers

Beginner Series IV: Deep Dive into Microchip's AVR EA

founded 2 years ago
MODERATORS
top 2 comments
sorted by: hot top controversial new old
[–] dragontamer@lemmy.world 3 points 2 years ago* (last edited 2 years ago)

MicroPython is significantly slower than C.

driving brushless motors via electronic speed controllers (ESCs) using the RP2040's pulse-width modulation (PWM) capabilities

I mean this is very impressive. But good grief. Was it really easier to do this all in MicroPython? 250Hz is still pretty slow. That's an update every 4-miliseconds, or roughly every 800,000 clock ticks on this 200+MHz overclocked RP2040.

I can't say I'm into robotics or drones, but I do know that STM32F3 / CortexM4F chips are common flight controllers in the drone community at only 72MHz or so (albeit with hardware FPU units). Micropython needs to probably change all the floating-point math into fixed-point to work on the CortexM0+ (no FPU), and then deal with the severe inefficiencies associated with an interpreter.


EDIT: I should note that reading over the flight-dynamics / this whole problem and blog is making me want to make my own quadcopter. Apparently quadcopters are all just relatively basic control theory. Somehow I thought they were far more complicated than this. But this kind of simple poll data / math out some PID controllers / send-data-to-motors loop is the bread-and-butter of electrical-and-computer engineering today.

[–] LazaroFilm@lemmy.world 1 points 2 years ago

That’s why I love arduino-pico core. I tried getting in the MicroPython and circuit python and couldn’t see the benefits apart from fast flashing with no compiling but the cost is too great imo