LED Binary Calculator using Microcontroller ATtiny2313

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!

Parts List

Like any electronics project you will need to get some basic tools  like:
a soldering iron, some solder wire, a cutter, a needle nosed plier,some wire, wire striper, and some desoldering tools fro fixing mistakes along the way.
The parts for the calculator:
1. 32 LEDs.
2. 8 resistors( The value is determent by the type of LEDs, in my case 91 ohm).
3. 74HC595 shift register.
4. 9 1KOhm resistors.
5. 4 2n4401 transistors.
6. A Perfboard.
7. ATtiny2313.
8. 16 tact switches with 4 pins.
9. some pin headers.
10. A programmer for the micro.
11. 9V battery holder.
12.A slide switch.
13. 7805 voltage regulator
14. 100nF cap
15. 10uF cap

How to Control 16 inputs and 32 outputs?

LED Binary Calculator using Microcontroller ATtiny2313
I had an ATtiny2313 micro in my parts bin and I wanted to use it for something, the thing is that it only has 17 outputs minus 2 if you use a crystal, and to control so many outputs and inputs I had to use some tricks to get around using just 15.
The first trick is multiplexing the the LEDs and arranging it in a matrix form, we connect the LEDs in a grid of 8X4 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 4X4 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.

Schematics

As always the only thing I left out in the schematics are the resistor values which limit the current to the LEDs, this is a thing every one does by himself.
You can use a special site to calculate the resistor value like this one . Or do it yourself with the help of a simple equation (Vin-Vled)/(Iled).
I recommend downloading the original file with the schematics to see them clearer.
For more Detail: LED Binary Calculator using Microcontroller ATtiny2313


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top