<p>I work with RaspPi a lot. I will keep it short, 2 big problems:</p>
<p>1- PI is slow AF!  Way too slow to use for the drone feedback loop (runtime)</p>
<p>2- And where is the 5kloc+ of C lang code coming from? The software in use is very complex. We have not seen ANY new FC firmware in 10+ years (correct if wrong).  BetaFlight is the same code base from BaseFlight (2010 era) that was forked from another project.  KISS/FETTEC has been around for 10+ years as well.  No one is writing new firmware, many have tried.</p>
<p>Fianlly, the LINGYUN ESC should be skipped. If you actually are going to dedicate all this time in a total scratch build, at least get good parts and things that you can replace in a month or year.</p>
<p>The difference between Arduino's is grand, but many are fast little units and serve as the base for all flight controllers.  PI's don't have the dedicated C lang/asm potential you need. They will compile and run, but I don't think the perfomance will be any good.</p>

CC BY-SA 4.0
2023-07-15T23:27:34.290Z
I'm sorry I don't understand what you mean by 5kloc+ C lang code. Could you elaborate on that?
ArjunSahlot
CC BY-SA 4.0
2023-07-17T18:18:13.470Z
KLOC = thousand(s) of lines of code.  I am commenting on the workload regarding the code - size of the code base and complexity.  Most controllers are small ARM-like chips (no OS).  You need C lang (C language ) or similar (C++, Rust, compiled/micro python) to get the IO speed to make micro-adjustments for flight. As for kloc, I don't know the exact count - but betaflight is huge. https://github.com/betaflight/betaflight/tree/master -- I know a few people who did use a Pi for flight, it was more like a "Pi was on board while another pcb did the actual flying:
FunHog.me
CC BY-SA 4.0
2023-06-22T16:54:04.873Z
2023-06-22T16:54:04.873Z
FunHog.me
<p>I am fairly new to electronics and am trying to build a drone from scratch as a hobby project. I want a setup where I can control all the motors individually through the software. Through some research I found that ESCs are the way to go for BLDC motors, and I am planning on getting <a href="https://rads.stackoverflow.com/amzn/click/com/B08XM2DF4C" rel="nofollow noreferrer" rel="nofollow noreferrer">this one</a>. I also came across <a href="https://drones.stackexchange.com/questions/1786/wiring-a-4-in-1-esc-to-an-arduino-uno?noredirect=1&amp;lq=1">this post</a> which is almost identical to the thing that I am trying to do, except that I am using a Raspberry Pi. After multiple failed purchases due to  not knowing what would work with my setup, I am reluctant to buy this and want to know how to connect it before the purchase.</p>
<p>This is the diagram of the ESC:
<img src="https://m.media-amazon.com/images/I/61XRysjq4IS._AC_SL1000_.jpg" alt="diagram" /></p>
<p>My biggest worry is that the raspberry pi's diagram only has 2 PWM (pulse width modulation) pins (32, 33):
<img src="https://i.sstatic.net/xWW34.png" alt="raspberry pi pin diagram" /></p>
<p>How would I connect these 2 to have access to the speeds of all the motors individually?</p>

<esc><brushless-motors><raspberry-pi>
Using a raspberry pi 4 for motor control
ArjunSahlot
# Using a raspberry pi 4 for motor control

(Asked by: username_0 on 2023-03-02)

I am fairly new to electronics and am trying to build a drone from scratch as a hobby project. I want a setup where I can control all the motors individually through the software. Through some research I found that ESCs are the way to go for BLDC motors, and I am planning on getting [this one](https://rads.stackoverflow.com/amzn/click/com/B08XM2DF4C). I also came across [this post](https://drones.stackexchange.com/questions/1786/wiring-a-4-in-1-esc-to-an-arduino-uno?noredirect=1&lq=1) which is almost identical to the thing that I am trying to do, except that I am using a Raspberry Pi. After multiple failed purchases due to not knowing what would work with my setup, I am reluctant to buy this and want to know how to connect it before the purchase.

This is the diagram of the ESC:
![diagram](https://m.media-amazon.com/images/I/61XRysjq4IS._AC_SL1000_.jpg)

My biggest worry is that the raspberry pi's diagram only has 2 PWM (pulse width modulation) pins (32, 33):
![raspberry pi pin diagram](https://i.sstatic.net/xWW34.png)

How would I connect these 2 to have access to the speeds of all the motors individually?

**Tags:** esc, brushless-motors, raspberry-pi


---

## 1 answers

### Answer by username_1 on 2023-06-22. Score: 1 | Accepted answer

I work with RaspPi a lot. I will keep it short, 2 big problems:

1- PI is slow AF! Way too slow to use for the drone feedback loop (runtime)

2- And where is the 5kloc+ of C lang code coming from? The software in use is very complex. We have not seen ANY new FC firmware in 10+ years (correct if wrong). BetaFlight is the same code base from BaseFlight (2010 era) that was forked from another project. KISS/FETTEC has been around for 10+ years as well. No one is writing new firmware, many have tried.

Fianlly, the LINGYUN ESC should be skipped. If you actually are going to dedicate all this time in a total scratch build, at least get good parts and things that you can replace in a month or year.

The difference between Arduino's is grand, but many are fast little units and serve as the base for all flight controllers. PI's don't have the dedicated C lang/asm potential you need. They will compile and run, but I don't think the perfomance will be any good.

> **Comments:**
> **username_0**: I'm sorry I don't understand what you mean by 5kloc+ C lang code. Could you elaborate on that?  
> **username_1**: KLOC = thousand(s) of lines of code.  I am commenting on the workload regarding the code - size of the code base and complexity.  Most controllers are small ARM-like chips (no OS).  You need C lang (C language ) or similar (C++, Rust, compiled/micro python) to get the IO speed to make micro-adjustments for flight. As for kloc, I don't know the exact count - but betaflight is huge. https://github.com/betaflight/betaflight/tree/master -- I know a few people who did use a Pi for flight, it was more like a "Pi was on board while another pcb did the actual flying:  

---

