Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

Building a Raspberry Pi Pico 2-powered drone from scratch

16 October 2024 at 14:59

The summer, and Louis Wood’s internship with our Maker in Residence, was creeping to a close without his final build making it off the ground. But as if by magic, on his very last day, Louis got his handmade drone flying.

3D-printed CAD design

The journey of building a custom drone began with designing in CAD software. My initial design was fully 3D-printed with an enclosed structure and cantilevered arms to support point forces. The honeycomb lid provided cooling, and the enclosure allowed for embedded XT-60 and MR-30 connections, creating a clean and integrated look. Inside, I ensured all electrical components were rigidly mounted to avoid unwanted movement that could destabilise the flight.

Testing quickly revealed that 3D-printed frames were brittle, often breaking during crashes. Moreover, the limitations of my printer’s build area meant that motor placement was cramped. To overcome these issues, I CNC-routed a new frame from 4 mm carbon fibre, increasing the wheelbase for better stability. Using Carveco software, I generated toolpaths and cut the frame on a WorkBee CNC in our Maker Lab. After two hours, I had a sturdy, assembled frame ready for electronics.

Not one, not two, but three Raspberry Pis

For the drone’s brain, I used a Raspberry Pi Pico 2 connected to an MPU6050 gyroscope for real-time orientation data and an IBUS protocol receiver for streamlined control inputs. Initially, I faced issues with signal processing due to the delay of handling five separate PWM signals. Switching to IBUS sped up the loop frequency by tenfold, which greatly improved flight response. The Pico handled PID (Proportional-Integral-Derivative) calculations for stability, and a 4-in-1 ESC managed the motor signals. The drone also carries a Raspberry Pi Zero with a Camera Module 2 and an analogue VTX for real-time FPV (first-person view) flying.

All coming together in the Maker Lab at Pi Towers

Programming was based on Tim Hanewich’s Scout flight controller code, implementing a ‘rate’ mode controller that uses PID values to maintain desired angular velocities. Fine-tuning the PID gains was essential; improper settings could lead to instability and dangerous oscillations. I followed a careful tuning process, starting with low values for each parameter and slowly increasing them.

To make the process safer, I constructed a testing rig to isolate each axis and simulate flight conditions. This allowed me to achieve a rough tune before moving on to actual flight tests, ultimately ensuring the drone’s safe and stable performance.

The post Building a Raspberry Pi Pico 2-powered drone from scratch appeared first on Raspberry Pi.

It’s all hands OFF deck with this Pi-powered LEGO card shuffler

2 October 2024 at 16:14

Who needs to laboriously shuffle their own deck when Raspberry Pi can do it for you? In the latest issue of The MagPi, our recent intern, Louis Wood, tells us all about the nifty LEGO card shuffler he designed during his summer spent in the Maker Lab.

Maker and Cambridge engineering undergraduate Louis Wood first encountered Raspberry Pi while looking for a low-cost microcontroller that could be programmed with Python for an A-level project. Inspiring plenty of envy, he’s just spent six whole weeks ensconced in Raspberry Pi HQ’s very own maker space building a range of Raspberry Pi projects, including a LEGO card shuffler. Basing it around the LEGO Build HAT helped him evolve and improve upon a design that he and his Queens’ College Cambridge friends, Lucas Hoffman and Emily Wang, devised. The card shuffler idea was their response to a design and build challenge, based around a LEGO NXT system, to demonstrate an aspect of engineering science. The dual-motor design was in need of some reworking, which Louis undertook while working as an intern at Raspberry Pi Towers alongside Maker in Residence Toby Roberts.

A MicroPython script takes shuffling out of your hands by spinning these wheels alternately and pushing cards into the shuffled pile at random

Quirky and cool

Louis used a LEGO Spike education kit with Raspberry Pi’s LEGO Build HAT to create a simpler but more robust design. The kit includes cycle motors, which he attached directly to the Build HAT’s four connectors. “The Build HAT made it pretty easy to pick up all the motors and plug them in.” He then programmed Raspberry Pi 4 over SSH, “which made it easy to tweak code.”

The MicroPython code produces either a one or a zero and spins either the left or right motor accordingly: “When the motor turns on, the wheel spins a few cards into the middle.” The motors run on a loop, each powering on for a second or two, pushing cards from each side and randomly shuffling them into a central pile until the Build HAT colour sensors detect the black base of either card bay. The card shuffler then skips that side and only runs the opposite motor for a while to clear the rest of the cards. Once it notices it’s done shuffling, it stops.

The build took a couple of hours, and Louis spent a similar time coding and tweaking the build. “The hardest thing was making it so that it doesn’t just spit out the whole side [of cards] at once,” he says.

His simple-but-effective barrier is positioned such that only a single card at a time can (usually) be shuffled along by the motor. The setup doesn’t always work flawlessly, occasionally requiring the user to deftly flick a card back into place, but Louis aims to improve the design by moving apart the two card holding sides to prevent blockages.

The dynamic Raspberry Pi 4 × Build HAT duo at work

The Build HAT came into its own thanks to the colour sensor Raspberry Pi 4 used to detect whether there were still cards awaiting shuffling. The white background of the cards contrasted with the black base of the crates he’d created, which was visible only when the stack of cards was depleted. Other card decks — such as Uno ones, which usually have a black background — could be shuffled too, as long as the card holder base colour was changed.

Makers gonna make

Two weeks into his internship, Louis had already created and written about a ‘Pixie’ tube clock and had been building “a Raspberry Pi mount and cooling system for one of the engineers upstairs, so you can sort of be running eight Raspberry Pis at the same time, fans, and an enclosure,” as well as a remote control based on the brand-new Pico 2.

Louis’ Pixie clock (Pi-powered Nixie clock) has since been repurposed as a TikTok ‘likes’ counter

Given this prodigious rate of design, we asked whether an engineering career or one as a maker is in his future. “I’d like to be a maker, but I think it’s quite hard…” Louis said. “To be a maker YouTuber takes a lot of work and time, I think… probably a bit risky.”

Read the full story, including some extra tips and projects from maker Louis Wood, in The MagPi #146.

The MagPi #146 out NOW!

You can grab the new issue right now from Tesco, Sainsbury’s, Asda, WHSmith, and other newsagents, including the Raspberry Pi Store in Cambridge. It’s also available at our online store, which ships around the world. You can also get it via our app on Android or iOS.

The image you provided is the cover of "The MagPi" magazine, issue 146, from October 2024. This magazine is dedicated to Raspberry Pi enthusiasts. The cover design is orange with black and white elements, featuring a retro horror theme. Some of the key elements on the cover include: The main headline, "PLAY RETRO HORROR CLASSICS ON RASPBERRY PI 5," likely highlighting a feature on retro horror games. The text "Police Line Do Not Cross" in several places, adding to the spooky, horror theme, possibly in reference to crime or mystery-themed games. The imagery of a crow, a spooky-looking house, a cassette tape, and various retro gaming motifs, reinforcing the horror and retro gaming aesthetic. Additional highlights like "LEGO Card Shuffler," "Top 10 Spooky Projects," and "Recycle a Fighter Jet Joystick," suggesting other tech and DIY projects featured in this issue. The bottom of the cover mentions "TURN IT UP TO 11 WITH AUDIO UPGRADES," hinting at content related to enhancing audio experiences. The overall theme seems focused on retro horror gaming and tech projects for Raspberry Pi.

You can also subscribe to the print version of The MagPi. Not only do we deliver it globally, but people who sign up to the six- or twelve-month print subscription get a FREE Raspberry Pi Pico W!

The post It’s all hands OFF deck with this Pi-powered LEGO card shuffler appeared first on Raspberry Pi.

❌
❌