What's new

Open Motion G-Loc: Sega G-Loc Deluxe Motion Solution

berty

Student
Joined
Sep 24, 2016
Messages
27
Reaction score
43
Hi Arcade Projects Team.

I am a collector and restorer based in Australia and I have quite a large collection of arcade and pinball machines that I have restored and documented over the years. One of my machines is Sega's G-Loc Deluxe which I brought as a completely wrecked machine and restored over a number of years.

After years of becoming frustrated with failing and expensive hardware, I endeavoured to build a modern control system for the Sega G-Loc cabinet that replaces all of the Sega hardware, but doesn't hack up the wiring - leaving people with the ability to easily install aftermarket or original hardware.

Latest version: GitHub Repository – Open Motion G-LOC v41

Currently Supported Games
-G-Loc
-Strike Fighter

Current Known Bugs / Issues
v41 is a proof of concept build which you use at your own risk. Emergency stop is currently implemented in code but not working correctly. There are issues with motor polarity detection and implementation outside of the main program loop which needs to be fixed at a later stage.

What is Open Motion G-Loc?

Open Motion G-LOC is a modern, open-source motion control system designed to restore and operate the Sega G-LOC Deluxe arcade cabinet. Open Motion G-LOC is a complete modern replacement for the original Sega 839-0341, 839-0430, 400-5117, and 5117Y motion boards, allowing collectors, arcade owners, and enthusiasts to safely and reliably run their G-LOC Deluxe cabinets again.


Open Motion G-LOC replaces all of the original motion control electronics (which are rare, fragile, and nearly impossible to repair) with a custom-built system based on:

  • Arduino Mega 2560 as the main controller
  • Off-the-shelf DC motor drivers (e.g., MMT-4Q)
  • Real-time position feedback via rotary encoders
  • Closed-loop PID control for smooth, accurate motion
  • Emergency stop and safety logic built into the firmware
  • Integration with MAME using MAME Hooker for real-time motion and lighting signals
  • A diagnostic OLED screen and test/calibration controls

With the right connectors, it plugs directly into the original wiring harness with no need to cut or splice anything. It's debuggable and configurable via an OLED display and serial commands.
It brings G-LOC back to life with authentic seat motion, working Start/Danger lamps, and support for other MAME games. It’s open-source and community-expandable with no proprietary lock-in

Theory of Operation
At the core of the Open Motion G-LOC system is a closed-loop motion control design that emulates the original Sega G-LOC Deluxe cabinet’s two-axis gimbal movement without relying on proprietary Sega hardware. The system is built around an Arduino Mega 2560, which serves as the main controller, interfacing directly with motors, encoders, limit switches, and safety mechanisms. The Arduino receives real-time movement commands over a USB serial connection from a PC running MAME and MAME Hooker, which outputs motion data based on in-game events.

Each axis of motion (left/right and up/down) is powered by a brushed DC motor that moves the seat through a belt-and-gearbox assembly. Rotary encoders mounted on the motor shafts provide precise feedback about the seat’s position. This information is essential for the system’s PID (Proportional-Integral-Derivative) control loop, which constantly compares the current position to the desired position and adjusts motor output to achieve smooth, accurate motion. Unlike the original Sega system which relied on hard-coded responses the PID algorithm allows for dynamic tuning and refined movement behavior.

Safety is partly integrated into the control logic (use at your own risk). Limit switches on each axis act as physical boundaries to prevent overtravel, while an emergency stop circuit, wired as Normally Closed, will instantly disable motion if triggered by boundary sensors or a seat-mounted button. If communication with the PC is lost or motion commands stop, a serial timeout failsafe resets motor targets and recenters the seat to a neutral position, preventing runaway movement.
Cabinet Components.png


Below are some pictures of the initial prototype that I have made.

Motor Power Supplies and Controllers (MMT-4Q)
20250611_143027.jpg

Control Box and LED
20250611_143024.jpg

Total Setup
20250611_143018 (1).jpg



A little bit about how this project came about.

My journey began with the noble (but misguided) goal of repairing Sega’s original motion hardware, specifically the 839-0341, 839-0430, 400-5117, and 400-5117Y boards. These power supplies and motion control units are packed with over 200 bespoke components, most of which are long obsolete. (see below).

WIN_20250528_08_52_08_Pro.jpg.626edbe941b92f9af4b96feb9549edb9.jpg

Like most people who own these cabinets, I have undertake the repairs which are well documented on the French Gamoover forums. These repairs have generally worked and I was able to fix five old Sega boards, however I was finding it more and more difficult to troubleshoot and repair the power supply boards mainly because of inconsistent IC quality and damaged, original PCBs.

At one point, I sought to completely replace the problematic Sega motor supplies by creating my own, new boards that replicated most of the original circuits, but used new, readily available ICs. This led to a prototype which you can see partially assembled in the image below. I eventually abandoned this as it was proving to be very difficult to fault-find and diagnose.

20220413_191717.jpg.bd2f4ead7153e70181b2d08a20f9cf32.jpg

The nail in the coffin for these previous attempts was two-fold. First, both repairing OR replacing the Sega motor power supplies required peope to have a working 839-0341 / 839-0430 board and second, you also needed a working G-Loc main board. Although G-Loc main boards come up from time to time, the 839-0341 board never does. Furthermore and finally, I was finding it way too time consuming to deal with the original Sega Y boards. They are complex and contain many custom chips.

Here is a link to the wiring example.

MAME and MAMEHooker
MAMEHooker (v5.1) bridges emulation and hardware by sending simple, serial commands to the Arduino. Here’s the protocol:

Command Function Example Notes
  • Q##x Set left motor target (pitch) Q18x Position: 1–32
  • R##x Set right motor target (roll) R24x Position: 1–32
  • S#x Set left motor speed (1–7) S5x 1 = slow, 7 = fast
  • T#x Set right motor speed (1–7) T4x 1 = slow, 7 = fast
  • A0x/1x Start lamp OFF/ON A1x 1 = ON, 0 = OFF
  • B0x/1x Danger lamp OFF/ON B0x 1 = ON, 0 = OFF

All commands end in x. Multiple commands can be sent in any order, each with its own x terminator. If a command isn’t sent, the last value stays in effect until updated.

Example command string sent from MAME Hooker:

Q18xR24xS5xT4xA1xB0x

This means:
  1. Move left motor to position 18
  2. Move right motor to position 24
  3. Set left/right motor speeds to 5 and 4
  4. Start lamp ON, Danger lamp OFF
How the Arduino Software Works
  • Startup & Initialization
    • Loads saved settings from EEPROM
    • Sets up pins, sensors, OLED, and waits for input
    • If test or settings switches are held, enters those modes for diagnostics or tuning
  • Calibration
    • On boot, the seat moves between limit switches on both axes to learn its safe travel range
    • Maps encoder range to a standard 1–32 scale (matching game outputs)
  • Normal Operation (Main Loop)
    • Listens for serial commands from MAME Hooker
    • Updates motor targets and speeds, as well as lamp states
    • Runs a PID feedback loop for each axis to move the seat smoothly and accurately
    • Checks all safety inputs—if anything fails, motors stop and seat is re-centered. (Still not working correctly in v41)
  • Test Mode
    • Allows manual motor movement with buttons
    • Displays live feedback from encoders and limit switches
    • Toggles lamps for diagnostics
  • Settings Mode
    • Lets you view and adjust PID/PWM settings and emergency stop logic
    • All adjustments are saved and loaded automatically
More Information?
More information can be found on the main Open Motion G-Loc thread on Aussie Arcade.

https://www.aussiearcade.com/topic/...-loc-motion-platform-project/#comment-1304263

Want to Help?
I am not a coder, nor do I do any of this type of work professionally. This is just something that I set myself as a challenge. That being said, if you would like to help and improve the software or the hardware, I would really appreciate it.

Things that will help the project;
-The project requires MAME to send motor information information to MAMEHooker. If you have knowledge of MAME source, and can add motion commands to games like Top-Speed, Chase HQ, Full Throttle, Afterburner etc, then I can likely make it work on this platform.
-The code is not very good - it works but things like motor direction are still super buggy as of v41. There is plenty of work to be done to make the code better and more robust.
-It is possible to interface Open Motion G-Loc with an original board, using some of the code that @ArcadeMachinist has made. I have only done initial implementation of this as for now, my main focus has remained on MAME implementations.
 

Attachments

  • 20250611_143018 (1).jpg
    20250611_143018 (1).jpg
    312.1 KB · Views: 34
  • 20250611_143024.jpg
    20250611_143024.jpg
    262 KB · Views: 35
following with serious interest. I'm just starting on an AB DX and anything like this is super informative.
 
Nice. I have an Afterburner Commander which I am planning on doing as well. If someone can get the outputs into MAMEHooker then I can have a crack.
 
Update - Version 43 Released!
Version 43 of the G-LOC Motion Platform Controller is now available for download.

https://github.com/BertyB3/OpenMotionGLOC

This release addresses several motor control issues and improves safety systems. If you've been experiencing motors moving to the wrong positions on startup or getting stuck at limits, this update should resolve those problems.

Supported Games


  • G-Loc
  • Strike Fighter

What's New in V43
This release addresses several motor control issues and improves safety systems. If you've been experiencing motors moving to the wrong positions on startup or getting stuck at limits, this update should resolve those problems.

Major Bug Fixes

  • Fixed: Motors going to position 32 instead of center (16) on startup
  • Fixed: Motor polarity confusion causing incorrect movement directions
  • Fixed: Motors getting stuck at limit switches and unable to recover
  • Fixed: Emergency stop recovery issues
  • Fixed: System freezing during boundary sensor events
Enhanced Safety Features

  • Dual E-Stop Recovery Methods: You can now clear an E-Stop either via:
    • MAME Hooker "Start Lamp" command (A1) - automatic recovery
    • Manual SPEED button press - immediate manual recovery
  • Improved Boundary Sensor Handling: Non-blocking logic that won't freeze your system
  • Better Limit Switch Protection: Motors now properly back away from limits instead of fighting them
  • Enhanced Emergency State Management: Clear visual feedback on what's happening and how to recover
Motor Control Improvements

  • Smart Motor Polarity Detection: Automatically handles different motor wiring configurations
  • Enhanced Movement Logic: More predictable and reliable motor positioning
  • Improved PID Integration: Better response and stability during gameplay
  • New Safety Functions: Automatic limit recovery and enhanced protection systems
Feedback
This has been a significant rewrite of the core motor control logic. Please let me know how it works for you. If you encounter any issues or have suggestions for future improvements, feel free to reach out.
 

OPEN Motion G-LOC — v50 Release Notes​


After much work I am happy to release version 50 of Open Motion G-Loc.

The big news is that this now works with MAME and ORIGINAL PCBs! So far I have only been able to test using an original G-Loc, but I suspect that Strike Fighter behaves the same way.


There is an auto-detect mode for Serial (MAME) or Parallel (OG Hardware). You can also force either mode when compiling or via Serial Command.




What’s New (since v43)​


  • Native Parallel bus input from an original Sega PCB using the 25-pin connector (outbound comms use active-LOW, 7-bit).
  • STROBE on INT0 (D2) with an ISR ring buffer for robust edge capture. Builds upon the work of ArcadeMachinest and cleans up the data stream.
  • Auto edge select at boot (~0.8 s sweep compares FALLING vs RISING on strobe, chooses cleaner one).
  • Triple-sample majority vote per edge for noise rejection.
  • Busy-poll fallback window (200 µs) alongside ISR path to avoid missed decodes.

Sega code map
  • 0–31 → Right (R) position 1–32
  • 32–39 → Right speed 1–7
  • 64–95 → Left (Q) position 1–32
  • 96–103 → Left speed 1–7

Runaway guard
  • Incoming position 32 commands are ignored.
  • Prevents attract-mode extremes (possibly intentional in Sega hardware, more analysis needed).



Bus Debugging Helpers​

Send via Serial Monitor. Note: may break connection with MAME Hooker if running in Serial mode.
  • BUSON / BUSOFF (periodic monitor)
  • BUSREAD (one-shot)
  • BUSPIN (pin map)
  • BUSFALL / BUSRISE (force preferred edge)
  • BUSMS<number> (monitor interval)

Motion / Safety Quality-of-Life​

  • Polarity-aware limit checks.
  • Limit recovery with short cooldown to avoid chatter.
  • Timeout recentres both axes to 16 with clear logs (Serial and Parallel).

Status Bus Back to Main PCB (Open-drain Emulation)​

  • Mirrors limit switch state from Arduino to PCB using A2..A10 as digital I/O.
  • “1” = hi-Z (PCB pull-ups HIGH).
  • “0” = sinks to LOW.

Source Selection (Serial vs Parallel)​


Compile-time (FORCE_INPUT_SOURCE):
  • 0 = Auto by pin 23 (LOW = Parallel, HIGH = Serial)
  • 1 = Serial only
  • 2 = Parallel only (default)

Runtime over USB:
  • MODEP = Parallel
  • MODES = Serial
  • MODEA = Auto

Breaking Change — Serial Baud Rate​

  • v50/51a uses Serial.begin(115200) (v43 was 9600).
  • Update MAMEHooker INI to 115200, 8-N-1.
If you insist on 9600, change the sketch back, but keep BUSON sparse at low baud.

Wiring Changes​


See updated diagrams:


1) Left (Q) motor limits moved (to free D2 for STROBE):

  • Q Upper limit: D2 → D32
  • Q Lower limit: D3 → D37

2) Sega Parallel bus (active-LOW):

  • Bit0 + STROBE → D2 (INT0)
  • Bit1 → D47
  • Bit2 → D48
  • Bit3 → D50
  • Bit4 → D30
  • Bit5 → D29
  • Bit6 → D28

3) Status bus (Arduino → PCB, open-drain on A-pins):

  • UR (R upper limit) → A3
  • LR (R lower limit) → A4
  • UL (Q upper limit) → A5
  • LL (Q lower limit) → A6

Limit Switch Handling (v50/51a)​

  • Expected: NC to GND with INPUT_PULLUP (LOW = clear, HIGH = triggered/open).
  • Pin changes (Q only): Upper → D32, Lower → D37.
  • Right motor remains D4/D5.
  • Boot-time: any HIGH input halts firmware with “LIMIT SWITCH ERROR”.
  • Calibration: drives to lower then upper, records encoder min/max, recentres.
  • Runtime gating: PID intent + polarity correction, requires matching limit LOW.
  • Recovery: nudges away from triggered limit every ~500 ms.
  • Drift correction: snaps encoder to learned min/max when a limit is HIGH.

Parallel Mode — Quick Start​

  • Wire bus as per table (common ground).
  • Keep FORCE_INPUT_SOURCE = 2 (Parallel only) or set = 0 for Auto.
  • Power on: OLED shows SRC: PAR and strobes per second.
  • Use BUSREAD/BUSON for verification.
  • If noisy: try BUSFALL/BUSRISE, check grounds, shorten strobe wiring.

OLED & Diagnostics​

  • OLED shows SRC: PAR|SER and live strobe counter.
  • BUSPIN prints pin map.
  • BUSMS<number> sets bus monitor interval.

Advanced Tuning​

  • Parallel timing: PAR_SAMPLE_DELAY_US (8), PAR_VOTE_SPACING_US (5), PAR_BUSY_WINDOW_US (200), PAR_POST_DECODE_US (6).
  • Edge sweep: autoSelectStrobeEdge(800) (increase if PCB is quiet at boot).
  • Active-LOW: PAR_BUS_ACTIVE_LOW 1.
  • Status bus: ENABLE_STATUS_BUS 1 (set 0 to disable).

Migration Checklist​

  • Update MAMEHooker to 115200 baud.
  • Move Q Upper Limit Switch → D32, Q Lower → D37.
  • Wire 7-bit bus (bit0+STROBE on D2).
  • Hook up status bus A2..A6 to PCB if needed.
  • Confirm edge selection and BUSREAD/BUSON.

Known Quirks​

  • Some PCBs barely tickle STROBE in attract. Edge choice may mis-select. Force with BUSFALL/BUSRISE.
  • Position 32 ignored by design (runaway prevention).
  • If no bus/serial data for ~5 s → recentres to 16 with logs.
 
Thank you. I appreciate the kind words.

One more thing to add about v50.

The motor polarity code is still not great. There are a few different approaches to motor polarity in the code that have emerged as I have built new features on the top of old features.

I am working on a major code clean up for the next release that improves this by reducing the various motor polarity implementations down to one consistent approach. This will also entail a new and improved calibration mode.
 
Back
Top