Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Paddle control with Arduino

Reply to topic
Author Message
  • Joined: 13 Jul 2018
  • Posts: 2
Reply with quote
Paddle control with Arduino
Post Posted: Tue Aug 20, 2019 10:43 pm
Hello everybody.

I would like to share with you the development I did several months ago according to what I read on your forum and Raphnet previous development (I'm a recent member and i cannot post the links...)

Arduino Nano have several advantages over PICs: size, cost and easy to be programmed without a chip programmer. Instead of making an enclosure with a 3D printer, all electronics and the potentiometer can be allocated inside a standard SMS pad. To do this, as you can see on pictures, I broke the PCB inside the pad for UDLR and I made a hole on the pad.
One key point is that the standard SMS pad does not have all cable for the DE-9 connector. So, I cannibalized a Megadrive/genesis one to use its cable.

Two interesting conclusions
1) It is an export paddle, but it works with games as Woody Pop and other JAP games
2) If you use an everdrive over a genesis, be careful to unplug the standard pad and to plug this device just during the game programming, because it is only recognized after the turn-on routine but not after a reset.

I tested it with the OutRun 3D directly over a SMS model 1, which is very funny because it changes to automatic gearbox since the second button is disable. I also tested with a Woody Pop over the SMS-II as you can see on my video. I don’t have these two games (and the Woody Pop is only a JAP one) so I programmed them using EEPROM, what I could also explain you on other post.

I hope you like it.
IMG_0962.mp4 (7.97 MB)
WoodyPop video
IMG_1922.JPG (121.03 KB)
final result (adhesive tape can be removed)
IMG_1922.JPG
IMG_1909.JPG (144.74 KB)
inside rear view
IMG_1909.JPG
IMG_1835.JPG (86.55 KB)
cuts over encolsure
IMG_1835.JPG
IMG_1854.JPG (93.9 KB)
cuts over UDLR PCB
IMG_1854.JPG
ArudinoCode.zip (1.15 KB)
Arduino code

  View user's profile Send private message
  • Joined: 05 Jul 2017
  • Posts: 61
  • Location: Cornwall, United Kingdom
Reply with quote
Post Posted: Tue Dec 03, 2019 4:17 pm
This is really cool.

Have you shared your Arduino code anywhere?
  View user's profile Send private message Visit poster's website
  • Joined: 13 Jul 2018
  • Posts: 2
Reply with quote
Post Posted: Tue Dec 03, 2019 6:44 pm
of course. It is in the .zip file. But here your are:


int pinLEFT, pinRIGHT, pinUP, pinDOWN, pinTR, pinTH, pinAI;
int HighBits, LowBits;
long inputRAW, inputByte, Working;

void setup() {
       pinLEFT = 3;
       pinMode(pinLEFT, OUTPUT);
       pinRIGHT = 6;
       pinMode(pinRIGHT, OUTPUT);
       pinUP = 5;
       pinMode(pinUP, OUTPUT);
       pinDOWN =4;
       pinMode(pinDOWN, OUTPUT);
       pinTR = 9;
       pinMode(pinTR , OUTPUT);
       pinAI = 7;
       attachInterrupt(0, AskingForData, CHANGE);//it didn't work using Rising and Falling events
       pinTH = 2; //related with previous assignment to Interrupt 0
       
/* Connection diagram with Arduino NANO according to previous asignation
 * DB9 PIN 9 - white    - pinTR (data available confirming)
 * DB9 PIN 8 - black    - arduino GND
 * DB9 PIN 7 - gray     - pinTH input from SMS => attached to Interrupt 0 (Arduino pin 2)
 * DB9 PIN 6 - blue     - button A (TL signal). The other side of button will be connected to GND
 * DB9 PIN 5 - green    - Arduino 5V
 * DB9 PIN 4 - red      - pinRIGHT
 * DB9 PIN 3 - orange   - pinLEFT
 * DB9 PIN 2 - yellow   - pinDOWN
 * DB9 PIN 1 - brown    - pinUP
 * potentiometer: one side to 5V, other side to GND and intermediate connection to pinAI (analog input)
 */
inputRAW = 0b0000;
inputByte = 0;

Working = 0;
HighBits = 0;
LowBits = 0;

}

void sendBits(int HalfByte){
      digitalWrite(pinUP, (HalfByte & 0x01));
      HalfByte = HalfByte >> 1;
      digitalWrite(pinRIGHT, (HalfByte & 0x01));
      HalfByte = HalfByte >> 1;
      digitalWrite(pinLEFT, (HalfByte & 0x01));
      HalfByte = HalfByte >> 1;
      digitalWrite(pinDOWN, (HalfByte & 0x01));
}

void loop() {
      inputRAW = long(analogRead(pinAI));
      if (!Working){
        //data convertion from 0-1023 to 8 bits (255)
        inputByte = (inputRAW * 255) /1023; //only one instruction to avoid interrupt during conversion
      }
}

void AskingForData() {
    if ( (digitalRead(pinTH) == 1) && (Working ==1) ){
      sendBits(HighBits);
      digitalWrite(pinTR, HIGH);
      Working = 0; //to do not refresh inputByte from potentiometer before sending the Low bits
      }
    else if (digitalRead(pinTH) == 0){
      HighBits = (inputByte >> 4);
      LowBits = (inputByte & 0x0F);
      digitalWrite(pinTR, LOW);
      sendBits(LowBits);
      Working = 1;
      }
}

  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!