Even as technology keeps progressing, we find ourselves coming back to the classics again and again. Pong is quite possibly the classic game, and the Raspberry Pi Pico is one of the latest microcontrollers. So [Nick Bild] combined them expertly in his Pico Pong project, which includes gesture controls and a custom VGA output.
Rolling your own VGA signal is no simple feat, and this project takes full advantage of the Pico’s features to pull it off. Display data is buffered in memory, while a Programmable I/O (PIO) program reads straight from the buffer via Direct Memory Access (DMA) and writes straight to the display. This allows for nanosecond-precision while leaving the CPU free to handle inputs and run the game. Even with the display work offloaded, the ARM processor had to be massively overclocked at 258 MHz, well over its 133 MHz specs, to make things run smoothly. And still [Nick] found himself limited to a 640×350 resolution and serendipitously-retro-accurate monochrome color scheme.
Gesture controls come from a pair of IR light beams hooked up to the GPIO. IR LEDs shine up toward reflectors, and the light bounces back down to detectors. Blocking one of the beams causes your paddle to move up or down, which looks pretty responsive in the video (embedded below).
We’ve seen [Nick] play Pong before, though at that time it was handheld and based on the venerable 6502. And just recently we wrote about the Raspberry Pi Pico powering another classic game: Snake.
9 thoughts on “Pi Pico Project Plays Pong Perfectly”
Great project, I remember my first times when I tried to get something running with VGA with only a microcontroller.
“Rolling your own VGA signal is no simple feat” – While this holds true for using microcontrollers and already made hardware, it’s basically a joke when you have an FPGA at hand. Just recently needed VGA for my own project and implemented in VHDL while realizing how damn easy VGA hardware actually is.
Yes, I am in love with FPGA’s and i can’t lie.
The IR control is pretty cool tho. Love it!
You FPGA fanbois are beginning to seem a bit like Xilinx ad-bots.
I’m still really upset with the Raspberry Pi Foundation. Every Pi has been late to release in Japan and usually comes through scalpers at prices many times the retail price. When they finally arrive via an official distributor, they still jack the price up 10-20%. The Pico is actually made in Japan, and at launch could not be found for the MSRP. A few official distributors had it for the 10-20% premium, but not a single Japanese distributor (all accessed from the RPi website) had it for $4 despite all of the ads stating otherwise. And yes, I did account for currency conversion. Now they are completely unavailable in Japan unless you go through a scalper. Every official distributor is sold out. The Pi Zero still cannot be found in Japan for MSRP. I don’t want special consideration or favors. I want the same as everyone else in the world. I’ve got a few Pi products that I will use since I’ve paid so much for them, but I won’t be buying any more of their products until they sell them at global prices, and I will attempt to dissuade everyone I can from buying them as well.
Here they are offered when you buy a washing powder box. If shipping costs to/from JP were not so high,I´d have trade you some *pi for some old MSX hardware.
258mhz for pong? Must have wrote the crap in python. They did this shit in the 70s on like 0.3% of the compute power
That’s for the PIO to get the VGA timings right, and to be able to execute enough PIO assembly instructions per pixel clock. The CPU is hardly touched. The Pong algorithm is super light–VGA, not so much.
VGA32 using ESP32 is displaying VGA graphics without any hussle with overclocking.
The ESP32 does run at 240 MHz though…the Pico is 125 MHz by default.
Please be kind and respectful to help make the comments section excellent. (Comment Policy)