Monday, March 16, 2015

Building the Tapuino R2

Hi,

The Tapuino has gone through several iterations, this post is a revisit of the build instructions containing these updates.

DISCLAIMER: If you build this and it blows up your C64, sets your house on fire, kidnaps your dog or any other negative occurrence, I take no responsibility or liability whatsoever. That said I will do my best to help troubleshoot any builds (I do take responsibility for all positive occurrences ;)).

I would highly suggest that you read this entire post at least once before building the Tapuino!

Note: code and hardware design files can be found on my GitHub at: https://github.com/sweetlilmre/tapuino

So lets get started. Firstly a bill of materials:

Major components:
  • Arduino Nano V3
  • 16x2 LCD Display with I2C backpack
  • SD Card module with built-in level conversion
  • 40 wire Dupont female-female 'ribbon'
I got all of this from eBay. Here is an example shopping list:


Addition components:
  • Piece of vero board. The one I got was 100mm wide x 200mm long. This is also known as strip board and must be the kind with strips of copper (as opposed to individual 'cells')
  • 32 pin (16x2) WIDE dip socket (this is what the Nano will plug into) or 2x15 female headers
  • 6 pin (3x2) dip socket (for the opto-coupler)
  • A strip of male pin headers
  • A strip of male right-angle pin headers
  • 2 strips of female pin headers (sockets)
  • 1x 430 Ohm resistor
  • 4x Tactile switches (6x6)
  • 1x 4N25 Opto-coupler
  • Some jumper wire (I use single core wire from a piece of telephone cable)
Here are examples of the headers:

Here is a schematic of the board in Fritzing format:
Tapuino V2 schematic


So lets build the main board first. You'll want to put it together like this:
Top view of the main board


Note the minimum dimensions of the board: 29x17. You may wish to make the board larger to allow for mounting holes.

Before you assemble:

The Nano has 2x15 pins and the socket is 2x16 so if you use the socket make sure the extra pins are on the right (in the diagram above after the D12 and D13 pins), or use 2x15 pin female headers.

R1 = 430 Ohm
Green blocks = straight header pins.
Grey blocks = female headers

Break the header pins into appropriate size groups:
2x3 pins
1x6 pins
1x4 pins
and cut the female pin headers to size (mine were 40 pin, so cut down to 8 pins):

Bottom view of the main board


The lighter yellow bits are where the vero board has been cut. It is essential that you check that these tracks are cut properly. Use a multimeter to test for continuity between the tracks once cut. To cut the tracks on my prototype I used a small sharp drill bit that was luckily a perfect fit.
Please take note of the cut track between the two pins of R1 (under the resistor).


I would suggest that you solder in this order:
  1. 32 pin wide socket (or 2x15 pin female headers)
  2. 6 pin dip
  3. 2x3 pin header group next to the 6 pin dip
  4. Remaining pin headers
  5. Jumper wires

Feel free to extend the pin headers to access additional pins on the Nano if you like, I just wanted to keep it simple for wire-up later and expose only the pins necessary.

Next up is the button board, this is the much simpler V2 button board that uses internal pullups on the Nano and so doesn't need any resistors:
Top view of the button board


Note the minimum dimensions of the board: 20 x 13. You may wish to make the board larger to allow for mounting holes.

Green pin headers are right angle.The pinouts of the green pin headers, left to right are as follows: GND, BTN1, BTN2, BTN3, BTN4

Bottom view of the button board

Take careful note of the track to cut: on the 4th track (from the left) to isolate button 3 from button 1
Also note that the jumper wires for the ground lines are soldered through to multiple points. I achieved this by cutting the wires into individual sections:
  • ground line (top most line) there are 4 jumper wires of 4, 6, 6, 6 tracks in length.

Now lets install the components and connect it all up.
Firstly install the 4N25 opto-coupler into the 6 pin socket, noting where pin 1 is according to the vero board schematic. Here is a picture with the correct orientation:

Installing the 4N25 opto-coupler


Note the small dot on the chip, this indicates pin 1. The chip should be oriented such that pin 1 connects through to the 440 Ohm resistor (R1).

Next the Nano:

Installing the Nano

As discussed above, the Nano has 2x15 pins and the socket 2x16 pins. If you chose to use the 32 pin socket, care must be taken to place the Nano correctly. The Nano must be aligned so that the empty socket pins are on the right most pins of the socket as per the image above i.e. the Nano is mounted as close as possible to the opto-coupler.

If you trace out the circuit you will observe that the 2x3 pin headers between the opto and the Nano expose a ground and power rail (left is GND, right is PWR). You will use these rails to provide power to the LCD, SD Card and Button breakout boards.

Connect according to the legend in the main board image, here is a guide:

LCD:
  • Power and Ground go to the rails described above
  • Nano A5 goes to SCL
  • Nano A4 goes to SDA
SD Card:
  • Power and Ground go to the rails described above
  • Nano D13 goes to SCK
  • Nano D12 goes to MISO
  • Nano D11 goes to MOSI
  • Nano D10 goes to SS
Button Board:
  • Ground go to the rail described above
  • Nano A3 goes to BTN1
  • Nano A2 goes to BTN2
  • Nano A1 goes to BTN3
  • Nano A0 goes to BTN4
Finally the pinout for the C2N connector to the board:
CN2 to Tapuino connector pinout

You will need to break out 8 pins from a pin header.
Solder the C2N connector to the pins in the follow manner:

  • GND to PIN 1
  • PWR to PIN 2
  • READ to PIN 3
  • MOTOR to PIN 4
  • SENSE to PIN 5
  • WRITE to PIN 8
I recommend you heat-shrink the pins as above.

Your connector should look like the one above, the colour to pin map in my case is:
  • Black (GND) to PIN 1
  • Green (PWR) to PIN 2
  • White (READ) to PIN 3
  • Red (MOTOR) to PIN 4
  • Blue (SENSE) to PIN 5
  • Brown (WRITE) to PIN8
Should look something like this:
C2N connected to the Tapuino
NOTE:

PIN 1 (GND) is connected to the left-most pin of the female pin header.

Now all that is left to do is flash the sketch to the Nano, disconnect it from USB, insert an SD Card with TAP files, connect the Tapuino to the C64 and enjoy!

The U.I. is controlled as follows:

BTN 1 is SELECT
BTN 2 is ABORT (during a load) or BACK one directory if browsing
BTN 3 is PREVIOUS
BTN 4 is NEXT

If you have directories on your SD card they will be indicated by an arrow in the right-most column of the LCD where the filename is displayed. Long filenames are now supported!


Caution: Do not connect the Nano to both the C64 and PC. Also check all soldering very carefully for shorts before wiring up to your beloved machine!

The astute reader will note that the bus connector has 2 additional pins that are not connected: CTRL1 and CTRL2. These are used in the MUX board to allow switching between the C64 and a real Datasette as a target device and will be covered in a future blog.

Hope you enjoyed this, it was a helluva post to write!

-(e)

20 comments:

  1. Awesome! I will build one of these for sure!

    ReplyDelete
  2. Amazing, just built one just need to hook it up to the computer now, tomorrows job. C64 and PET here. Cheers & Beers!!!!!

    ReplyDelete
    Replies
    1. Super! Glad you got it built! Share pics and let me know how the PET works :-)

      Delete
    2. Super! Glad you got it built! Share pics and let me know how the PET works :-)

      Delete
  3. awsome work! will defenitly build one :-)
    One question were do i find the sketch for flashing to the Arduino?
    Looked at the link to the code but there was alot of files, wich one to use?
    Would love i guide for the flashing as well :-)

    Keep the great work up! /Dan

    ReplyDelete
    Replies
    1. Just grab a zip of the source from GitHub, extract it to your hdd and inside will be the tapuino.ino file. Make sure the directory you extracted to is called "tapuino" (GitHub calls it "tapuino_release" or something so rename it), load the .ino into the IDE and flash as normal.

      Delete
  4. Dear Peter Edwards, what's the usb nano correct?

    this :

    http://www.ebay.it/itm/200964325858?_trksid=p2055119.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT


    or this :

    http://www.ebay.it/itm/311064700128?_trksid=p2055119.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT

    ReplyDelete
  5. The 2nd link (CH340G cheapo) is the one you want. Get 2 for the price of the more expensive one :-)

    ReplyDelete
  6. Dear Sweetlimre,
    I have built the tapuino but i have problems with the recordings. This is strange for me, because I have recorded (always with tapuino) games without errors of the same cassette in which there are games that I don’t record with success (after many attempts) : cassette with same loader! However ALL games load without errors when the tape record is connected directly to commodore 64 (then i don't have problem of azimuth, cleaning, etc.).
    The sd card is fast (HC)
    The invert is "1" when record and "0" when play
    The cables of the recorders are originals....
    What's the problem?

    ReplyDelete
  7. Could you add support for ZX Spectrum and TI99/4a? They have Ear and Mic plug and TI have remote plug for pausing tape recorder.
    Is this possible?
    I have build tapuni by your instructions and it work GREAT!

    ReplyDelete
  8. Hi all I was wondering if you can help me, I've built the Tapunio and it powers up ok and it does the Init, then it starts scrolling through the play and record and options on the screen, if I disconnect button 4 it stops. So I changed the button and checked if there is a short and all seems ok. But still it scrolls through the list of play record , and options so any help would be great full thanks

    ReplyDelete
  9. Hi Peter, waiting for the parts to arrive so I can make my own Tapuino - really looking forward to making it. Would love to see you make something better than the UNO2IEC as well (ie not require a pc). Thanks for makin this guide!

    ReplyDelete
  10. This is an awesome project! I'm fairly new to Arduino (but have been programming in C for many years) and could use your help to make a small modification. I have an LCD shield that has buttons on it already and want to reuse that for this project. The buttons are set up to use only one analog pin, so 5 buttons only take up one pin. I've been looking through to code to see where I'd need to make a change to how buttons are read. I can't seem to find where that would be. I'm thinking somewhere in comms.c (input_callback?) - but I can't see how you read the digital pins for the buttons. Can you give me a pointer? I can't seem to find digitalRead being used anywhere to read the button pins in the rest of the code either. How do you do it? I see lots of shifting, but no pin reading. I think I might be missing something (like another way to read the button pins without using digitalRead?)

    The LCD module I'm using is this:
    http://www.dfrobot.com/wiki/index.php?title=Arduino_LCD_KeyPad_Shield_(SKU:_DFR0009)#Pin_Allocation

    ReplyDelete
  11. Thanks for putting this up here! I've just ordered the parts and hope to build mine soon ;-)

    One question: would it be possible to use an Arduino Due instead of a Nano?

    cheers!

    ReplyDelete
  12. Wow, you did a fantastic job here! I am currently surfing around and looking for the parts I am going to need in order to make my own Tapuino. Since you put so much effort into creating this, I think it is only fair that you should be earning some commissions from selling the parts via an affiliate link!

    Brian Hopkins @ Micro Tips USA

    ReplyDelete
  13. how enable the C16 support on 2.5.0-beta?

    ReplyDelete
  14. I build one, thank you :)
    https://www.youtube.com/watch?v=ePqyHPEGN2s

    ReplyDelete
  15. Hi,

    I am trying to compile tapuino but seems there is a file missing dsip_lcd.h can you please guide me where to find the the current file?

    Thanks
    Mauro

    ReplyDelete