Wednesday, April 3, 2019

Commodore64 Meets Arduino

  I was a devoted C64 user from the time I bought one in '85 till the time I put it away in '96, on account of having moved house and gotten busier at work (time and circumstances) and so on. But, it was the greatest fun.
  At one time I was experimenting, trying to develop a "wireless remote" joystick based on DTMF encoding/decoding and FM radio. Tone capture wasn't very snappy though.
  Fast Forward 25 years to the present day. I got the idea of bringing back the C64 fun with some Arduino fun by utilizing the Esplora. With its integral accelerometer and handy buttons it seemed a natural as a controller platform. Combined with HC-05 and HC-06 Bluetooth modules and a Pro-Mini, a wireless game controller system was born.
  The first step was to assess the Esplora playability by rigging the Esplora outputs to some open-collector transistors and those to the C64 joystick port. As that worked out acceptably, I worked out a couple of sketches that relied on SoftwareSerial with the Bluetooth modules.
  The Esplora (transmitter) sets bits in a control byte based on the results of the accelerometer reads and a pushbutton, and transmits that, in a loop. The Pro-Mini (receiver) deconstructs the bits from the received control byte, applying those to output pins that control their respective transistors that interface with the C64 (via the Control Port, the CIA's pulled up inputs).
  Most of all, I wanted to play Zaxxon (!) and Defender again. I have those on cartridges. I used Defender during development.
  Trying out Zaxxon uncovered a dilemma. In Defender, joystick forward/back positioned the craft Up/Down, so I programmed the Esplora so that tilting up resulted a joystick forward. But that was incompatible with Zaxxon where a dive with the controller tilted up. To accommodate the difference I made an input to switch between the two modess. So, for Zaxxon tilting the Esplora down results a dive and up results a climb. The system works well, but could stand some tweaking vis-à-vis the accelerometer thresholds for forward/backward (up/down, dive/climb).

I found a composite to HDMI converter for around $20. The C64 looks great on the Big Screen.


  Transmitter schematic and pic


  Receiver schematic


  Receiver pics 





  Special Thanks to Martyn Currey, he made the BIND and PAIR configuring simple.
http://www.martyncurrey.com/connecting-2-arduinos-by-bluetooth-using-a-hc-05-and-a-hc-06-pair-bind-and-link/

  All I've done so far has been with cartridges. I should pull out a disk drive and see how that goes. This should work with the Amiga, too (I could dig up Action Fighter).

Look on my "Where's the Code?" page for the transmitter (Controller64_TX03) and receiver (Controller64_RX02) sketches.