RPN Scientific and Programmer's Calculator

Intro: RPN Scientific and Programmer's Calculator

Scientific calculator based on an atmega328P.

Features :

A total of 8 key maps.

A mixture of both BigNumber and avr-libc functions.

Scientific and programmer's operations.

Stack based functionality with X,Y, Z & T registers.

Standard and scientific notation up to 14 digits.

Transfer Function computation in s/z domain.

User defined system settings.

Clock display.

Auto shutdown to less than 1uA for hw2

Based on an atmega328P, a 4x4 keypad and 8 7-seg. led displays powered by either a coin cell or 2 AAA rechargeable via USB batteries. There are a total of 8 key maps including programmer's mode. User defined system settings. Clock display. Scientific notation. Transfer Function computation in s and z domains.

visit my site for details: https://www.sites.google.com/site/demeterart/

The calculator is based on an atmega328P (at 4MHz) and uses all available pins,16 for the 8-digit led display and 4 analog pins one for each of the four columns of the 4x4 keypad. The display consists of two SMA420364 which are 4-digit 7- segment common cathode led devices. The preferred color should be red for low voltage operation - 2 volts minimum. The power supply can be either external from a USB female type-B connector or internal from 2 AAA batteries. If the batteries are installed then they must be rechargeable for concurrent use with USB power. The voltage available to the circuit, common rail Vcc, varies from 2 to 3 volts while the controller will function down to 1.8 volts (@4MHz) with a very dim light for red leds.

Current consumption, for hw version 1, at Vcc=3 volts@4MHz varies from 6mA to 10mA for a 25% display duty cycle as the number of lit digits varies from 0 to 8. A 100% duty cycle raises the max. current to 19mA. In power down mode the current drops to less than 30uA. Of course, you can always choose to turn off the battery switch.

Current consumption, for hw version 2 with BOD off, at Vcc=2.5 volts@4MHz varies from about 2mA to 5.5mA for a 50% display duty cycle as the number of lit digits varies from 0 to 8. Using a CR2032 cell (220mAh for light loads and 150mAh for heavy loads) the unit should function for about 30 hours continuously with all segments lit. In power down mode the current drops to less than 1uA.

The external arduino libraries used are the BigNumber (arbitrary precision) by Nick Gammon and TimerOne by Jesse Tane. The led display is treated like an 8x8 led matrix. The handler for timer1 switches on and off each successive column/digit depending on the bit pattern written into the internal ledmap array. The internal ‘dutycycle’ determines the brightness of the leds which the user specifies as a percentage. The fonts array in flash holds the ASCII bitmap in (LSB to MSB from left to right). While the characters/bits are written to ledmap interrupts are disabled. The keypad is sampled consecutively from channel A0 (leftmost column to pin D14) to A3 (rightmost column to pin D17) and compared to a matrix of analog readings. The 10bit readings are, largely, independent of the power supply and thus operation is fairly reliable over its range.

User operation is both key-driven and command-initiated. The floating point
library used is a combination of both BigNumber.h (Nick Gammon) and math.h (avr-libc) and for printing out the results both scientific notation and standard format are supported.

Step 1: SCHEMATIC

FLASH PROGRAMMING

The controller is programmed via an arduino loaded with the ISP sketch using the SPI port or a dedicated AVR programmer. The avrdude burner must be used with the fuses set to 0xFD for the low byte, 0xD1 for the high byte and 0xFE for the extended byte.

The command line switches (fill in your own path names) should look like this:

avrdude -C -v -p -c -P -b -Uflash:w: :i -U lfuse:w:0xFD:m -U hfuse:w:0xD1:m -U efuse:w:0xFE:m

The boards.txt file has the following contents:

atmega328b4.name=ATmega328 on a breadboard (4MHz) atmega328b4.upload.protocol=arduino atmega328b4.upload.maximum_size=32768 atmega328b4.upload.speed=9600 atmega328b4.bootloader.low_fuses=0xFD atmega328b4.bootloader.high_fuses=0xD1 atmega328b4.bootloader.extended_fuses=0xFE atmega328b4.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex atmega328b4.bootloader.unlock_bits=0x3F atmega328b4.bootloader.lock_bits=0x0F atmega328b4.build.mcu=atmega328p atmega328b4.build.f_cpu=4000000L atmega328b4.build.core=arduino:arduino atmega328b4.build.variant=arduino:standard atmega328b4.bootloader.tool=arduino:avrdude atmega328b4.upload.tool=arduino:avrdude

In case you need the bootloader it is the same as that of the ‘arduino on board’ from the arduino forum but you will need to use a different XTAL and oscillation frequency (only 8MHz and 1MHz - divide by 8 - are supported). I don’t use it as I prefer the programmer for this custom case. You may use the standard 16MHz XTAL and the arduino optiboot bootloader to easily transfer the firmware and forget all about the details above but it will take much more battery current and the minimum supply voltage will need to be much higher for reliable operation.

Step 2: CODE & DOCUMENTATION

Visit my site at

https://www.sites.google.com/site/demeterart/

to download the latest associated PDF file and the archive with the source code and hex files.

Below are the document and archive for ver 4.2

Share

    Recommendations

    • Tiny Home Contest

      Tiny Home Contest
    • Metalworking Contest

      Metalworking Contest
    • Fix It! Contest

      Fix It! Contest

    Discussions