You Are Here: Home » AVR ATmega Projects » LED Binary Calculator using Microcontroller ATtiny2313

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?

Control 16 inputs

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

This free embedded project also found using:

  • attiny2313 programmer
  • calculator using AVR at mega 16 video
  • led binary calculator
  • Microcontroller Calculator

About The Author

Number of Entries : 6710

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Debugging AVR code in Linux with simavr using Microcontroller ATTiny85

I recently started programming AVR chips, namely the ATTiny85.  They can be programmed using C, compilers are readily available in...

Close
Scroll to top