Introduction: Exam Cheating Bluetooth Calculator
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. As anyone who has tackled a Masters degree would know, however, it had its frustrating moments.
And what is it that us builders do when we face a hardship in life? We try to create a bridge to cross the river of frustration and look back on the hurdle with satisfaction.
That was how the idea of the Bluetooth scientific calculator began. What if I could chat to my class mates during exams? We could split the coursework and share our answers with each other, eliminating countless hours of revision. Yes, I agree, this wouldn't have been the wisest choice for my future. Funnily enough though, I was never able to build this dream calculator during my university years as I was consistently overloaded with imminent projects and exams.
At the end of 2015, however, I graduated university and had a 3 month holiday ahead of me before entering the workforce. With my government allowance now cut and only a morsel of money saved I realized that a holiday was off the table. I realized that I might as well build the calculator in hopes that I may one day save some students somewhere out there from the harsh reality of hard work. Let us begin.
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.
Perhaps for the case and buttons one could potentially 3D print them?
Anyway, I opted to buy the super cheap "Joinus JS-82MS-A". The most attractive thing about it other than the price was that it uses two AAA Alkaline batteries. This means I won't be running into problems with a mid-range current demand that I might have otherwise ran into with coin cells.
The calculator is for sale all over the internet. 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. I chose to use the ATmega128A which has a massive 128 Kbytes of flash memory and 53 programmable I/Os.
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. This requirement is met by the popular HM-10 module from Huamao. It is important to note here that HM-10 clones are not sufficient for this project unless they have the "Device Discovery" ability. I, personally, made the mistake of purchasing a clone during initial testing and was astounded at how sneaky sellers are with their ebay ads in their attempts to make the product look like a HM-10 module. Although, by all means if you find a cheap clone that can work successfully in master mode feel free to use it.
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.
If you have any questions related to the coding feel free to email me at firstname.lastname@example.org and I'd be more than happy to help.
Thanks heaps for reading!
Here is a link for any students out there who want to ruin their future by not doing any work: (seriously though, cheating your way through school won't get you a long term job when you finish so use in moderation! I called the device the "Ruby Calculator".)