Skip to content

cryptoterminals/maccryptoterminals

Repository files navigation

maccryptoterminals

Micropython and related code for ESP8266-based old-world Mac Crypto Price Terminals

This code is associated w/ the NFT project http://twitter.com/cryptoterminals and https://opensea.io/assets/0x2532a770211bf10435c70d889357b1a820260be1/1 and https://foundation.app/@Yugen

Mac Crypto Terminal

This project runs Micropython on an ESP8266 to fetch prices from the free Coingecko API for Bitcoin, Ethereum and 3 stablecoins. It also retrieves the last cryptopunks sale and floor price from http://www.punksfloorprice.com/. On the Mac side, a Hypercard stack uses the serial port to connect to the ESP8266 and receive prices and configure the connection (Wifi credentials, request updates from the server). This is tested on an 8Mhz Mac Plus. Faster Macs may work, but the Hypercard stack is paced via trial-and-error and probably breaks on a faster Mac with unpredictable results. It should be fixable with the right amount of sleep time between polls/updates.

You are welcome to reuse any of this code or plans - the NFTs associated and the custom Hypercard stack are the unique items. The included .img has a base Hypercard stack that includes the serial functionality, but it's missing the code to talk to the ESP8266...If there is interest I can put up a reference example without the artwork.

To use this code, you need the following hardware:

  • An old-world Mac w/ a DIN8 serial port & Hypercard installed
  • I am testing on OS7 because it has a 'Startup Items' folder
  • A custom 4 wire DIN8 to DB9 cable with the following pinout - the DIN8 connects to the modem/printer port on the Mac - the DB9 connects to the RS422 side of the adapter linked below and in the photo:

   DIN8F MAC PORT              DIN8M CABLE END

    8  7  6                6  7  8

    5  4  3                3  4  5

     2  1                   1  2

cable chain

You need to erase & flash your NodeMCU ESP8266 as per instructions here:

https://docs.micropython.org/en/latest/esp8266/tutorial/intro.html#intro

Assuming /dev/ttyUSB0:

esptool.py --port /dev/ttyUSB0 erase_flash

Assuming esp8266-20210202-v1.14.bin:

esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266-20210202-v1.14.bin

Connect to serial to turn on web_repl and set a password - use Ctrl-a, then x to break out:

[user@LinuxWorkstation Downloads]$ picocom -b 115200 /dev/ttyUSB0
>>> import webrepl_setup
WebREPL daemon auto-start status: disabled

Would you like to (E)nable or (D)isable it running on boot?
(Empty line to quit)
> E
To enable WebREPL, you must set password for it
New password (4-9 chars): password
Confirm password: password
Changes will be activated after reboot
Would you like to reboot now? (y/n) y

and, upload the python in this repo using the instructions here (I save as main.py which runs on startup by default per the Micropython setup):

https://docs.micropython.org/en/latest/esp8266/quickref.html#webrepl-web-browser-interactive-prompt

I use the client: https://github.com/micropython/webrepl

To connect to the ESP8266, connect your Wifi to the Micropython AP using password micropythoN

Click connect, and send the python code. Connect to your Mac Plus and reboot.

I found reference code for doing serial interactions within Hypercard at

https://archive.org/details/hypercard_serialporttoolkit

and

https://www.info-mac.org/viewtopic.php?f=119&t=1049

YOU NEED A HYPERCARD STACK WITH THE SERIAL XCMD AND XFCN EMBEDDED FOR THIS TO WORK! The example stacks above provide this. I also added it to the repo. The serial commands won't work unless you have these XMCD and XFCN embedded in your stack (I think you call this part of the 'resource fork'). You can simply start with one of these and delete the cards and scripts you don't want, or even all of them, but your stack needs to be based on a file that had these resources attached (I think this was/is done in ResEdit). The toolkit includes the actual source code for the XCMD and XFCNs that get attached (I believe it's written in Pascal)

cable chain2

About

Micropython and related code for ESP8266-based old-world Mac Crypto Price Terminals

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages