Now a product! http://www.rubydevices.com.au/productSelect/RubyCalculator
Completing a Masters Degree in Electrical Engineering took a little hard work. It was a long five year road that I thoroughly enjoyed. At the end of 2015 I graduated university and had a 3 month holiday ahead of me. What better way to spend it than a little Engineering R&D! Let's make a Text Messaging Calculator!
Step 1: Choose an Existing Scientific Calculator
This step is pretty much mandatory.
It is very unlikely one could find a company to mold them a couple of calculator cases and buttons for a cheap price.
Now its just a matter of ripping out the insides and putting our own circuitry into it.
Step 2: Component Selection
The three most crucial components for the project are the LCD, MCU and Bluetooth Module.
For the LCD I used the "162COG-BA-BC" by Displaytech. The LCD needs to be super thin to fit in the calculator case and this LCD satisfied that requirement. Additional, it is a reflective LCD and will thus not consume a large amount of current. Finally, this LCD uses a controller compatible to the familiar Hitachi HD44780 and will make programming a breeze with the great abundance of online documentation.
For the MCU a large number of general purpose I/O pins are necessary to accommodate for the number of scientific calculator buttons. A decent amount of flash memory and a UART interface for the Bluetooth Module are also required.
For the Bluetooth Module the necessary requirement is that the module can act as both a master and a slave. That is, not only can other devices connect to the module but the module is able to scan for other bluetooth devices and initialize connections itself. Without this capability, calculators would not be able to connect to each other and would only be able to accept connection requests from smarter devices like smart phones.
Step 3: Power Circuitry Design
Looking through the datasheets tells us we are going to need two voltage rails. We will need a 3.3 V rail for the Bluetooth Module and a 5.0 V rail for the LCD.
We have a 3.0 V supply from the two alkaline batteries which are in series. To get the required voltages we will use a Boost Converter and a Low Dropout Regulator (LDO). The output voltage of the Boost Converter is dictated by the resistor ratio of R3 and R4 in the diagram. The Boost Converter will step the voltage up from 3.0 V to 5.0 V with the indicated values.
We may then use the 5.0 V rail to create a 3.3 V rail with the help of an LDO. Just make sure you chuck on some decent sized SMD capacitors on the inputs and outputs of these regulators as they are critical to successful operation.
Finally, we throw in a Flip-Flop for some smart switching which we will use with the on and off buttons native to the calculator case.
Step 4: Control Circuitry Design
The schematic for the control circuitry is relatively straightforward.
We use the ATmega's JTAG for debugging the device.
We connect the Bluetooth Module to one of the MCUs UART interfaces throwing in some safety resistors to ensure we may never see a voltage greater than 3.3 V on the Bluetooth module. The resistor divider is necessary as the MCU is running from the 5 V rail (the MCU could not be run from the 3.3 V rail due to 3.3 V being insufficient for the LCD logic high).
The LCD connects straight up with general purpose I/Os on the MCU. A voltage divider is used for the contrast pin. Alternatively, a potentiometer could be used here. I, however like the robustness of a static product that comes with separate resistors to adjust the contrast.
Add in some decoupling capacitors, a 16 MHz crystal for the MCU, pull up resistors for the buttons and the schematic design is done.
Step 5: PCB Design
For the PCB design I used Altium Designer. The most important and tricky part of the PCB design was in the measurement of the physical dimensions of the calculator. Not only does the board have to have the perfect width and height to fit well into the calculator case but a number of other physical dimensions are required to be met. The LCD holes need to have the right position up the PCB to align well with the window in the case. The PCB will need several holes for where the screws go through from the back of the case to the front of the case. Finally, the PCB will need to have pads for the buttons which align well.
The pad design for the buttons uses a standard interleaved shape to ensure high reliability when the conductive button mat is pressed down.
Be sure to cut the copper out from the PCB using a "Keep Out Area" around the antenna of the Bluetooth Module to ensure there is no compromise in signal connectivity. My manufacturer unexpectedly decided to cut the entire board out where I had marked but luckily this didn't cause any problems for me.
Step 6: Code Away
I used AVR Studio with an old JTAG ICE debugger to do all my coding. My code was by no means elegantly written but it all worked fine in the end. I ended up using 64Kbytes of the 128Kbytes of flash memory available.
The Bluetooth Module really is quite powerful. I managed to give my device the ability to connect to other calculators, iPhones and Androids.
The requirements for coding are a knowledge of Hitachi LCD controllers, basic AVR programming skills and an understanding of how to interact with a peripheral through AT commands and UART.
Thanks heaps for reading!