Raspberry Pi for Rockets....

The Rocketry Forum

Help Support The Rocketry Forum:

JohnCoker

Well-Known Member
Joined
Apr 13, 2013
Messages
2,179
Reaction score
849

mikec

Well-Known Member
Joined
May 9, 2009
Messages
2,664
Reaction score
481
The original article was about the RP2040, which is a microcontroller called a Pi in name only (doesn't run Linux, etc.)

The Pi is nice but even the Zero uses a heck of a lot of power compared to a microcontroller. I built an ADS-B tracking system and it uses over 2W of power when operating (admittedly half of that goes to the radio dongle.)
 

heada

Well-Known Member
Joined
Jan 18, 2009
Messages
5,072
Reaction score
2,467
Location
Indianapolis, Indiana
One orher limitation of the non-microcontroller Pi devices is that they're not a real-time OS. Really cool and powerful devices, and I have several, but for flight control you want something with real-time OS like the RP2040 or other microcontroller.
 

Blast it Tom!

Well-Known Dweeb
Joined
Dec 30, 2019
Messages
1,623
Reaction score
1,351
Location
Pittsburgh
One orher limitation of the non-microcontroller Pi devices is that they're not a real-time OS. Really cool and powerful devices, and I have several, but for flight control you want something with real-time OS like the RP2040 or other microcontroller.
I assume the same remark would be true for an Arduino? I hope to get into these devices someday, but not so much if they are the wrong choice for rocketry.
 

heada

Well-Known Member
Joined
Jan 18, 2009
Messages
5,072
Reaction score
2,467
Location
Indianapolis, Indiana
I assume the same remark would be true for an Arduino? I hope to get into these devices someday, but not so much if they are the wrong choice for rocketry.
Arduino is a microcontroller and so is more suited for real-time applications compared to a Raspberry Pi(except the RP2040 which is a microcontroller) Typically Arduino devices are small and underpowered compared to other microcontrollers but they're extremely common and cheap so a very good place to get started and learn but I'd go with something more powerful like an ESP32 or Teensy to do actual flight control.

Typical Arduino is going to be ~$5 to ~$10 each. A Teensy 4.0 is ~$20 each. I think the RP2040 is ~$8. The abilities of each within the realm of microcontrollers is vastly different.
 

WillMarchant

Well-Known Member
Joined
Jan 15, 2009
Messages
2,543
Reaction score
198
I assume the same remark would be true for an Arduino? I hope to get into these devices someday, but not so much if they are the wrong choice for rocketry.

What heada said.

Bruce and I are running a "get started with" Arduino session at vNARCON on Sunday, if you're interested.
 

mikec

Well-Known Member
Joined
May 9, 2009
Messages
2,664
Reaction score
481
The classic Arduino form factor is a little big and a little underpowered IMHO. The smaller Cortex-M0 boards (e.g., Adafruit Trinket M0) are probably what I would use from scratch, though the smaller ATmega328-based Arduinos (e.g., Sparkfun Pro Mini 328) are still sufficient for lots of stuff.
 

Blast it Tom!

Well-Known Dweeb
Joined
Dec 30, 2019
Messages
1,623
Reaction score
1,351
Location
Pittsburgh
Well, us dummies gotta start, or re-start, somewhere! I had an introductory course in microprocessor control and did some machine-level coding (in hex) about 36 uears ago as an undergraduate mechanical engineer, but that was the last I've dealt with it. I did very well - I was the only one in the class of 60+ to actually solve the problem in the final exam properly - every one else used a work-around. It's fascinating stuff! Thanks, @mikec for the pointer. Power is certainly important.
 

WillMarchant

Well-Known Member
Joined
Jan 15, 2009
Messages
2,543
Reaction score
198
The classic Arduino form factor is a little big and a little underpowered IMHO. The smaller Cortex-M0 boards (e.g., Adafruit Trinket M0) are probably what I would use from scratch, though the smaller ATmega328-based Arduinos (e.g., Sparkfun Pro Mini 328) are still sufficient for lots of stuff.

I'm a huge fan of the Adafruit Feather https://www.adafruit.com/category/943 line. Pretty small, but not so small that you lose all of the I/O. The vNARCON configuration fits inside an Estes Green Eggs payload bay and flies well on C11 and D12 motors. So pretty cheap to fly.
 

dhbarr

Amateur Professional
Joined
Jan 30, 2016
Messages
8,081
Reaction score
2,506
400mA draw from the 1S while moving a servo, but it's not clear for how long the "servo" would be lit....
 

cwbullet

Obsessed with Rocketry
Staff member
Administrator
Global Mod
Joined
Jan 24, 2009
Messages
29,803
Reaction score
7,257
Location
Glennville, GA
Those are great little computers, although actually not that small. I have use them for several things, including to drive a picture frame:

I received an email from the designer. He has the means to set off ejection charges. I would take a few modifications.
 

5thDay

Well-Known Member
Joined
Jan 16, 2022
Messages
47
Reaction score
31
Location
Apache Junction, Arizona, USA, Earth
Arduino (and other) microcontrollers are something I am very comfortable with and am able to trade messages of support with anyone just getting into them.
For basics here are some points to consider, some topics to research and my personal opinions. Google + "Arduino how to ___" = happiness. It is so well supported that most people should direct you to Arduino and Arduino IDE when getting started even if other boards have better performance or features.

Events (outputs) higher than 5v OR more than a few milliamps of power:
How to switch loads with Arduino, MOSFET/transistor?
Basic helpful sensors:
Arduino connect to:
BMP280
basic altimeter using pressure
MPU6050 Direction, acceleration via 6axis gyroscope, IMU
I2C Connection protocol between Arduino and various sensors
Programming: (lots)
Pretty much anything from Joey B @ BPS.space
Switch Case programing, while statements, if statements, blink without delay using millis, digitalwrite (output), analogread (input), many more

I think the real beauty of coding in the Arduino environment is the logical simplicity. Detect something, do something. Loop back to beginning of program and detect something else or again.

Boards
Arduino Uno - most common and most support but a little wide for most airframes. Recommended still as you can write programs and ground test with this even if you wish to fly a smaller board below.
Arduino Nano - Love it, skinny, fully featured, my 2nd favorite.
Arduino Pro Micro, Mini, ATtiny etc - often utilize 3.3v and have less range of appropriate power voltages.
Arduino Mega - super fun board, way way too much for any non-orbital class rocket :)
ESP8266, NodeMCU - a good step up to later board with a huge bonus of connection options such as wifi and Bluetooth! I unfortunately find these rather sensitive but a great size for 38mm+ airframes.
 

5thDay

Well-Known Member
Joined
Jan 16, 2022
Messages
47
Reaction score
31
Location
Apache Junction, Arizona, USA, Earth
I assume the same remark would be true for an Arduino? I hope to get into these devices someday, but not so much if they are the wrong choice for rocketry.

I have heard
I assume the same remark would be true for an Arduino? I hope to get into these devices someday, but not so much if they are the wrong choice for rocketry.
I have heard (for lack of a better term) complaints about Arduino not being real-time or not multitasking or not enough RAM, etc since around the same time I heard about Arduino.

Please don't assume I am speaking negatively about those expressing such concerns. I believe that its' lower statistics when compared to a desktop PC are irrelevant when the needs of the project are concerned. Often I feel that my $ is wasted when I load a sketch that uses 5-10% of available memory and like many people find myself considering ATtiny procs that use less power and give me just the IO I need for my project.

RAM limits teach us to write efficient code. Did I create a global long when a boolean would have worked? Did I remember to F my serial.prints in my debugging code? What in a given includeLibrary, am I adding and what do I actually need?

One YouTuber (forgive me I forget which) broke down loop speed and did his best to count how many times his code actually completed and started over per second. A hint at the answer is the "M" in mHZ!!! Speed to look for something happening/changing and respond of course isn't 8million or 16million times per second but at what point is something "slow"? 500,000Hz, 100,000Hz, 10k... 1,000 times every second make a check on our altitude?
BMP280 claims 1m resolution and hesitates to give an answer on how fast you can ask it again.
I find thrustcurve data and openrocket sims generally sample or sim around 0.1 to 0.2 seconds at a time (or perhaps just display that). Given a Soyuz cluster as an example:
If I know and trust the data, I can sequentially fire motors in flight just at the end of a burn OR fire the next just 0.1 seconds before the previous begins to reduce thrust from peak.

Probably a bad example above honestly as an IC555 can do that with a few caps and resistors. :)
 

Blast it Tom!

Well-Known Dweeb
Joined
Dec 30, 2019
Messages
1,623
Reaction score
1,351
Location
Pittsburgh
I have heard

I have heard (for lack of a better term) complaints about Arduino not being real-time or not multitasking or not enough RAM, etc since around the same time I heard about Arduino.

Please don't assume I am speaking negatively about those expressing such concerns. I believe that its' lower statistics when compared to a desktop PC are irrelevant when the needs of the project are concerned. Often I feel that my $ is wasted when I load a sketch that uses 5-10% of available memory and like many people find myself considering ATtiny procs that use less power and give me just the IO I need for my project.

RAM limits teach us to write efficient code. Did I create a global long when a boolean would have worked? Did I remember to F my serial.prints in my debugging code? What in a given includeLibrary, am I adding and what do I actually need?

One YouTuber (forgive me I forget which) broke down loop speed and did his best to count how many times his code actually completed and started over per second. A hint at the answer is the "M" in mHZ!!! Speed to look for something happening/changing and respond of course isn't 8million or 16million times per second but at what point is something "slow"? 500,000Hz, 100,000Hz, 10k... 1,000 times every second make a check on our altitude?
BMP280 claims 1m resolution and hesitates to give an answer on how fast you can ask it again.
I find thrustcurve data and openrocket sims generally sample or sim around 0.1 to 0.2 seconds at a time (or perhaps just display that). Given a Soyuz cluster as an example:
If I know and trust the data, I can sequentially fire motors in flight just at the end of a burn OR fire the next just 0.1 seconds before the previous begins to reduce thrust from peak.

Probably a bad example above honestly as an IC555 can do that with a few caps and resistors. :)
Ah, the good old days of efficient code and minimal RAM and power usage! How fast will the loop execute? What's the settling time on your controlled device? And as you noted, it's often not how fast you can sample, but how fast you need to sample, or how low of a rate can you get away with?

My class "way back when" (1986-87) was on the Motorola 6800 microprocessor. We thought 16 bits and 16 MHz was really something back then!
 
Last edited:

heada

Well-Known Member
Joined
Jan 18, 2009
Messages
5,072
Reaction score
2,467
Location
Indianapolis, Indiana
If all you're doing is reading a sensor and recording it X samples per second, then the Arduino Pro Mini and the like is a great solution. They're cheaper than dirt (a 3 pack for $10) and fit the bill.

On the other hand, if you're reading a 10DoF sensor or 2, applying high and low pass filters, integrating that into quants, applying some PID and calculating how much command to give a set of 4 servos to correct a 1.2 degree tilt and a 18 degree per second rotation, while also wanting to white GPS data out to an SD card and out to a LoRA module, then you'll want something with more compute power and program space. Now you're talking about maybe an Arduino Nano 33. But at that cost ($20), you can get boards with more than 10 times the power and program space for almost the same cost. (600Mhz dual core with sep math co-processor and 8MB of program space with a sep 8MB of PSRAM ($27))

Regardless, get a Pro Mini and learn. They're so cheap, get a dozen and not worry about toasting a 3.3v I/O with 5v. They're the default standard for every project. If you can do it with a Pro Mini, then you can do it on pretty much any microcontroller.

edit: The RPi RP2040 is another that fits very well and only $4 each, can't beat it.
 
Last edited:

tOD

Sinking in the quicksand of HPR
Joined
Jul 31, 2018
Messages
651
Reaction score
369
Location
Pittsburgh, PA
Ah, the good old days of efficient code and minimal RAM and power usage! How fast will the loop execute? What's the settling time on your controlled device? And as you noted, it's often not how fast you can sample, but how fast you need to sample, or how low of a rate can you get away with?

My class way back when was on the Motorola 6800 microprocessor. We thought 16 bits and 16 MHz was really something back then!
I'm in same boat, I've got a lot of catching up to do.
There's a lot of interesting stuff available cheap and I've made a start trying to learn a little of it. The question is, rocket wise, do I really need anything more sophisticated than a $20 Eggfinder Quark to pop two parachutes?
 

heada

Well-Known Member
Joined
Jan 18, 2009
Messages
5,072
Reaction score
2,467
Location
Indianapolis, Indiana
I'm in same boat, I've got a lot of catching up to do.
There's a lot of interesting stuff available cheap and I've made a start trying to learn a little of it. The question is, rocket wise, do I really need anything more sophisticated than a $20 Eggfinder Quark to pop two parachutes?
If all you want to do is control recovery events, go with a commercial device. I have Quarks and love them. They're well proven and optimized already for the task. Where a custom setup comes into play is where you want to do something that isn't available on a commercial device, e.g. active flight control.
 
  • Like
Reactions: tOD
Joined
Feb 8, 2009
Messages
271
Reaction score
80
Location
Fairfax Station, VA

I saw this yesterday and its started me down the rabbit hole of designing a new board using the RP2040 chip. It looks pretty awesome, and the ability to program it without a separate bootloader sounds really awesome. I currently use the Teensy 3.5, which just ran out on pjrc.com and digiKey.

There are a few of us out lurking out in the forum that build/design/code our own flight computers. I definitely recommend starting with a data recorder before progressing to deployment functions. A commercial system for primary deployment is also a good idea. Here's my open soure code if anyone is curious


Version 3_2.jpg
 

Blast it Tom!

Well-Known Dweeb
Joined
Dec 30, 2019
Messages
1,623
Reaction score
1,351
Location
Pittsburgh
I'm in same boat, I've got a lot of catching up to do.
There's a lot of interesting stuff available cheap and I've made a start trying to learn a little of it. The question is, rocket wise, do I really need anything more sophisticated than a $20 Eggfinder Quark to pop two parachutes?
Good for you! Even if you never use it, you learn a little more about what the ol' Quark is doing! Plus it's good brain exercise for us old retired types! ;)

My wife wondered why in the world would I want to register for NARCON. I told her there is so much to learn. "What's to learn? They go up, and then they come down!" she replied. Well, for Pete's sake, so did Apollo 11, eventually! :rolleyes:
 
Top