Yet Another TZX/CASDuino Variant

Written January 18th, 2020 by

There are several implementations of the famous TZXDuino / CASDuino audio cassette emulator for Sinclair and MSX computers, some require dedicated “shields”, others require considerable use of breadboards and flying wires, more or less simple to make. The one I propose today uses two easily available and inexpensive shields and some external components necessary for connection with the computer. Only a minimum of familiarity with the soldering iron is needed to make the few required connections.



In addition to the Arduino board, this project requires a Data Logger shield and an LCD Keypad shield, both easily available on e-Bay or other online stores for a few dollars. For connection to the computer, a 10uF electrolytic capacitor, a 3.5mm stereo jack socket and a 2.5mm mono jack socket.




The Data Logger shield will be used to access the SD card containing the programs and games to be loaded on the computer and to host, in the prototyping area, an electrolytic capacitor as a filter for the analog audio output and the two 3.5 and 2.5 mm jack sockets to connect the cables for the cassette recorder supplied with the computers.

The LCD Keypad shield, as the name suggests, provides a parallel type 16×2 character LCD display and a push-button panel that we will use to select the files to be played and start or stop playback. The peculiarity of this shield is that the buttons are connected to a single analog input of Arduino and therefore requires a particular sketch to know which button has been pressed. In practice, each button corresponds to a voltage level from 0 to 5 volts therefore it is necessary to read the level from the analog input and determine, based on the value, which button was pressed.

int _BTN_SELECT[]  =  {720, 760};
int _BTN_LEFT[]    =  {480, 520};
int _BTN_RIGTH[]   =  {0, 20};
int _BTN_UP[]      =  {120, 160};
int _BTN_DOWN[]    =  {300, 350};

int ctrlButton()
  int button = analogRead(A0);

  if ( _BTN_SELECT[0] <= button && button <= _BTN_SELECT[1] ) {
    return btnPlay;
  if ( _BTN_LEFT[0] <= button && button <= _BTN_LEFT[1] ) {
    return btnStop;
  if ( _BTN_RIGTH[0] <= button && button <= _BTN_RIGTH[1] ) {
    return btnRoot;
  if ( _BTN_UP[0] <= button && button <= _BTN_UP[1] ) {
    return btnUp;
  if ( _BTN_DOWN[0] <= button && button <= _BTN_DOWN[1] ) {
    return btnDown;

  return 0;

In this example, we read the value from analog input A0 and compare the returned value with a series of preset values to determine which button was pressed.

The attached sketches already include these changes and you don’t need to do them.

Looking at the photo of the shield you will notice that the connector of pin 10 is missing.


This pin is used by both the Data Logger shield as the SD card chip select and by the LCD Keypad shield to turn off the display backlight. I removed it to avoid the annoying flashing of the display every time the sketch accesses the SD card, since I don’t need to turn off the display anyway.


Place the electrolytic capacitor and the two jack sockets on the prototyping area of the Data Logger shield so that the two sockets are easily accessible from the right side, as visible in the figure and in the attached photos (unfortunately I have not found a better representation for the connections).


With a few pieces of insulated copper wire, connect the Arduino pin 3 (the fourth from the right) to the positive terminal of the electrolytic capacitor, the negative terminal to the pin corresponding to the tip of the jack connector, the terminal corresponding to the sleeve of the jack connector to one of the Arduino GND pins. Do not connect the other terminals otherwise inserting a mono jack plug, like the one supplied with the home computers, will short the terminals to ground causing troubles.

Similarly, connect the Arduino pin 2 (the third from the right) to the tip terminal of the 2.5mm jack and the sleeve terminal to one of the Arduino GND pins. This will allow MSX computers to control the playback of files as if they were a real cassette recorder.

Once the components have been placed and soldered, assemble the device by mounting the Data Logger shield on top of the Arduino board, then the LCD Keypad shield on top of the Data Logger shield.

Sketch loading and usage

Connect the Arduino board to the computer via a USB cable to be able to program the sketch. Launch the Arduino development environment on your computer, open one of the attached sketches and load it onto the board. If all goes well, the LCD should come on and display the message ‘No SD Card’, this is normal if you have not inserted an SD card.

At this point you can copy the programs or games you want to use onto an SD card and insert it in the slot of the Data Logger shield. Pressing the reset button a message should appear with the version of the loaded sketch and the contents of the card. Make sure that the SD card is formatted as FAT16 or FAT32 otherwise the sketch will not be able to read its contents. It is not necessary to use a dedicated card but obviously the less “extraneous” files there are, the easier it will be to scroll through the content to find what interests us.

Now you can connect the device to your home computer.

For Sinclair computers

  • Load the TZXDuino sketch
  • Connect an audio cable from the computer’s EAR socket to the 3.5 mm jack socket
    The 2.5 mm jack socket is not used with these computers

For MSX computers

  • Load the CASDuino sketch
  • Connect the while plug (audio in) to the 3.5 mm jack socket
  • Connect the black plug (remote) to the 2.5 mm jack socket

Alternatively, if you own both systems, it is possible to load the MaxDuino firmware, which is a unified version of CAS and TZX firmwares and can be used with both Sinclair and MSX systems.

The UP and DOWN keys allows to scroll through the list of files on the SD card, the SELECT key allows to enter a sub-directory or start playing a file, the LEFT key allows to go to the previous directory or pause and resume playback, the LEFT button stops playback. The RIGHT key access to the sketch configuration menu.

Select the program or game you want to load, type the command to load the files from tape relative to the computer you are using, for example LOAD “” for Sinclair computers, or RUN”CAS:” for MSX computers, press the key SELECT and … wait for the upload. Exactly how it worked 30+ years ago, it is necessary to wait a while before seeing the screens of the chosen game appear. The advantage is that now the programs will always be loaded correctly.

Once the correct operation has been verified, you can disconnect the device from the PC and power it with a common 9 volt battery, thus obtaining an independent workplace similar to what it once was, with our faithful home computer near the tape player/recorder.


tzx-duino-img0ArduinoData Logger