Finally got the working mockup running. Currently the hardware includes:
- ESP32 dev module
- Arduino Micro Pro
- SD card reader
- BW LCD with a software LED control
- Hardware keyboard (a working mockup so far; the Chinese PCB manufacturer entered wrong delivery address, so the parcel is back to China)
The LCD part can be easily removed from the primary board - it is held attached by a header.
Power consumption in this configuration:
- Input at 4.96V (WiFi, BT off in all tests)
- The LCD screen LED is fully on (75 Ohm resistor) 103 mA
- The LCD screen LED is fully off (but the LCD is running) 98 mA
- The LCD screen is off (ESP32 and Micro Pro running) 94 mA
- The LCD screen is off, Micro Pro off (ESP32 running) 82 mA
- The total power is wherefore 500 mW, and two 5000 mAh batteries will last 2*5*3.7/0.5 = over 3 days of continuous operation.
I have also compared this to the power consumption of Arduino Mega 2560 with a TFT 480x320 color screen and an SD card (see the video in the Project Log 01). Two different Mega we used: "Classic" and "OSEPP" (in brackets).
- Input at 4.96 V (BASIC is running)
- With TFT connected: 108 (118) mA, 550 mW - this is comparable to the BW LCD system, but no keyboard injection capability.
- With TFT removed : 22(32) mA, 125 mW.
I could not find an elegant way of disconnecting/managing the TFT power and the TFT backlight as it is mounted on a shield.
Obviously, Mega with a BW LCD would make a decent calculator with about 30-50 mA consumption, which equates to one month of a continuous running! Unfortunately, this system has only 4-byte arithmetic, no real-time clock, no WiFi, etc.
The calculator connects to the PC in three ways:
- Via ESP32 USB - for programming ESP32 and direct operation of Terminal BASIC via VT100
- Via Arduino Micro USB - for programming Arduino and impersonating a wired keyboard (still writing code for this - should be an INJECT keyword in BASIC)
- Via BT or WIFI of ESP32 - have not tested software yet, but the hardware is OK - BASIC now has a SET WIFI_NAME, SET WIFI_PASSWORD, NETTIME() keywords, and so you can set time from the network or make a table clock in BASIC.
The Terminal BASIC on ESP32 is working... kind of. I have replaced the capitalized keywords with a lower-case.
The SD card code is not compiling properly as the ESP32 and the Arduino libraries are different - still working on it. The hardware is fully operational, and I am able to run independent tests:
The Terminal BASIC is seemingly having a hard time working with double-precision numbers on ESP32. This program calculates a factorial in integers:
Now replacing r% with r - for 4-byte floats:
Finally, we replace "r" with "r!" ("!" stands for long reals) results in busted stack!
Next: debugging Terminal BASIC on ESP32!