50-Year-Old Program Gets Speed Boost

At first glance, getting a computer program to run faster than the first electronic computers might seem trivial. After all, most of us carry enormously powerful processors in our pockets every day as if that’s normal. But [Mark] isn’t trying to beat computers like the ENIAC with a mobile ARM processor or other modern device. He’s now programming with the successor to the original Intel integrated circuit processor, the 4040, but beating the ENIAC is still little more complicated than you might think with a processor from 1974.

For this project, the goal was to best the 70-hour time set by ENIAC for computing the first 2035 digits of pi. There are a number of algorithms for performing this calculation, but using a 4-bit processor and an extremely limited memory of only 1280 bytes makes a number of these methods impossible, especially with the self-imposed time limit. The limited instruction set is a potential bottleneck as well with these early processors. [Mark] decided to use [Fabrice Bellard]’s algorithm given these limitations. He goes into great detail about the mathematics behind this method before coding it in JavaScript. Generating assembly language from a working JavaScript was found to be fairly straightforward.

[Mark] is also doing a lot of work on the 4040 to get this program running as well, including upgrades to the 40xx tool stack, the compiler and linker, and an emulator he’s using to test his program before sending it to physical hardware. The project is remarkably well-documented, including all of the optimizations needed to get these antique processors running fast enough to beat the ENIAC. We won’t spoil the results for you, but as a hint to how it worked out, he started this project using the 4040 since his original attempt using a 4004 wasn’t quite fast enough.

Solar Power Your Pi

Running a Raspberry Pi with solar power sounds easy. Of course, like most things, the details are what get you. About a year ago, [Bystroushaa] tried it without success. But the second time turned out to be the charm.

Of course, success is a relative term. It does work, but there is concern that it won’t be sufficient in the winter. In addition, if the battery dies, everything doesn’t restart automatically. Still, it is usable, and there should be ways to solve those problems.

The original attempt used a PiJuice hat and solar panel. This time, the design didn’t use these, opting instead for a LiFePO4 battery, a solar regulator, and a solar panel. The rest of it comes down to mechanical and physical mounting. The cheap regulator has some drawbacks. For example, it doesn’t allow for monitoring like more expensive units. It also cannot balance the cells periodically, although that could be done with an external controller.

We’ve seen solar-powered Pi boards before. Or, try a Game Boy.

The Printing Of Pi

It really isn’t necessary, but there is some geek cred to learning pi to some bizarre number of digits. One way to do that is via a piem — a mnemonic device that is easy to remember and gives you the digits. Don’t know any? [Roni Bandini] has you covered with the PiemPi machine. It prints a random piem on a thermal printer and calculates each digit on the fly. You can watch the machine in action in the video below.

Unfortunately, the Raspberry Pi Zero inside doesn’t have enough language skills to ensure the thing makes sense, so you get word salad that may or may not have any real meaning. For example, [Roni] quotes astronomer [Sir James Jeans’] phrase: “How I want a drink, alcoholic, of course, after the heavy lectures involving quantum mechanics.” Before the advent of calculators, we always used: “May I have a large container of coffee today?” In each case, you count the number of letters in each word to get the digits. However, some of the piems you can see from the machine start off with phrases like: “# leon a yahoo execution im actual total pit eagle detector christmas…”

Continue reading “The Printing Of Pi”

A Pi Calculating Pi For Pi Day

What is it about pi that we humans — at least some of us — find so endlessly fascinating? Maybe that’s just it — it’s endless, an eternal march of digits that tempts us with the thought that if we just calculate one more digit, something interesting will happen. Spoiler alert: it never does.

That doesn’t stop people from trying, of course, especially when “Pi Day” rolls around on March 14 every day  — with apologies to the DD/MM set, of course. This year, [Cristiano Monteiro] commemorated the day with this Pi-based eternal pi calculator. The heart of the build is a Raspberry Pi Pico board, which does double duty thanks to its two cores. One core is devoted to running the pi calculation routine, while the other takes care of updating the seven-segment LED display with the last eight calculated digits. Since the calculation takes increasingly more time the farther into pi it gets, [Cristiano] thoughtfully included a 1-Hz heartbeat indicator, to assure users that the display isn’t frozen; the video below shows how slow the display gets even just a few seconds after starting up, so it’s a welcome addition.

This is actually [Cristiano]’s second go at a Pi Day pi calculator; last year’s effort was a decidedly tactical breadboard build, and only supported a four-digit display. We applaud the upgrades, and if anyone wants to replicate the build, [Cristiano] has posted his code.

Continue reading “A Pi Calculating Pi For Pi Day”

Hackaday Links Column Banner

Hackaday Links: November 6, 2022

Remember the chip shortage? We sure do, mainly because as far as we can tell, it’s still going on, at least judging by the fact that you can’t get a Raspberry Pi for love or money. But that must just be noise, because according to a report in the Straits Times, the chip shortage is not only over, it’s reversed course enough that there’s now a glut of semiconductors out there. The article claims that the root cause of this is slowing demand for products like smartphones, an industry that’s seeing wave after wave of orders to semiconductor manufacturers like TSMC canceled. Chips for PCs are apparently in abundance now too, as the spasm of panic buying machine for remote working during the pandemic winds down. Automakers are still feeling the pinch, though, so much so that Toyota is now shipping only one smart key with new cars, instead of the usual two. So there seems to be some way to go before balance is restored to the market, but whatever — just call us when Amazon no longer has to offer financing on an 8 GB Pi.

Continue reading “Hackaday Links: November 6, 2022”

It’s Pi All The Way Down With This Pi-Powered Pi-Picking Robot

While most of us live in a world where the once ubiquitous Raspberry Pi is now as rare as hens’ teeth, there’s a magical place where they’ve got so many Pis that they needed to build a robotic dispenser to pick Pi orders. And to add insult to injury, they even built this magical machine using a Raspberry Pi. The horror.

This magical place? Australia, of course. There’s no date posted on the Pi Australia article linked above, but it does mention that there’s a Pi 4 Model B running the show, so that makes it at least recent-ish. Stock is stored in an array of tilted bins that a shuttle mechanism accesses via an X-Y gantry. The shuttle docks in front of a bin and uses a stepper-controlled finger to flip a box over the lip holding them in its bin. Once in the shuttle, the order is transported to an array of output bins, where a servo operates a flap to unceremoniously dump the product out for packing and shipping. There’s a video of a full cycle below, but a word of warning — the stepper motors on the X-Y gantry really scream, so you might want to lower the volume.

The article goes into more detail on not only the construction of “Bishop” — named after the heroic synthetic organism from Aliens — but also the challenges faced during construction. It turns out that even when you try to use gravity to simplify a system like this, things can go awry very easily. There’s also a fair bit of detail on the software, which surprisingly centers around LinuxCNC. And there are plans to take this further, with another bot to do the packing, sealing, and labeling of the order. If they need all that automation down there, we guess we found all the missing Pis.

Continue reading “It’s Pi All The Way Down With This Pi-Powered Pi-Picking Robot”

Calculating Pi On The 4004 CPU, Intel’s First Microprocessor

These days we are blessed with multicore 64-bit monster CPUs that can calculate an entire moon mission’s worth of instructions in the blink of an eye. Once upon a time, though, the state of the art was much less capable; Intel’s first microprocessor, the 4004, was built on a humble 4-bit architecture with limited instructions. [Mark] decided calculating pi on this platform would be a good challenge. 

It’s not the easiest thing to do; a 4-bit processor can’t easily store long numbers, and the 4004 doesn’t have any native floating point capability either. AND and XOR aren’t available, either, and there’s only 10,240 bits of RAM to play with. These limitations guided [Mark’s] choice of algorithm for calculating the only truly round number. Continue reading “Calculating Pi On The 4004 CPU, Intel’s First Microprocessor”