Makerspaces

Makerspaces

Friday, April 22, 2016

Enrique's Calculator

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32 
Type "copyright", "credits" or "license()" for more information.
>>> raspberryPiCalculator()
This is a Calculator made with Raspberry Pi
This is a Calculator made with Raspberry Pi
This is a Calculator made with Raspberry Pi
This is a Calculator made with Raspberry Pi
This is a Calculator made with Raspberry Pi
This is a Calculator made with Raspberry Pi

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    raspberryPiCalculator() 
CalculatorError: We get it...
_________________________________________________

Recently I made a calculator with a raspberry pi. I was inspired by a calculator that someone had made with a raspberry pi: https://www.youtube.com/watch?v=YfIQ7ktFM1g.

>>> backwardsReflection(what, how)

My goal was to make a functioning calculator that could perform basic arithmetic. I was confident that I could do this, because I had experience with breadboards from my work with Arduino (My reflection on that...). There were many small projects within this project, for example, it required knowledge of programming, bread-boarding, basic knowledge of Linux based OSs, and the proper use of Raspberry Pi GPIO Pins.

>>> for i in Steps:
        print(Steps[i])

Step 1: Set up Raspberry Pi (Raspbian Jessie)
Step 2: Set up Rpi.GPIO Python Module
Step 3: Code Calculator (Python)
Step 4: Set up buttons (code and hardware)
Step 5: Set up display (code and hardware)
Step 6: combine everything
Step 7: Run program on boot
Step 8: Make frame

My strategy for this was to make as many prototypes as possible. I made 3 prototypes for the basic calculator code, 1 prototype for the buttons, 1 prototype for buttuns plus the calculator code, tried 2 different modules to handle the display, and a final prototype which incorporated everything. My materials were 1 Raspberry Pi, 5 breadboard buttons, 3 breadboards, 1 LCD display, many jumper cables, and whatever I could find to make the frame.

>>> selfReflection(theWork, Me)

The assignment turned out to be different from what I imagined. It took me longer than expected. My original goal was to replicate the disco calculator, but I ended up loosing motivation for the sound part, and decided that the calculator itself is an achievement itself. I judged the final product by the calculator on the video, and when I finished, I decided that this was probably the closest I would get with the materials available.

I think this work shows how I like programming and how I am able to research and solve issues. My biggest Issue was the fact I did not have a proper breadboard number pad, so I ended up using a keyboard number pad instead. In contrast, my former partner wanted to use a transistor ("Knob as he calls it) to set the numbers. I decided not to do that because it had all the bad aspects of a keyboard (CLI and not real-time, which means that you have to press enter before pressing an operation, unlike normal calculators) without the benefit of a familiar interface.

>>> forwardsReflection(change)

If I was to change something from my project it would be to optimize my code. I now realize how many common immature programmer mistakes I made, suck as complete misuse for functions (global variables EVERYWHERE) and making the code very confusing. I would approach this project differently by coding it differently. I would improve the interface by adding a real breadboard-number pad, to make it easier to use (also it is really heavy, but i think that gives it some aesthetic).





No comments:

Post a Comment