Scott Shawcroft Is Programming Game Boys With CircuitPython

Some people like to do things the hard way. Maybe they drive a manual transmission, or they bust out the wire wrap tool instead of a soldering iron, or they code in assembly to stay close to the machine. Doing things the hard way certainly has its merits, and we are not here to argue about that. Scott Shawcroft — project lead for CircuitPython — on the other hand, makes a great case for doing things the easy way in his talk at the 2019 Hackaday Superconference.

In fact, he proved how easy it is right off the bat. There he stood at the podium, presenting in front of a room full of people, poised at an unfamiliar laptop with only the stock text editor. Yet with a single keystroke and a file save operation, Scott was able make the LEDs on his Adafruit Edge Badge — one of the other pieces of hackable hardware in the Supercon swag bag — go from off to battery-draining bright.

Code + Community

As Scott explains, CircuitPython prides itself on being equal parts code and community. In other words, it’s friendly and inviting all the way around. Developing in CircuitPython is easy because the entire environment — the code, toolchain, and the devices — are all extremely portable. Interacting with sensors and other doodads is easy because of the import and library mechanics Python is known for, both of which are growing within the CircuitPython ecosystem all the time.

CircuitPython is so friendly that it can even talk to old hardware relatively easily without devolving into a generational battle. To demonstrate this point, Scott whipped out an original Nintendo Game Boy and a custom cartridge, which he can use to play fun sounds via the Game Boy’s CPU.

Now You’re Playing With Python

It’s interesting to see the platforms on which Scott has used the power of CircuitPython. The Game Boy brings the hardware for sound and pixel generation along with some logic, but he says it’s the code on the cartridge that does the interesting stuff.

The CPU communicates with carts at a rate of 1MHz. As long as you can keep this rate up and the CPU understands your instructions, you can get it to do anything you want.

Scott’s custom cart has a 120MHz SAMD51. He spends a second explaining how he gets from Python libraries down to the wire that goes to the Game Boy’s brain — basically, the C code underneath CircuitPython accesses direct structs defined within the SAMD to do Direct Memory Access (DMA), which allows for jitter-free communication at 1MHz.

He’s using the chip’s lookup tables to generate a 1MHz signal out of clock, read, and A15 in order to send music-playing instructions to the sound register of the Game Boy’s CPU. It sounds like a lot of work, but CircuitPython helps to smooth over the dirty details, leaving behind a simpler interface.

If you want easy access to hardware no matter how new or nostalgic, the message is clear: snake your way in there with CircuitPython.

Continue reading “Scott Shawcroft Is Programming Game Boys With CircuitPython”

Fly With A Game Boy Classic

How many grown-up hardware hackers whiled away their youth playing Tetris or Mario on their Game Boy? Fond memories for many, but unless you are lucky your Game Boy will probably be long gone. Not for [Gautier Hattenberger] though, he had an unexpected find at his parents’ house; his Game Boy Classic, unloved and forgotten for all those years. Fortunately for us his first thought was whether he could use it as a controller for a drone, and better still he’s shared his work for all of us to see.

How to connect a drone and a Game Boy
How to connect a drone and a Game Boy

Back in the day a would-be Game Boy hacker would have been deterred by Nintendo’s legal defences against game piracy, but with the benefit of a couple of decades the handheld console’s hardware is now an open book. Unfortunately for [Gautier], he seems to be the first to use one as a flight controller, so he had to plough his own furrow. His Game Boy Game Link serial port feeds an Arduino/FTDI combination that converts Game Link  to USB, which is then sent to his laptop on which a small piece of software converts them to commands for the drone through the Paparazzi UAV framework.

All his code is in a GitHub repository, and he’s posted a video of his work which you can see below the break. For a child of the early ’90s, the mere thought that their handheld console could do this would have been mindblowing!

Continue reading “Fly With A Game Boy Classic”

Adding A Backlight To The ‘ol Game Boy Brick

For being more than 20 years old, [Max]’s old brick-sized Game boy still has a lot of life left in it. Even though his Game Boy was still in good condition, there were a few vertical lines in the display, making it a perfect candidate for a restoration. While he had his DMG-01 open on his work bench, [Max] also decided to put in a back light.

After researching the blank vertical lines in his Game Boy’s display, [Max] learned the problem was probably a loose solder connection. [Max] whipped out his tri-wing screwdriver, disassembled his classic plastic friend, took a soldering iron to the LCD’s flex connector, and fixed the problem easily.

Since his Game Boy was already taken apart, he decided to add a 3rd party backlight. The installation was a snap – [Max] only removed the reflective LCD backing and shoved an edge-lit backlight panel into the Game Boy.

If you’re wondering why anyone would still be interested in a 20+ year-old Game Boy, the DMG-01 is highly regarded in the chiptune scene when paired with Little Sound DJ, in part because of the noisy amplifiers and unique sound. Anything that keeps these wonderful machines out of the garbage is alright in our book, so we’ve got to hand it to [Max] for putting together this wonderful tutorial.