Introduction: PiBot: Calculating Pi With an Arduino Uno
Introducing the PiBot, a pretty poor alternative to looking up the value of Pi on the internet. He leaves all the competition in his wake as he calculates Pi slower than his old friend Colossus of Bletchley Park fame, that rubbish robot from Battlestar Galactica and any modern calculator.
PiBot has arrived to celebrate Pi day in true PiBot fashion, he is going to calculate Pi to a shameful degree of accuracy. I realise he is a bit late to Pi day, he is only running at 16MHz so please give him a break.
If you would like to own your own PiBot! Or even to create one that doesn't look mildly rubbish, please follow along.
Step 1: Parts, Materials and Tools
So to craft this masterpiece of engineering you are going to need some electronics parts, materials and some tools.
If you are using just the breadboard then all you will need is a computer with the Aduino IDE installed, otherwise you will want a soldering iron to make a little button breakout. But we won't cover that here.
- Stanley/X-Acto Knife
- Glue of some description, I went for the 'super' kind
- Sellotape, you will definitely need this if you find things don't quite fit, as I always do
- Something to stop you carving up your desk with a knife
Materials and Parts
You don't need all the parts listed, in fact your Arduino can just print out Pi to your serial monitor, but if you want it to be the coolest 'not really a robot' robot on the street, read on.
- An Arduino Uno or similar micro controller
- 8x8 LED Matrix display
- 16x2 LCD Dislplay with an I2C backpack
- A momentary switch
- A breadboard
- A bunch of wires, male to female and male to male
- A 10K resistor
- A 100nf capacitor
Step 2: Crafting the Perfect Machine
Now you could go all out and make your creation look amazing. Or, and I must remind you that there could be beer in the fridge or Xbox to play, you could create a poorly fitting box out of cardboard to ram all of your parts into.
If you go the beer and Xbox route then follow me.
- Measure your parts, this is important as doing it by eye turns out to be a mistake
- Clear an area on your work surface an put something down to cut on or beer and Xbox privileges could be removed
- Hastily sketch out a sort of box net, be sure to mess up the measurements just enough so that you can use the sellotape later to fix everything
- Now cut cut away with your knife until you feel like your arm is going to drop off, then cut some more because you knife is likely a bit blunt
You should now have a rough-round-the-edges bit of cardboard and inside you will be wishing someone would create a cheap home 3d printer that is actually cheap and not just a bit cheaper than a car.
Score and fold along the right edges, use the ruler or your fingers will not be up to Xbox and beer later on.
Carefully and I mean carefully, place your components into your crude box, otherwise your majestic creation might fall to pieces. Sellotape comes in very handy here if you are ham fisted like me.
Step 3: Crafting the Machine/Wiring It Up
Now this is the bit that will likely go the easiest, plug wires into the parts and into the breadboard. Here is a lovely picture of how it should be hooked up.
Do this without power connected first!
Step 4: Upload Your Code
Step 5: Let the Fun Begin
I am sure you, like me, can spend hours and hours having your robot calculate Pi, dismissing friends, the opportunity to drink beer and roaming the expanding wastes of civilisation. It truly is a sight to behold, the pinnacle of human achievement neatly packaged in a rough-edged plain box, desperately trying to achieve the impossible.
It is a really cool little toy, that is pretty cute really. All the while demonstrating a method of estimating the value of a really important mathematical constant, Pi.
Take a look at the video here - https://www.youtube.com/watch?v=SzUSn_gO8tI
Have fun everyone, happy Pi day.
We have a be nice policy.
Please be positive and constructive.