Skip to content

Build Meatloaf ‐ Lolin D32 Pro

Nigel Kendrick edited this page Jan 15, 2024 · 5 revisions

Making A Meatloaf

Building your Meatloaf device using the Lolin D32 PRO ESP32 is very simple. You only need:

  • Lolin D32 Pro 2.0 board. It's available at Aliexpress for 10 USD https://www.aliexpress.us/item/2251832696801305.html (check Amazon first, it may be cheaper and would ship faster). This board is a WROVER (rather than WROOM) variant, with additional external RAM (PSRAM) to support the ESP32 chip. Bear this in mind if you use another type of ESP32 board as you may have application or performance issues without the extra RAM. If offered a choice, get a WROVER board with 16MB RAM; this will cater for future development and is not much more expensive than ones with less RAM.

  • DIN-6 connector (DIN 45322) male IEC connector with hood

  • Cat 5/6 network cable (no ends needed)

  • Micro USB power source (computer or adapter)

  • Fat formatted SD Card

  • Optional: a device container

The Schematic

The main ingredient this Meatloaf device is the LOLIN D32 PRO Board. Its features are:

  • ESP 32
  • An SD card slot
  • Bluetooth connectivity
  • WiFi
  • A TFT port!

d32_pro_v2 0 0_1_16x16

Here's how you wire it up.

image

The DIN connector shows the solder side. Most connectors have numbers on the pins. Look for those first. Use the wire from cat 5/6 cable and solder the ends to the DIN connector and to the Vias on the board. Dont forget the ground pin.

Here is another view of the connector - this is looking into the pins from the outside:

Cable with dupont socket

If you don't fancy doing any soldering, you can lash up a cable for your Meatloaf as follows - you'll need:

NB: This assumes your ESP32 board has male header pins fitted. If not, darn, you will have to do some soldering!

  • A Commodore serial interface cable (from your favourite supplier or auction site).
  • 6 female dupont patch cables, or tear off a strip of 6 wires from a ribbon cable with female dupont connectors. About 5-10cm in length. (suppliers as above).
  • A 6-way mains cable connector block (or 6 connectors cut from a strip of 10). (Your local hardware store or online).
  • A multimeter or an electrical continuity testing (LED) screwdriver to test the wiring.
  • Sidecutters or wire strippers or a sharp knife.

Instructions

  • Cut your serial cable in half and remove about 10 cm of outside insulation to expose the inner wires. Keep the other half of the cable for future projects or modifications to your meatloaf.
  • Use your sidecutters, strippers etc. to expose about 5mm of bare conductor on each wire.
  • Use your multimeter or screwdriver to identify the correct wire for each plug connection shown in the above diagram and write down the numbers and colours.
  • Screw each wire in numeric sequence (according to the commodore connector) to one of the positions on your mains cable block.
  • Cut the female connectors off one end of each of your dupont wires. You might want to leave the wire which will connect to the ESP32's ground connection a little longer than the others as it has further to go across the board.
  • Strip about 10mm of insulation from each wire and fold the bare strands in half so that they double over and provide a bit more resistance to breaking.
  • Screw these wires into your cable block - if you are lucky, you can sync colours with those from the serial cable. Use the serial cable numbering and colors you wrote down earlier to make sure you know how each dupont connector relates to the serial plug wiring.
  • Double check all your work and make any necessary wiring corrections.
  • Plug your dupont connectors onto your ESP32 board, referring to the wiring diagram above.
  • You are now setup with a Meatloaf ready to be programmed (if not already done) and plugged into the serial port on your computer.

If you have a soldering iron and some heat shrink sleeving, you can do away with the cable block and make a neater cable.

Another variant is to prepare the half-Commodore cable as above and attach a 6-way female dupont connector to the bare wire end, to match the order that the wires need to connect to the ESP32. This looks neat, but does need a crimp tool and crimp connectors. Also, be aware that the pins used on the ESP32 board may change so the connector is no longer wired to match.

Cable with dupont socket

3D Print A Case (optional)

To keep your Meatloaf device safe and cool, 3d print this case.

PXL_20231229_004836659_small

https://www.thingiverse.com/thing:6405289

Adding the Special Sauce

To create the firmware for the device, you'll need Visual Studio Code (free) https://code.visualstudio.com/ and the Platform IO Plugin. You can add the plugin by searching for it after installing Visual Studio Code.

2024-01-13 23_05_47-PIO Home - meatloaf-specialty - Visual Studio Code

Next clone this meatloaf-special repository:

https://github.com/idolpx/meatloaf-specialty

Install your SD card and connect your device to the computer using a microusb cable. The device should be recognized and will be correctly identified in the our computers device manager under COM / SERIAL devices. If it is not correctly identified, go to this page and install the device driver. https://www.wemos.cc/en/latest/ch340_driver.html In case the page is down, here are the drivers:

Windows 

CH341SER_WIN_3.5 (1).ZIP

Mac

CH341SER_MAC_1.5.ZIP

Configuring

A vital step is configuring the parameters in the platform.ini file. Find the platformio.ini.sample file and copy it to platformio.ini. This is the file we're going to edit properly address the device and to enable some other features. Make sure "environment = lolin-d32-pro" is uncommented. Next make sure "flash_size = 16mb" is uncommented. Uncommenting means the semi colon (;) is not in front of the option. Optionally, you can add your wifi_ssid and wifi_pass to the file. These can be changed using the Commodore "Open" command (see the operation page) and will be persisted on the device between boots. Open the file in your favorite text editor or within the visual studio code text editor. Make or verify any changes and save the file. Platform IO will then perform some actions to prepare for compilation.

2024-01-14 01_01_21-platformio ini sample - Notepad

Now, simply open the device under the Platform IO plug-in and select Upload. It will then build and upload the firmware to the device. Depending on if you're on Windows or Linux, it will take some time. If all goes well, you'll see a success message and the firmware will be installed on the device.

Lastly, scroll down to the Platform section and select "Upload Filesystem Image".

2024-01-14 00_09_04-PIO Home - meatloaf-specialty - Visual Studio Code

Changing device ID

By default, your Meatloaf is set to device ID #8, just like the good-old Commodore disk drive. If you want to change the ID so you can use your Meatloaf in conjunction with other devices, you can change its ID in the main.cpp file, at approximately line 132:

// Add devices to bus
       FileSystem *ptrfs = fnSDFAT.running() ? (FileSystem *)&fnSDFAT : (FileSystem *)&fsFlash;
        iecPrinter::printer_type ptype = iecPrinter::printer_type::PRINTER_COMMODORE_MPS803; // temporary
        Serial.printf("Creating a default printer using %s storage and type %d\r\n", ptrfs->typestring(), ptype);
        iecPrinter *ptr = new iecPrinter(ptrfs, ptype);
        fnPrinters.set_entry(0, ptr, ptype, Config.get_printer_port(0));
        Serial.print("Printer "); IEC.addDevice(ptr, 4); // add as device #4 for now

//        Serial.print("Disk "); IEC.addDevice(new iecDrive(), 8);
        Serial.print("Disk "); IEC.addDevice(new iecDrive(), 9);
        Serial.print("Network "); IEC.addDevice(new iecNetwork(), 16);
        Serial.print("CPM "); IEC.addDevice(new iecCpm(), 20);
        Serial.print("Voice "); IEC.addDevice(new iecVoice(), 21);
        Serial.print("Meatloaf "); IEC.addDevice(new iecMeatloaf(), 30);

The above shows the config line for device #8 commented out and a new line added, setting the device ID to #9.

If you change this setting, you will need to recompile and reupload your code to your ESP32 board.

You're Done!

Now go check out "Using Your Meatloaf" to learn how consume your new Meatloaf.