Skip to content

v-p-b/hexcalc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calculator with Hexadecimal Numpad

HP-16C for hackers, who don't mind wasting CPU cycles and RAM for comfort.

hexcalc front

Parts

  • NeoKey 5x6 Ortho Snap-Apart Mechanical Key Switches - Finally a PCB with enough (but not too many) buttons!
  • Black Adafruit Feather RP2040 - Less powerful boards will probably do the basic functionality but I wanted to make sure my OLED is nice
  • Adafruit 128x64 OLED FeatherWing
  • 20x MX compatible keyswitches and caps
  • Screws: M2.5 for the FeatherWing, M3 for the keypad
  • Incremental encoder with push button
  • Male and female pin headers to connect the Feather with the display. Careful when following tutorials advising the use of breadboards for soldering: my breadboard didn't exactly match the distance of pin lines, making the headers tilt!

Inspired by

  • Adafruit Macropad RP2040 - It took me a long time to realize, that these kinds of things are called "macropads" - a keyword that made googling for parts much easier!
  • Numpad 4000 - A great project, but decimal is BORING!

Wiring

The RP2040 Feather has 21 GPIO pins, I use 16:

  • 9 for the keyboard (4x5)
  • 2 for the display I2C
  • 3 for the display buttons, 1 is in active use for the encoder switch
  • 2 for the encoder

hexcalc back

The box

I cut out the base from 2mm plexi sheets (polystyrol, sold as "hobbyglas" - a perfect name for a product, that is not actually made of glass...), because they were the only fitting plastic material I could find available. It's transparent, which I think is pretty cool for this project.

Cutting the sheets is relatively easy using a razor tool, then snapping it.

The surface is really slippery, so be careful when measuring!

For drilling I used a 3mm masonry drill head in an electric screwdriver set on a relatively slow speed. This way I could avoid cracks, but had to pause multiple times to let the plastic resolidify and clean the head. I fixed multiple imprefect drills with a 4mm head.

Keys

I used an acrylic pen to draw signs on black plastic.

Software

The basic idea is to have a reprogrammable numpad, and feed any input to Python's eval() to get results. This way basic and boolean arithmethic in multiple number systems are available out of the box.

Number format

  • [0-9A-F]+ - Hexadecimal (default)
  • 0D[0-9]+ - Decimal
  • 0B[01]+ - Binary
  • 0C[0-7]+ - Octal (sry, we don't have an 'o')

Modes

These can be set using the encoder.

  • FORTUNE: This is the basic mode. Can add and subtract.
  • MULTI: + -> * and - -> / (division untested, pbbly will break things)
  • AND: + -> & and - -> |
  • XOR: Both + and - become ^
  • SHIFT: + -> << and - -> >>
  • DEC: Convert the currently displayed number to decimal (according to notation)
  • BIN: Convert the currently displayed number to binary (according to notation)
  • TWOS: Two's complement, because signed bytes in Java suck. This takes the currently displayed number as 8-bit_decimal and displays two's complement in hexadecimal!

Challenge

I'm willing to offer a bottle of fine booze to anyone (original idea required) who demonstrates arbitrary Python code execution using the implemented functionality and the 20 available buttons!

Planned developments

  • A proper box

About

DIY calculator with a hexadecimal keypad

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages