# Arduino Calculator

58,018

154

21

Posted

## Introduction: Arduino Calculator

In this Instructable I will show you how to make an Arduino calculator that is just as good as any other calculator (well... sort of). Even though it's probably not practical due to it's size, repetitive use of the equals button (due to the lack of keys), and cost (You can probably buy a calculator that does the same thing for \$2), It is really fun and adds a few skills to your inventory. Let me tell you how I got started on this project. It all starts at school where the original calculator was made by my friend/teacher Gabe. If your curious how the old version looked click here. Soon enough students began to play with it and soon broke it. I was the only student who knew how to fix it so I decided I might as well try. In the process I basically took the whole thing apart and started from scratch. I also rewrote most of the code. I learned alot, spent lots of time debugging, and added many new features. In the end it was a project definitely worth doing. The good thing is that now that I figured it out you don't have to. Let's get started.

## Step 1: Tools and Materials

For this project we will need:

- 1/8" MDF or other laser cuttable material such as acrylic or plywood
-Laser cutter (optional but recommended)
-Wood glue
-Male to male wires
-Many male to female wires
-8 by 2 LCD screen
-Drill
-Drill bits
-Disc grinder (optional)
-Switch (rocker or toggle)
-Heat shrink tubing
-Soldering iron and solder
-Screws
-USB A to B cable (cable differs between arduino models)
-Computer with arduino IDE

-Arduino (I used a duemilanove if you don't want to spend \$30 on one search it on ebay)

## Step 2: Making the Case

My case was laser cut (I will attach files below in PDF format) from 1/4" MDF but that's because I couldn't find any 1/8" material. The calculator edges look weird because I used the wrong thickness of material. You may be wondering why the box fits together perfectly in the picture above and that's because that box is a completely different cutting designed for 1/4" material. The box doesn't include holes for the LCD or keypad due to variety. That's where the drill comes in. Let me just clear this up one last time USE 1/8 INCH THICK MATERIAL.

## Step 3: Drilling and Further Assembly

Lay down the keypad and LCD screen where you want them and use a pencils to mark where the holes are. Find a drill bit that fits the correct size and make the hole. Before screwing in the keypad or LCD holes must be made for the wires to the arduino. To do this you an either modify the laser cut or drill a few holes in a row with a wide enough drill bit and then act like a manual CNC machine pushing the drill sideways toward the other holes until you connect them by routing through. Once this is done connect the wires and to the components and screw the LCD and Keypad into place. Now use the wood glue to glue all of the cut pieces together, you might want to leave the top open for maintenance (trust me don't glue on the top until you are done). If you want to you can use a disc grinder to sand down the edges. You might notice in my laser cut I added an access hatch on the back to make the calculator accessible if broken (Got that idea so I wouldn't have to start over again if the calculator broke).

## Step 4: Hatch Support

So now we have to create 3 square brackets (fourth can't be mounted due to on/off switch) to hold the hatch in place. To make ours just cut a 2 by 4 with a hack saw into small triangles. If they are too small, they will split but if they are too big they take up lots of room. Use your best judgement. Once done, drill holes into the sides to create guide holes for the screw. Align the triangles so that they fit into the corners with one side ready to be screwed into the side of the case and one side facing toward the back of the case. Add the back plate and screw through it into the DIY brackets. Once done remove the hatch so we can access the arduino and add code.

## Step 5: Power

On the side of the case I have a hole where the 9v battery and switch are accessible. Cut the positive side of the 9v power plug with wire strippers and strip off the ends. Solder one side of the the wire to the left pin on the switch, and the other to the center pin on the switch. Wrap with heat shrink tubing then plug the 9v clip into the battery and the plug into the arduino. Look for short circuits, then test the switch. Screw the switch into place. If needed, add guide holes to direct the screw. If you want to label the on and off sides off the switch you can use a label maker or hand write it. Finally, I screwed a small scrap piece of plywood to the back of the case to make sure the battery stayed in place. Don't worry about of the rest of the wiring yet, we are going to cover that in the next step.

## Step 6: Wiring

Before I start this step let me apologize for the wiring mess (that's why I included a table). As you can see in the photos above there will be lots of wires floating all over the place. I highly recommend you use a label maker or a piece of tape to mark the pin each wire is supposed to attach to. Most of the wires I used were male to female but I did use some male to male wires for power which you will read about below. If you have a different LCD screen or Keypad it doesn't matter as long as the code is changed accordingly and the arduino has enough spare wires. Here are links to the datasheets of the components I used LCD, Keypad.

In an attempt to preserve the longevity of the calculator I glued all of the wires to the arduino once attached and glued the arduino to the case. If you look closely at the photos you can see I had to use some protoboard to hook all of the 5v connections together and all of the Ground connections together. Basically this is just a few wires soldered to a protoboard and solder bridged together. Note: One half of the board for ground connections and one half for 5v connections.

## Step 7: Code

The code can be found somewhere in this step as both a zip file and ino file. It is about 480 lines long but it is all simple code for the most part. A few special features of the code is that it will create an error if a number is divided by 0, It calculates trigonometry functions in degrees rather than radians, After the equation is completed any key can be pressed to clear, A number can be made negative easily, and decimals are handled well. If you get the zip, extract it then open the file in the arduino IDE. If you downloaded the ino, open it with the arduino IDE and it will ask you if you want to create a folder for it just say yes and it should work. Once you have it opened, choose your board, plug the board in, and upload the sketch.

## Step 8: How to Use

Due to the fact that the the calculator only has a few keys that aren't numbers, I devised a system to utilize the few keys I had available to allow the calculator to function normally. First I am going to explain in words how it works then I will pretend to do a problem and write down all of the keys I pressed in order.

(1) Select a number on the keypad (2) use A and B to scroll to the function you want (3) once on the function you want hit D or = (4) What you have so far should jump to the top line, now select your second number (5) Hit D or =(6) The equation should move to the top line leaving your answer on the second line

Example: 2 A A (hitting a twice will scroll to -) D 1 D (Done)

## Recommendations

• ### Arduino Class

67,947 Enrolled

• ### Trash to Treasure

We have a be nice policy.

## Questions

Can any of you specify which arduino deumilanov micro controller you used or add a link so tht i can look it up on ebay

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

program _

_!

Nice work. Thank you for this interesting idea.

Lo seee

amazing

Can you teach me how to make when push button A, then the LCD will show the prices. then the prices will decrease after we insert coin using coin slot. please help me

What screen did you use???