You can't calculate binary values "as is" on most handheld calculators and using the windows one is just a pain, so i decided to make my very own (binary only) calculator. This calculator supports all the basic functions like : NOT,OR,AND,XOR, addition,subtraction,multiplication,division and modulo.
So join me as we are going to enter the world of ones and zeros and play with some LEDs and switches along the way!
The parts for the calculator:
How to Control 16 inputs and 32 outouts?
The first trick is multiplexing the the LEDs and arranging it in a matrix form, we connect the LEDs in a grid of 8×4 so now we need 12 outputs and not 32 but thats still a lot and we will need to find a way to get that number smaller. So I used a 74HC595 shift register which needs only 3 pins from the micro and gives you 8 outputs, the 74HC595 controls the columns and the micro scans the rows with the help of 4 transistors, and now we can control 32 LEDs with only 7 pins.
The second trick is to multiplex the switches as well and arrange them in a 4×4 matrix, and now we only need 8 pins to read the switches and not 16.
All the logic operations are being made in software so if you know your C you could use any micro-controller with 15 I/Os or more and adapt my code to work with it.
The two tricky parts in this project is soldering the LEDs and the switches and thats because the connect in a matrix formation.
Soldering the LEDs are a lot easier and the way you need to do this is to bend the positive lead of the LED down towards the other ones and make a column, and snip off the leads you didn't use and make the connections as low as you can get, and you do this to all of the positive leads.
The switches gives the biggest headache because they aren't soldered in a grid and thats makes it hard to connect them in a matrix form.I used a method called wire wrapping which uses a very thin isolate wire to connect points on the board. I have also added a wiring digram of the switches.
The controller circuit is simple and every one chooses how to make it so the only words of advise I will give is to bolt down the voltage regulator to the board to protect it from vibration and shock that can cause it to fall off, make a little hole in the board for the battery wire and by so creating a strain relief and the last thing is to add some pin headers for programming the micro unless you want to take out the micro every time you wish to program it.
It's Programing Time
People who know C can easily adapt my code to make it run on the arduino or other platforms it's just a matter of changing the output and input commands. The code is fully documented so you can understand what each line does.
I used the USBasp to program my micro but you can use any program you like or have at home.
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw