Normal view

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

Book of Making 2025 on sale now: build superb projects from plant monitors to rockets

10 October 2024 at 21:29

Learn how to recreate all of the best projects from HackSpace magazine with the Book of Making 2025, on sale now at £14.

book of making front cover

The image is a cover for the Book of Making 2025, a guide for DIY enthusiasts, makers, and hackers. It features a variety of electronics components and tools on a dark background, including a Raspberry Pi board, a Raspberry Pi Pico, a screwdriver, a wrench, pliers, an SD card, a soldering iron, a battery, and a breadboard.

The cover promotes several project ideas such as:

Building a flat-pack rocket
Making electronic music with a Raspberry Pi Pico
Creating a connected plant monitor
Building smart home lighting
At the top, it reads "Projects for Makers & Hackers," and at the bottom, it notes that the book is "From the Makers of HackSpace Magazine." The color scheme primarily features green, white, and black with vibrant highlights, giving it a tech-savvy, hands-on vibe.

We had so much fun making HackSpace magazine (and we hope you had fun reading it). It’s been a couple of months now since we incorporated HackSpace into a bigger, brighter, better version of The MagPi. While the standalone magazine may have gone from the shelves, it’s still on the immortal internet, where you can download every issue for free. And if that’s not enough to cater for your desire to make semi-useful things out of home electronics, microcontrollers, 3D printers and the like, there’s the Book of Making 2025 to scratch your itch, on sale today in all good bookshops and online from the Raspberry Pi Press store.

Book of Making 2025 distills the essence of HackSpace magazine down to our favourite maker projects. Whether you want to build a rocket or hot air balloon, learn 3D-printed mechanical engineering, or control the world around you with a Raspberry Pi Pico, there’s something for you here.

This book is full of projects perfect for an hour, afternoon, or weekend; be inspired by the amazing community projects you’ll find in its pages and make your own creations using step-by-step guides.

You’ll learn how to:

  • Work with microcontrollers and electronic circuits
  • Design for 2D and 3D fabrication methods and make them a reality
  • Create amazing things with everyday items
  • …and loads more!

Hackspaces and makerspaces have exploded in popularity the world over, as more and more people want to make things and learn in the process. Written by makers for makers, this book features a diverse range of projects to sink your teeth into. Grab some duct tape, fire up a microcontroller, ready a 3D printer, and hack the world around you!

The post Book of Making 2025 on sale now: build superb projects from plant monitors to rockets appeared first on Raspberry Pi.

Raspberry Pi Pico brings junked joysticks back to life | The MagPi #146

26 September 2024 at 22:30

In the latest issue of The MagPi, out today, we talk to David Miles, who designed a Raspberry Pi Pico kit to bring junked joysticks back to life.

One of the many great things about the EMF Camp events is the swap shop tent, where all kinds of things are brought to be sold and exchanged. On one of my many visits there, I found a slightly worn (but very heavy) pair of joysticks which looked as if they had been part of a professional simulator at some point. In this article, I’ll talk about how I reverse-engineered them to create a fully fledged flight simulator controller. Along the way, I happened to create a Pico program that makes it easy to use any input device as a USB joystick. 

The image shows two gimbal joysticks resting on grass. These joysticks are industrial or military-grade, manufactured by "Ultra Electronics" (Electrical Division). They both have black bases with model information labels on them, identifying the joysticks as part of the Ultra Electronics line. Left Joystick: It appears worn, with patches of the original paint chipped away, revealing a lighter color underneath. The grip features several buttons and what looks like a control hat (small thumbstick). Right Joystick: This one appears to be in better condition, with a smoother and more consistent finish. It also has buttons and a control hat, similar to the left joystick, but the design is slightly more compact and less worn. Both joysticks are mounted on black gimbal bases, which allow for multidirectional movement, and each has a label with the Ultra Electronics branding. The labels contain text, including "Gimbal Joystick" and some part or batch numbers, but they are partially obscured or difficult to read due to the angle. These joysticks could be from fighter jets or advanced simulation setups.
Figure 1: The joysticks as I found them in the EMF Camp swap shop

Getting started

Figure 1 shows the joysticks as I found them. Ultra Electronics is a manufacturer of devices for the Ministry of Defence in the UK, so this looked like something interesting. My hope was to try and get them working so I could use them with a flight simulator for a plane that used joysticks like these. This meant I had two challenges:

  • Getting data out of the joystick
  • Making something which connects to a PC as a game controller

Follow the signals

To discover how to get data out of the joystick, I had a look at the wires that came out of it. The main unit has two plugs on the end of a (surprisingly long) wire — what looks like a nine-pin RS232 serial connector, and a 15-pin game port connector. The secondary joystick (the one on the right in Figure 1) has a 25-pin connector which plugs into the primary one, which suggests that it just contains switches, and that the first is the brains of the operation. The connector types fit the late-’90s feel of the hardware and give clues as to how we can talk to it, but we can take a look inside to confirm some assumptions.

Figure 2 shows the view inside the device. There are four screws holding the top part of the joystick inside the case. After removing these, the whole stick and gimbal assembly lifts out and we can see this circuit board. Some of the components on here give us some pointers on how this works.

The image shows the internal components of an electronic device, likely part of the control mechanism for the joysticks in the previous image. It features a printed circuit board (PCB) with various electronic components and wiring. Key elements visible in the image include: Integrated Circuits (ICs): Several IC chips are mounted on the PCB, including some marked with "H" and what appears to be part numbers like "CD74AC573E" and "1814306." These ICs likely control the logic and processing functions of the device. Dip Switches: A blue section of the board has multiple red dip switches, which are used to configure the device for various settings or functions. Wiring: Color-coded wires connect the board to a nearby connector, which suggests this component interfaces with other parts of a larger system. The wiring is neatly organized and secured in place with black ties. Labelled Component: One chip has a white label with "PRG_OBDO," which could indicate this is a programmable chip or ROM that stores specific instructions or firmware for the device. LEDs or Indicators: Several small red components, possibly LEDs, are mounted near the switches, likely serving as status indicators for the system. This appears to be a custom-built or specialized electronics module, possibly part of a control system for industrial or aviation-related equipment, given the context of the previous images. The wiring and the presence of programmable chips suggest it controls a complex system.
Figure 2: The PCB at the heart of the joystick. Look at all those carefully adjusted and sealed calibration resistors!

There’s a chip with a label covering it. This is normally a sign of some sort of microcontroller, indicating that there’s more going on than just a simple controller. This is backed up by seeing some chips with ‘ADC’ on them — this stands for ‘Analogue to Digital Converter’, and could be used to turn an analogue value (e.g. the position of a potentiometer in a joystick) into a digital value sent to a computer. 

Finally, in the middle, there is a chip with ‘MAX232’ written on it. This family of chips are used to convert 5v logic levels you often see used in microelectronics to the 15v levels used in RS232 communications. This is another sign that the nine-pin connector is probably a regular RS232 connector I can use to get data from the joystick.

This leaves the 15-pin connector. Is it a game port? Game port connectors were often used in the ’90s to connect a joystick to your PC (confusingly, often using a socket on your sound card). They allowed you to connect two joysticks to your computer, each with two buttons. We can see that this joystick has more than four buttons — doing a quick count, we seem to have about 30, so maybe it’s being used for something else.

The image shows the internal view of a joystick, likely the same worn joystick seen in a previous image. The outer casing has been removed to reveal the internal wiring and components. Key elements include: Wiring: A bundle of color-coded wires runs vertically inside the joystick housing. The wires are neatly organized and secured with black ties, indicating they are part of the internal control system that connects the buttons and control mechanisms of the joystick to the external interface. Capacitor: A large black cylindrical component marked "2I649" and "T2" appears to be a capacitor. Capacitors like this are used for energy storage within electrical circuits and are common in joystick designs to manage power surges or smooth out signals. Metal Shaft: A metal rod or shaft is visible running vertically through the center of the joystick, likely part of the gimbal system that allows for multidirectional movement. Green Component: Near the bottom, there's a small green component with what looks like a circular interface or sensor, possibly related to the joystick's motion tracking or button functionality. Buttons: The top of the image shows part of the joystick grip with external buttons still visible, including a red button and a few other black controls. These buttons are connected to the internal components via the wiring. This internal view reveals the intricate electronic design and mechanical structure of the joystick, highlighting its complexity as a precision control device, likely for industrial or aviation purposes.
Figure 3: All the wires have unique colour combinations

If we pull the back off the connector, we can see that there are only two pins connected using red and black wires. If we check those pins on the game port specification, we see that these are connected to ground and 5v.

This fits in with our earlier findings. There’s no way to power a device over a regular serial connection, but using a game port alongside a serial connector would allow you to connect to a PC and transfer power and data.

Plugging it in

Now that we think we know how this works, we can have a go at connecting it to a computer. To do this, I used a regular USB-to-serial converter and a power adapter connected to a USB power bank.

After connecting power, I could see a steady 100ma power draw, which felt reassuring, so I hooked up the serial connection and tried a few different configurations to see if I could receive anything sensible. Eventually, I found one which gave me a regular stream of data which changed as I moved the controls and pressed buttons. It turns out that these joysticks work at 9600 baud (around 100 characters per second) and send 8-bit data. 

The image shows two dialog boxes from the "Game Controllers" settings interface in a Windows operating system. These settings are used to configure and test game controllers connected to the computer. The controller being used appears to be recognized as a "CircuitPython HID" device. Left Dialog Box: Title: "Game Controllers" This box lists the connected game controllers and their status. One controller is listed: "CircuitPython HID," which has a status of "OK," indicating that the controller is recognized and functioning correctly. Buttons include "Advanced" and "Properties" for further configuration or testing of the device. Right Dialog Box: Title: "CircuitPython HID properties" This is the "Test" tab for the game controller, allowing the user to test and calibrate various inputs of the controller. Axes Section: There are visual indicators for the X Axis/Y Axis, Z Axis, and Z Rotation. The test allows movement of the joystick to see how the axes respond in real time. Buttons Section: A grid of red circles represents buttons on the controller, where each circle lights up when a corresponding button on the joystick is pressed. Currently, all the button indicators are off. Point of View Hat Section: This section represents the directional pad (or "POV hat") found on some controllers, allowing for testing of its functionality. Overall, this image shows the controller has been successfully recognized by the system and is being tested using the built-in Windows game controller settings. The "CircuitPython HID" designation suggests the controller is using the CircuitPython library, commonly used for custom hardware projects like joysticks.
Figure 4: This is how Windows sees the controller. The Raspberry Pi has a similar interface for joysticks

Now that I had data, the next thing was to decode it. I started by writing a Python program to read from the joystick and write it out. By starting to build something on the PC, I would have something I could then use on a Pico with CircuitPython.

Working through the controls on the joystick, I found that each button corresponds to a single bit in the data, and each of the axes (X and Y movements of the sticks) with a byte in the output, ranging from -128 to 127, and encoded using two’s complement.

Making a game controller

Now that I could read from the joystick, I needed to send these to the computer as a proper game controller that could be used by programs such as Microsoft Flight Simulator. Figure 3 shows what I was aiming for: I wanted all the abilities of the joystick to be exposed for use on the PC. 

A Raspberry Pi Pico was the perfect thing to use here as it has great IO options and support for working in Python. I needed to configure it to announce itself as a game controller over USB, and then adapt my code to run on the Pico and send the appropriate messages to the PC.

Fortunately, CircuitPython has great support for making custom devices like this. First, we need to define how we want our device to appear over USB, and write some Python to make sure this is registered whenever the Pico connects over USB.

The image shows a collection of electronic components and connectors laid out on a red surface, likely part of a hardware setup for interfacing with or powering a device. Key components include: USB Power Supply: A black external battery pack is powering the setup via a USB cable. The USB cable is connected to a small red "USB Power" module with an integrated display showing output values, including 4.94V and 0.18A. This module is likely monitoring the power draw of the connected components. DB9 Connectors: There are two separate DB9 (serial) connectors. One has a grey body and a blue breakout board at the top, while the other appears to be connected to a green terminal block for wiring. These connectors are typically used for RS-232 or other serial communication interfaces, often found in industrial or retro computing hardware. Breakout Boards: The setup includes at least two small breakout boards attached to the serial connectors. These boards seem to have small ICs and wiring that enable communication or power regulation between the connected devices. Wiring: Several wires, color-coded in yellow, black, and red, are connecting various parts of the setup. Some wires are plugged into a pin header at the left, likely for GPIO or serial communication. Overall Setup: The combination of serial connectors, breakout boards, and USB power monitoring suggests this setup is being used for testing or interfacing with an external device, perhaps an older serial-controlled system or custom hardware. The USB power module ensures that the components receive regulated power, while the serial connectors enable communication between devices. This configuration looks like a development or testing setup for a project involving serial communication and low-power electronics.
Figure 5: The system laid out on the desk. At the top is the power supply provided by a USB battery, at the left is a Raspberry Pi Pico connected to the PC using USB, in the middle is the RS232 interface, and on the right is the game port adapter

This involves digging into the world of USB HID descriptors. HID stands for Human Interface Device, and covers a wide range of gadgets which you can connect over USB, including mice, keyboards, and game controllers, even going as far as volume controls and exercise equipment. 

These descriptors contain information about the device, such as what class it is and which types of data it will send to the PC. By default, CircuitPython supports only a mouse and keyboard. We need to send a descriptor which contains the different axes, buttons, and hats the controller supports.

The full specification for this is on the official www.usb.org site, but we can extend the Adafruit example to increase the number of buttons to 32, and to add an additional entry for the joystick’s hats. 

Putting the boot in

When building CircuitPython projects, you will normally write Python in the code.py file. Code in this file runs after the Pico has initialised USB, so it’s too late to change anything about the device. To do this, we need to look at the lesser-known boot.py file. This file runs when CircuitPython first boots, and before USB is configured, which means that you can make changes to the USB devices that are registered. 

The image shows the interior of what appears to be an aircraft cockpit, with a focus on two joysticks. These joysticks are positioned in front of a set of displays and control panels. Key elements in the image: Joysticks: The foreground joystick is similar to the one seen in previous images, with visible paint wear and a weathered appearance, revealing a lighter color underneath. It has multiple buttons and controls, including a prominent red button and a thumbstick on top. The background joystick is in better condition, with less visible wear and a more uniform appearance. It has similar controls, including buttons and knobs. Cockpit Displays: Behind the joysticks, there are large digital displays, some of which show what appears to be radar or navigation information. The green display on the left is likely a radar or targeting screen, while the right display shows a similar visual. Control Panels: The cockpit is filled with various buttons, switches, and dials, typical of a fighter jet or advanced aircraft. These controls are likely used for navigation, communication, and weapon systems. This image suggests the joysticks are part of an aircraft control system, likely in a military or aviation simulation environment. The worn joystick in the foreground might be an older or heavily used unit, while the cockpit setup and display screens indicate advanced avionics and targeting systems common in modern fighter jets or flight simulators.
Figure 6: The EMF joystick with its virtual counterpart. This looks like a close match to the real thing

The program in the code.py file reads data packets from the joystick, decodes values from the data, and sends USB messages corresponding to the state of the joystick. The present version is in two parts. The first reads the data into a buffer, and the second pulls values out of this buffer and sends USB messages. 

Bringing it all together

Finally, we need to integrate our project which reads from the PC serial port with our game controller code. As the Pico only supports 5v logic levels, we can use our own MAX232 to map the RS232 voltages to something the Pico can handle. To do this, I used an integrated module with a DB-9 connector on one side and a pin header on the other, connected to the Pico. I could also power the joystick from the Pico’s 5v supply.

Now that I had the two halves of the project working together, it was a case of going through the buttons on the device and mapping them across to the controls defined for the controller. This was one of the more tedious parts of the project, but it was a good chance to make sure everything was working correctly.

The image shows a combination of a physical hardware setup and a simulation displayed on a monitor. Key elements: Monitor Display: The monitor displays a realistic aircraft cockpit, likely from a flight simulator. The cockpit features multiple digital screens with radar, navigation, and flight information, including a map, similar to what might be seen in a modern fighter jet. The design and layout of the cockpit are highly detailed, suggesting a realistic simulation environment, perhaps for military or aviation training or entertainment. Hardware Setup: In front of the monitor, there is a physical setup on a red desk, which includes: USB Power Module: A red USB power module similar to what was seen in previous images, connected to the external power source (a black battery pack) and other components. DB9 Serial Connectors and Breakout Boards: The serial connectors, wiring, and breakout boards are also present, part of an electronic interface setup, likely interfacing with the joystick and/or the simulator. Green Microcontroller Board: A small green board with headers and connections, possibly a microcontroller like a Raspberry Pi or an Arduino, is also connected to the system, likely controlling the joystick or interfacing with the simulator. Joystick: In the foreground, someone is holding the joystick (the same one seen in previous images). The person appears to be interacting with the simulation displayed on the monitor, suggesting that the joystick is being used as a control input for the flight simulator. The person is wearing gloves, which might be to protect the equipment or for comfort when handling the joystick during extended use. Context: This image seems to show a setup where a custom-built joystick (and related electronics) is being used to control a flight simulator. The combination of the joystick, the hardware setup on the desk, and the detailed simulator on the monitor points to a project involving custom hardware integration for flight control, possibly as part of a DIY or experimental setup. The physical electronics appear to enable the connection between the joystick and the simulator, allowing for real-time interaction with the simulated aircraft environment.
Figure 7: The joystick in action

Finally, I’ve got everything I need to use the joystick to control a plane running on the PC. Here I’m using it to control the McDonnell Douglas F/A-18 included with Flight Simulator, which has a similar stick to this, but with two hats swapped. I still don’t know precisely which plane (if any) this joystick is based on. The AV-8 Harrier has those hats in the correct order, but has an extra button just below them on the face of the joystick.

I’ve not been able to find any images of joysticks similar to the second stick anywhere, so if you have any idea where that could have come from, please let me know! 

Read the full story, including some extra tips from the maker David Miles, 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 Raspberry Pi Pico brings junked joysticks back to life | The MagPi #146 appeared first on Raspberry Pi.

❌
❌