Interesting Drone question : Microprocessor, or Microcontroller?

Hi again.

I found this article interesting because I was asking myself the same question the first time I came to VHS:

I am inclined to agree with Bodo Eichstädt. Both beats either one separately.

I figured someone here may find the article interesting…

Either the question wasn’t worded properly, or the answers I read were irrelevant to my interpretation of the original question (including Eichstadt).

Microcontrollers is an IC that contains a processor, memory and I/O in one chip. A Microprocessor is an IC that contains a processor ( it requires external memory and I/O controllers ).

The answers that dwelve into the OS vs application are irrelevant as both microprocessors and microcontrollers can run an OS or an application without OS.

The answers that deal with the performance are irrelevant since there are microcontrollers that are faster than microprocessors and viceversa.

In my eyes, the original question is asking: Is it better to have the simplicity of a single IC microcontroller with a pre-determined (and therefore limited) amount of memory and I/O or is it better to have the flexibility of a microprocessor with the added complexity of external memory and I/O.

My answer would be: It depends on the needs of the application. Does it need lots of memory in order to perform computer vision operations? Does it need to be able to transfer data without interrupting the main processor? Does the memory bus need to support simultaneous access from more than one memory controller? etc.

In other words, the question cannot be answered as originally worded.

If on the other hand, the question is “what is better for drones, an arduino or a raspberry pi?” My answer would be neither because neither one has the I/O capabilities to efficiently fly a drone. Use one of the many flight control computers that are available (naze32, pixhawk, 3dr to name a few).

I would add my advice here that neither RPi’s or any of the Arduino’s are
suitable for a commercial flying product.
They are made as low cost hobbyist devices and do not have the components
that are capable or designed for extreme vibration, temperature,
environment or reliability performance.
F

@hector

Thanks Hector, your first post was an informative & useful assessment.

In your second post, you said that neither arduinos or Pis can efficiently fly a drone. There is a wooden framed quad rotor at VHS sitting high up on something to the left as soon as you come in the door. If I remember correctly, Dan Royer said he built that from scratch using either an arduino, or a Pi. I don’t know how well it flies, but I don’t think it would be poorly planned out & sitting there because it can’t fly well. I bet it’s only there to demonstrate the use of Dan’s products as drone hardware.

If what you said about adruino’s and Pi’s not being adequate, then maybe the builder might have had to use multiple ICs to get it working right. If one arduino couldn’t do it, for the small extra price of adding a second one, it may be cheaper than buying an off-the-shelf flight controller.

I would love to see the thing actually fly !!

@toptekkie

Thanks Farrel.

In chemistry there’s an acronym of GIGO, meaning Garbage in-Garbage out, and I suppose that the same thing applies in IT hardware & software.

Considering the general rule that consumers get what they pay for, I pretty much figured that Adruinos and Pis were not MilSpec hardware. Nonetheless, they may be useful for short-term use in a prototype if their MilSpec equals were co$t prohibitive. Guys are building quad copters around adruinos as controller.

Can you suggest anything somewhat reasonably priced that can take hard use ?

The microcontroller options on Digikey are vast:

http://www.digikey.com/product-search/en/integrated-circuits-ics/embedded-microcontrollers/2556109?k=microcontroller

I could just buy a ready made flight controller like Hector suggested…

I somehow get the impression that multiple ICs dedicated to doing separate jobs would be better than asking one stronger IC to do everything…

I’ve been using OpenPilot’s Revolution platform on my drone and been really happy with it. The firmware is extremely modular.

I can educate you a little here in a way that likely won’t be directly relevant to what you’re trying to do, but should give you a better understanding of how this field of interest works.

Let’s define some terms.

A “Raspberry Pi” is a full computer, with all of the overhead that entails. You know how your computer sometimes gets a little slow because it’s doing something in the background, invisible to you? Yeah. The Pi is stripped down and a little better than that, but it still rules it out for drone piloting when you need sub-microsecond timing.

A “microcontroller” (you will generally never see true “microprocessors” anymore) has no overhead, is doing nothing in the background. It does exactly what you tell it, from the ground up, and, with a talented enough programmer, you can predict what it will be doing at any point, down to microsecond. That’s an over-simplification, but it works.

An “Arduino” is a development board that contains an ATmega-series microcontroller, and looks like this:

As you can see, there are not very many holes on those black header strips on the left and right side of the board. Those are input/output pins. That board also contains a bunch of extra weight in the form of features that you don’t need for drone flying, and comes in a fairly awkward shape.

Then there is an “Arduino-based board” of some other description. I haven’t seen Dan’s drone, but that is likely what it is. That means that it contains an ATmega chip (this brains), and can therefore be programmed with the same tools as an Arduino, but it is not technically an Arduino. These can come in any shape or size that you can imagine, with peripheral combinations to match. There are Arduino-based drone controllers.

I can point you in the direction of some milspec chips. The are $100-200 for the chip alone, and in the low thousands for development boards to be able to actually use the chips. Fortunately, you don’t need them!

Lately, it’s the toolchain that matters a lot more than the microcontroller. If you’re trying to hire someone, then the best microcontroller is probably “the one they’re familiar with”. If you’re a competent developer, the answer is more likely to be “whatever IDE you like the feel of.” For someone starting out with very little development experience, the answer is probably “something that can run the Arduino firmware”. Which, conveniently enough, comes on an Arduino, and can be purchased in our vending machine.
You know. If you wanted to get your feet wet.

2 Likes

The RPi has a CPU made for set-top-boxes. It’s really not ideal but definitely would work for flying a Drone. Coupling it with a CPU such as a Arduino Due or other reasonable ARM controller would allow for high speed reactions yet still have the processing capability of the RPi for advanced sensor handling such as machine vision.

Possibly a better platform would be the Beaglebone Black which is a Sitara processor made for industrial control. It has a CPU similar in power to the RPi (more powerful overall but not as good a video card, but a RPi2 will still beat it) along side a pair of PRUs or Programmable Realtime Units. These PRUs are microcontrollers with access to all the resources on the main CPU. They are made to handle low level motion control or handling of realtime data.

An interesting thing I’ve found recently possibly to help the RPi case is CoDeSys has a $50 PLC core that will run on a Raspberry Pi. This core is made to do realtime PLC (Programmable Logic Controller) tasks including realtime handling. I do believe it’s some adjustments to the underlying OS as well that allows for the tight timing requirements. I don’t know all the details and haven’t tested it, but there’s a ‘demo’ mode that allows you to run it up to 2 hours before it shuts down the RPi; might be worth trying.

Regards,
Loial

@Logan Buchy

I’m glad to hear you are enjoying success with the product.

Did you buy the Nano Kit ? :

http://newstore.openpilot.org/usa/official-openpilot-hardware/26-openpilot-revolution-nano.html

Or did you buy the basic controller & add the other parts yourself :

http://newstore.openpilot.org/usa/home/27-revo-nano-hardware-kit.html

@Jarrett

Thanks for the detailed post !!

“A “Raspberry Pi” is a full computer, with all of the overhead that entails. You know how your computer sometimes gets a little slow because it’s doing something in the background, invisible to you? Yeah. The Pi is stripped down and a little better than that, but it still rules it out for drone piloting when you need sub-microsecond timing.”

Yeah, I remember reading that somewhere recently. The author said that the little slow downs can eventually add up to a program gap than can actually affect the drones operation & he recommended a microcontroller instead.

It seems that using a relatively “smart” microcontroller and dedicating it to flight control only would be a good idea.

“As you can see, there are not very many holes on those black header strips on the left and right side of the board. Those are input/output pins. That board also contains a bunch of extra weight in the form of features that you don’t need for drone flying, and comes in a fairly awkward shape.”

Extra weight is not good, but when my goal is to build a heavy work drone that has a significant payload, the extra bit of weight (in the unneeded features of the development board) isn’t going to be significant.

There’s a company that was field testing a big drone here locally and it was packing a concrete cinder block around to demonstrate it’s payload capability.

“Then there is an “Arduino-based board” of some other description. I haven’t seen Dan’s drone, but that is likely what it is. That means that it contains an ATmega chip (this brains), and can therefore be programmed with the same tools as an Arduino, but it is not technically an Arduino. These can come in any shape or size that you can imagine, with peripheral combinations to match. There are Arduino-based drone controllers.”

It seems like starting with an ATmega chip and a development board, then just adding other hardware as needed might be an affordable way to go. Farrell seemed to feel that Pis and Arduinos are not really a robust long term solution for a hardworking industrial drone in harsh environments, but since people are using them as domestic consumer grade electronics and getting reasonable lifespans out of them, then maybe they might make a cheap starting point to work from. Getting a working prototype is important. Second round financing can be used to upgrade to MilSpec later.

“I can point you in the direction of some milspec chips. The are $100-200 for the chip alone, and in the low thousands for development boards to be able to actually use the chips. Fortunately, you don’t need them!”

Yet…

“Lately, it’s the toolchain that matters a lot more than the microcontroller. If you’re trying to hire someone, then the best microcontroller is probably “the one they’re familiar with”. If you’re a competent developer, the answer is more likely to be “whatever IDE you like the feel of.” For someone starting out with very little development experience, the answer is probably “something that can run the Arduino firmware”. Which, conveniently enough, comes on an Arduino, and can be purchased in our vending machine.
You know. If you wanted to get your feet wet.”

Can I just buy one of Dan’s Arduinos at VHS, then load Dronecode open source controller code? :

https://www.dronecode.org/dronecode-software-platform

@LoialOtter

Thank you for your input.

“The RPi has a CPU made for set-top-boxes. It’s really not ideal but definitely would work for flying a Drone. Coupling it with a CPU such as a Arduino Due or other reasonable ARM controller would allow for high speed reactions yet still have the processing capability of the RPi for advanced sensor handling such as machine vision.”

I checked out the Arduino Due and it looks good. Maybe I should buy one & add a VHS Pi from the machine…

“Possibly a better platform would be the Beaglebone Black which is a Sitara processor made for industrial control. It has a CPU similar in power to the RPi (more powerful overall but not as good a video card, but a RPi2 will still beat it) along side a pair of PRUs or Programmable Realtime Units. These PRUs are microcontrollers with access to all the resources on the main CPU. They are made to handle low level motion control or handling of realtime data.”

PRUs? Are they necessary to run a real time OS, like freertos offers?

“An interesting thing I’ve found recently possibly to help the RPi case is CoDeSys has a $50 PLC core that will run on a Raspberry Pi. This core is made to do realtime PLC (Programmable Logic Controller) tasks including realtime handling. I do believe it’s some adjustments to the underlying OS as well that allows for the tight timing requirements. I don’t know all the details and haven’t tested it, but there’s a ‘demo’ mode that allows you to run it up to 2 hours before it shuts down the RPi; might be worth trying.”

This thing? :

Thanks again !!

@boilerwelder

No I got the original. Major responsibilities of the onboard STM32F4 include

  • attitude control
  • communication
  • altitude sensing (on board pressure sensor… +/- about a Meter)

Why I find OpenPilot so interesting is the way they architected the firmware. They use a message passing system between different components, which is quite different from how I’ve approached firmware. Need a sensor read? You write a component that reads a sensor in its own thread and emits a message. Other components can consume the message but the two components are never directly linked (as in the compiler terminology). Its an SOA on an embedded system that’s flying a drone, cool stuff!

I would imagine this part of the system is fairly tolerant to jitter and the update loop is not as fast as you would imagine, maybe a 10 milliseconds. After all, the CPU is servicing interrupts from some of its peripherals; in many cases this will introduce delays in your system that is transparent to any tasks running under the RTOS scheduler.

The most deadline sensitive aspect of the quad is probably the microcontrollers running each motor. BLDC commutation really needs deterministic behavior in order to energise coils at the correct time. Too late or too early and you will run inefficiently which could end up chewing thorugh your precious battery in the best case, or destabilising your quad in the worst case.

Another platform which is smaller (lighter) and still has arduino interface is the maple mini - you can still get them on aliexpress: 6.18C$ |Free Shipping! 1pcs Leaflabs Leaf Maple Mini Arm Stm32 Compatibility - Other Electronic Components - AliExpress

The beaglebone PRUs are generally used much lower level than having an RTOS on them. Normally you’d write them in C or ASM though they do have their own op-codes 'cause they aren’t an ARM or really anything else. You can probably port an RTOS to them but…

Normally what you’d do is set them up either with a task that runs cyclically or I do believe they can use interrupts. Remember with a main CPU running beside them, you can do your high-level tasks in the main CPU. Also they the ability, with arbitration (meaning it’ll slow down the system in unkown ways) to talk directly with the 512MB of ram - for advanced control systems you can throw an 8mb ram file up to share data between the CPU and the PRU which is how some of the 3d printer capes work. They also have onboard ram for both program and data and can share data between eachother that way.

The codesys on pi is: CODESYS Control for Raspberry Pi SL | CODESYS Store International

Wow, there’s just a million options !!

If it’s easier, I am willing to just buy a separate microprocessor, or microcontroller for every separate task group a drone needs to operate. Might sound stupid, but I am not trying to just build little domestic (under 25 Kg.) drones, I want to build large automated aircraft. Think SUV size, not microwave oven size.

Something that can carry 100-200 lbs. A few lbs of extra micro hardware won’t kill the flightpath distance.

Even larger models may happen too.

A VTOL search & rescue drone that drop a bunch of emergency survival supplies in to help an injured skier or stranded snow mobile won’t mind a few lbs extra weight.

There are RC aircraft the size of most cars, so the controller weight isn’t a huge issue. If I make a smaller proof of concept drone that is under the 25 kg limit, a pound or 2 extra weight may reduce the battery flight time by 20% or 30%, but that won’t deter investors. They will see how switching from the weak little LiPo batteries on the 1st prototype to full size aircraft internal combustion engines on production models will eliminate the short flightpath.

I recommend you start small.

Choose something you like from here and build it:

Stuff will come up that you don’t expect, and the drone will be small,
inexpensive and manageable enough that you can solve it, and apply those
lessons to a scaled up version 2.

Any other path would be very silly.

··· On Thu, Mar 17, 2016 at 12:30 AM, Jeff wrote:

boilerwelder https://talk.vanhack.ca/users/boilerwelder
March 17

Wow, there’s just a million options !!

If it’s easier, I am willing to just buy a separate microprocessor, or
microcontroller for every separate task group a drone needs to operate.
Might sound stupid, but I am not trying to just build little domestic
(under 25 Kg.) drones, I want to build large automated aircraft. Think SUV
size, not microwave oven size.

Something that can carry 100-200 lbs. A few lbs of extra micro hardware
won’t kill the flightpath distance.

Even larger models may happen too.

A VTOL search & rescue drone that drop a bunch of emergency survival
supplies in to help an injured skier or stranded snow mobile won’t mind a
few lbs extra weight.

There are RC aircraft the size of most cars, so the controller weight
isn’t a huge issue. If I make a smaller proof of concept drone that is
under the 25 kg limit, a pound or 2 extra weight may reduce the battery
flight time by 20% or 30%, but that won’t deter investors. They will see
how switching from the weak little LiPo batteries on the 1st prototype to
full size aircraft internal combustion engines on production models will
eliminate the short flightpath.

Visit Topic
https://talk.vanhack.ca/t/interesting-drone-question-microprocessor-or-microcontroller/3988/14
or reply to this email to respond

To stop receiving notifications for this particular topic, click here
https://talk.vanhack.ca/t/interesting-drone-question-microprocessor-or-microcontroller/3988/unsubscribe.
To unsubscribe from these emails, change your user preferences
https://talk.vanhack.ca/my/preferences

1 Like

“I recommend you start small.”

“If I make a smaller proof of concept drone that is under the 25 kg limit”

Me too…

That’s mine - the control board on it is a Naze32, which runs a small STM32 micro-controller.

Everything @Jarrett wrote is correct.

For that workshop a while ago, we were using this arduino based board, which is probably what Dan was thinking of.

There’s a lot to learn with building and flying drones without writing your own software - I’d strongly suggest learning to fly and tune a quadcopter on someone else’s board first.

1 Like

@boilerwelder I’ll be at VHS this coming Tuesday. Come on by and we can talk about flight control systems.

@boilerwelder I’ll be at VHS this coming Tuesday. Come on by and we can talk about flight control systems.”

Sorry, I am very busy, but thank you very much though.

Perhaps another time…