HP Forums
RPN-duino - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: RPN-duino (/thread-4956.html)

Pages: 1 2 3 4


RE: RPN-duino - Chasfield - 10-01-2016 01:18 PM

The instability problem is now resolved.

I added a couple of lines to my code that would report free RAM when shift and enter were pressed together on the Texas RPN-duino. It was clear that a major heap crunch was going on whenever trig. functions were invoked from the keyboard. I had based sine, cosine and tangent on an example sine routine that comes with the Arduino BigNumber library:


Code:

// calculate sine of x with 'precision' iterations
BigNumber sine (const BigNumber x, BigNumber precision)
{
  BigNumber val = 1;
  const BigNumber one = 1, two = 2;
  while (precision > 0)
  {
    val = one - val * x * x / (two * precision) / (two * precision + one);
    precision--;
  }
  val = x * val;
  return val;
} // end of function sine


I never work out quite how it delivered sine but went ahead and used it anyway. It looks harmless enough and certainly converges rapidly on the right answer. Also, it doesn't seem to have any of that disappear-up-your-own-tail-pipe recursion that some programmers love to use, and which I can never get my head around. However, it seems to be very hard on heap memory when called. I replaced it with a brutishly direct implementation of the Maclaurin series to 12 terms and the stability problem disappeared. The calculator is now running happily on a luxurious 25 digits of BigNumber.


RE: RPN-duino - Luigi Vampa - 10-01-2016 03:20 PM

An excellent example of creative problem-solving!
BTW, just the sine function needed to be reworked? What about the rest of its siblings?


RE: RPN-duino - Chasfield - 10-01-2016 03:31 PM

The other trig. functions just derived from sine using trivial identities like cos = (1 - sin^2)^0.5 and tan = sin/cos, so once sine was fixed the others all worked properly.

I have had to crank back BigNumber to 23 sig. figs. for stability sufficient to run the calculator forensic. That displays 8.99999999, so I am getting there.


RE: RPN-duino - Chasfield - 10-01-2016 05:39 PM

I decided that it was nuts to define a space character font in the OLED display driver routine posted earlier when the Arduino just needs to fire out a few 0x00 bytes when required. Also, I can live without an exclamation mark character in in the error display routine. This trimming of the display font set liberated 32 bytes of RAM on the Nano, which allows BigNumber to run at 26 sig. figs. without a hiccup. This in turn allows another term in the Maclaurin series for sine.

A torture test calculation of Tan(355/266) now gives -7497258.19.

which is right on the money for a pocket device:

http://www.voidware.com/calcs/torture_trigs.htm


RE: RPN-duino - Luigi Vampa - 10-01-2016 06:38 PM

$5.39 for the display
$2.39 for the Arduino Nano
$2.28 for 2 x 12 button keypad ($1.14 ea.)
---------
$10.06 RPN calc :^O "How low can you go!"

Assumptions:
- Parts are sourced from AliExpress (free shipping included:)
- The enclosure is already available (savaged:)


RE: RPN-duino - Chasfield - 10-01-2016 07:00 PM

What size is that display? If it is 1.3 inch that is a good price.


RE: RPN-duino - Luigi Vampa - 10-02-2016 09:14 AM

... yes, you can find it in AliExpress, it has got 1.3".


RE: RPN-duino - Luigi Vampa - 10-02-2016 12:43 PM

...this is the link to the $5.39 display


RE: RPN-duino - Chasfield - 10-02-2016 01:54 PM

That looks just right. It has the simple two-wire I2C connection so will only take up A4 and A5 on the Nano for SDA and SCL. Add in lines to the Nano's 3.3 volt pin and spare ground pin and you are good to go.

The listing seems to indicate 5V logic tolerance. My three OLED displays seem happy with 5V logic. For two of them this was explicitly specified on the manufacturer's web site. The other hasn't cracked up yet.


RE: RPN-duino - Chasfield - 10-16-2016 03:41 PM

I decided that I would have a shot at building a functional clone of an HP35. A four-line OLED display, coupled with the clean-sheet ergonomic design of HP's original machine, looked like a route to building something that would be nice to pick up and use.

Making a satisfactory keyboard is the hard part. I ordered up 50, 12x12 mm tactile PCB switches of a type which feature a 6 mm deep extended actuator. I took the best 36 of these to populate the keyboard and made doubly sure that they all fired at the click before I committed them to epoxy cement. The result is, I reckon, aesthetically satisfactory and it is ok to use if you were able to get along with a TI59 back in the day.

The attached pictures show the calculator's construction method and soldering nightmare.

Right now, the OLED display is held up at the docks but I have plenty more coachwork tasks to complete and a battery compartment to construct.

Despite the way it looks in the last picture, I would say that 85 percent of the job is done, given the 15-20 hours spent getting a labelled keyboard up and running on a serial console test script.


RE: RPN-duino - Luigi Vampa - 10-16-2016 07:49 PM

(10-16-2016 03:41 PM)Chasfield Wrote:  The result is, I reckon, aesthetically satisfactory
... well beyond that, not only aesthetically satisfactory, but also very carefully crafted. IMHO you have done another fantastic DIY job.
Chasfield, may I know which version of Arduino you are leaning on for this project?


RE: RPN-duino - Chasfield - 10-17-2016 05:31 AM

This one uses a 5 dollar Nano clone, mounted under the keyboard, so that it doesn't steal battery space at the thick end of the case.


RE: RPN-duino - Chasfield - 10-27-2016 02:13 PM

The HP35 clone calculator is complete. I am very happy with the overall look and heft of it but I can only give the keyboard 7/10 for feel. However, the one function per key operation and four line display compensate to give decent usability overall.

I finished the key tops off with some spray varnish which, despite drying glass hard when tested on a piece of scrap plastic, demonstrated very poor adhesion on the key tops themselves, so a bit more work is required there.


RE: RPN-duino - Luigi Vampa - 10-27-2016 08:27 PM

Gorgeous!
As per the varnish, maybe you might find this thread useful.


RE: RPN-duino - Chasfield - 10-28-2016 01:20 PM

Thank you for the tip. I will look out for that product.


RE: RPN-duino - Chasfield - 03-25-2017 03:02 PM

I have turned out a little project to reawaken this thread with.

I wanted to build an Arduino based RPN calculator entirely from stock sub-assemblies but not be restricted to the ubiquitous 4x4 Arduino tactile keyboard. In my experience, a 4x5 key module gets you into the comfort zone for a basic scientific calculator but the only low-cost, readily available keyboard of this configuration that I have seen is a self adhesive membrane unit, which makes for a quick build but offers very poor usability. Then, I chanced upon a small 5 way switch module that is configured like a mini joy stick. These are available all over the place, PCB mounted or loose, for next to nothing and can be piggy-backed onto a 4x4 keyboard's column headers to add the functionality of a an extra row of keys. The common terminal of the switch becomes row header 5.

The result is a rather strange looking device (see attached picture), which turns out to be unexpectedly ergonomic - for right handers at least. I topped the 5 way switch with the stem from a miniature push button switch. This mini joy stick gives the user's left thumb super powers:

Right = Enter
Up = Shift
Down = Roll down
Left = Exchange X/Y registers

Shift Left = Convert X to degrees
Shift Right = Convert X to radians
Shift Down = Sign change

Which is all quite intuitive.

I met with a couple of snags. The switch's PCB was loaded with redundant pull-up resistors and these were leaking row scan signals directly to the column inputs, resulting in column one responses for all key presses. It took only 2 minutes to desolder them. A fifth switch function is available when the switch is pushed in but I found this action to be almost unusable. The actuation pressure is much higher than it is for the four directional movements, so there was a tendency to get an uncommanded directional actuation when trying to press the switch down in the normal way.

There is still a bit of key legending work to be done.


RE: RPN-duino - Luigi Vampa - 03-25-2017 09:52 PM

Yet another disruptive design! :O) I like it. The only con I can see is the screen size; it seems a bit constrained, when compared to the whole number cruncher.
May I ask for an approximation to the bottom lin€ of the BoM?


RE: RPN-duino - Chasfield - 03-26-2017 08:32 AM

I opted for the 0.96 inch display to keep costs down but a 1.3 inch one could used instead with only a couple of mm added to the length of the device. Here is a BoM summary. Items with specific costs are listed first in GBP inclusive of shipping. Following these come some rough cost estimates of quantities of commodities that I had on hand.

0.96 inch 128x64 OLED module £6.90
Arduino Nano compatible micro-controller £3.70
ECO 16250.06 4x4 keypad £6.00
5-way tactile switch – PCB mounted £3.50
Slide switch £0.50
AAA three cell battery holder £1.75
5x7cm solderable breadboard £2.00

Laminated label tape for key legends £5.00
2mm carbon fibre effect ABS sheet £1.00
3 mm acrylic sheet £1.00
Hardwood strip £1.00
Double sided sticky foam tabs £1.00
2.5 mm plated machine screws £1.00
Small countersunk wood screws £1.00
Two part quick setting epoxy £1.00
Solder £0.50
Self adhesive rubber feet £1.00

The total comes to £37.85.

The structure is formed from planes of 3mm acrylic sheet, spaced by hardwood strips. The open sides are infilled with strips of carbon fibre effect ABS sheet. The 5-way switch PCB and OLED display are mounted on a 5x7 cm piece of project breadboard, which has been sprayed matt black on the visible top side. The Arduino Nano is soldered directly onto the row and column header pins of the keypad. The latter module has a soft Casio type of action and is of screwed together construction. This made it easy to dismantle so that the keys could be re-orientated and resequenced. It was necessary to bring the row and column headers to the top edge. As shipped, they are set at the bottom and the device originally featured telephone style ordering of digits. Some brands of keypad are held together by heat stakes and are worth avoiding.


RE: RPN-duino - Chasfield - 03-27-2017 03:19 PM

Just adding a composite shot of the front and rear of the calculator. The keypad is now labelled up. I couldn't see how to indicate the seven functions of the mini joystick without spoiling the overall look, so I will rely upon their being reasonably intuitive and therefore memorable.


RE: RPN-duino - Maximilian Hohmann - 03-27-2017 03:58 PM

Hello!

The labeling looks very good. Quite impressive how many functions fit on such a small keyboard.

(03-27-2017 03:19 PM)Chasfield Wrote:  I couldn't see how to indicate the seven functions of the mini joystick without spoiling the overall look...

Couldn't you show them on the display in some way, e.g. when the calculator has been idle for some time?

Regards
Max