Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Adding Race Leader lights - advice needed  (Read 7455 times)

0 Members and 1 Guest are viewing this topic.

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1758
  • Last login:April 21, 2024, 08:06:32 am
  • Is running at 15kHz
Adding Race Leader lights - advice needed
« on: December 17, 2022, 05:16:05 am »
Possibly not the best forum for this; feel free to move...

I'd love to add Race Leader lights to my side by side driving setups but i have no idea where to start. The few youtube tutorials i've seen appear to jump spectacularly into the middle and thus make no sense to me. I'd like to be able to use one of the five-dollar arduino micros i have to do the job. Surely i don't need something like an LED Blinky or LEDwiz, right?

Any good guides to starting from scratch? As in, i have a MAME cab, it has no outputs set up and i have bought no hardware related to that. I'm aware that Howard's awesome MAMEhooker exists, but that's it. I have no idea how to set up anything.
« Last Edit: December 18, 2022, 04:46:09 am by buttersoft »

Super-Becker

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 93
  • Last login:Today at 01:11:34 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #1 on: December 17, 2022, 11:26:41 am »
I'm glad someone brought this up here. I would love to rise to Reace Leader especially in San Francisco Rush. I also have no idea how to do it. Although there is a video explaining it, I didn't understand anything.

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:April 22, 2024, 01:51:33 pm
Re: Adding Race Leader lights - advice needed
« Reply #2 on: December 18, 2022, 02:50:38 am »
I am not sure if this is what you are looking for, but I think it could be a good start for your arduinos.
I wrote years ago a guide on how to bring MAME outputs to the real world. Take a look eventually.
It's in my mother language: nothing a good online translator could not take care of.
Even if the guide is built around MAME, most concepts and methods apply to any other emulator with outputs support

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1758
  • Last login:April 21, 2024, 08:06:32 am
  • Is running at 15kHz
Re: Adding Race Leader lights - advice needed
« Reply #3 on: December 18, 2022, 04:50:18 am »
Cheers, i'll take a look! Certainly can't set me back any further than i already am :D

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9403
  • Last login:Today at 10:06:39 am
  • Designated spam hunter
Re: Adding Race Leader lights - advice needed
« Reply #4 on: December 18, 2022, 10:01:09 am »
Another possible approach for games like F1 Super Lap that don't have leader lamps, but do display the position number on the screen is to use a LUA plugin script to read the memory location(s) and send a lamp signal via the output system to MAMEHooker.



The details of how to make this approach work are far beyond my abilities, but someone like Jon (10yard) could probably pull it off.


Scott
« Last Edit: December 18, 2022, 10:09:49 am by PL1 »

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1758
  • Last login:April 21, 2024, 08:06:32 am
  • Is running at 15kHz
Re: Adding Race Leader lights - advice needed
« Reply #5 on: December 18, 2022, 05:07:01 pm »
Thank you, Scott. I was really using race leader lights as an example, i'm not quite sure how far i'll go. I'm still confused though.

... send a lamp signal via the output system to MAMEHooker.

I know that you hook outputs using MAMEhooker (possibly adding Boomslang's output blaster if on TP). I might be able to figure that part out, but i'm confused by how MAMEhooker then sends those signals to an external physical device. Does it have a fixed list of LED controllers? Can it connect to an Arduino or any other microprocessor board?

Google doesn't seem to be helping me, here. As stated, i'd love a woe-to-go example, or at least one that assumes i have MAME or M2emu working, and just want to add lights. I'll give Baritonomarchetto's link a look soon. (I'm actually on hols right now, just thought i'd start the planning :)


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:April 21, 2024, 11:59:54 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Adding Race Leader lights - advice needed
« Reply #6 on: December 18, 2022, 07:12:51 pm »
Go to my website and follow along with the tutorials.

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9403
  • Last login:Today at 10:06:39 am
  • Designated spam hunter
Re: Adding Race Leader lights - advice needed
« Reply #7 on: December 18, 2022, 07:31:02 pm »
i'm confused by how MAMEhooker then sends those signals to an external physical device. Does it have a fixed list of LED controllers? Can it connect to an Arduino or any other microprocessor board?
The basic process works something like this for the leader lamps on the Daytona cab marquee:
(LMK if I get something wrong here, Howard.)



1. On the 2 Player cab, there are bulbs behind "Race Leader" on the P1 side and P2 side.
- You can see them in the schematic on page 65 (left side, middle) of the manual here.
- As you can see in this video of the cab in attract mode, the "Race Leader" lamps for each side are independently controlled by the PCB.



2. When MAME emulates Daytona on your PC, it sends status commands to particular variables/RAM addresses(?) via the MAME output system indicating whether the lamps are on or off.
- NOTE: Output system must be set to "windows" in mame.ini.

3. MAMEHooker monitors those variables/RAM addresses(?) to receive those lamp status commands and translate them into USB commands for a supported LED controller (or Arduino with a compatible firmware) to turn a particular channel on/off.

4. The LED controller (or Arduino with a compatible firmware) turns that channel on/off which either lights/extinguishes an LED or energizes/de-energizes a relay that lights/extinguishes a lamp or LED cluster that draws too much current for the controller to provide directly.


Scott

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1758
  • Last login:April 21, 2024, 08:06:32 am
  • Is running at 15kHz
Re: Adding Race Leader lights - advice needed
« Reply #8 on: December 19, 2022, 05:18:36 am »
Much appreciated Scott, and thanks Howard as well, not to mention for the software ;)

I'll dive into this in more depth when i get back from holidays. Hope you guys have a good break too, and i hope you're doing well, Howard!

EDIT: ok, back from holidays, children happy, bank accounts drained, one ear infection recovered from!

I have tested now, and am able to fire the ardunio pins from MAMEhooker grabbing outputs from GroovyMAME 2.50. First hurdle overcome! I'll go on to other emulators and problems from here. Thanks to all, especially baritonomarchetto for that guide, that was great :)

Hope everyone else's holidays were more restful than mine, but just as much fun :)
« Last Edit: January 04, 2023, 05:15:22 am by buttersoft »

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1758
  • Last login:April 21, 2024, 08:06:32 am
  • Is running at 15kHz
Re: Adding Race Leader lights - advice needed
« Reply #9 on: January 24, 2023, 07:24:46 pm »
Ok, things are moving, but i'm having a few issues. I can hook supermodel, but if i turn on "enable title bar hooking" it names the emulator but not the rom, and uses it's default ini (will MH always find that default.ini? I ask for reasons). With that unchecked, it names the rom just fine. Is that reversed? on another note, should TP ini files go under the last folder used? In this case the MAME folder? Also, i cannot for the life of me hook m2emu. The title bar for example only says "Daytona USA" with no emu name. I've tried adding it as a standalone game, and it finds the game, but there are no outputs listed. Is there a setting in the emu itself i've failed to change, like there is for supermodel outputs?

I might beg and pretty please ask someone with M2emu, Supermodel, and ideally some TP games, to please zip up working mamehooker ini and settings folders and link them? I'd love to check to see if i've missed anything :/

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #10 on: January 25, 2023, 03:51:39 pm »
Possibly not the best forum for this; feel free to move...

I'd love to add Race Leader lights to my side by side driving setups but i have no idea where to start. The few youtube tutorials i've seen appear to jump spectacularly into the middle and thus make no sense to me. I'd like to be able to use one of the five-dollar arduino micros i have to do the job. Surely i don't need something like an LED Blinky or LEDwiz, right?

Any good guides to starting from scratch? As in, i have a MAME cab, it has no outputs set up and i have bought no hardware related to that. I'm aware that Howard's awesome MAMEhooker exists, but that's it. I have no idea how to set up anything.

I have thought about doing this to my twin San Franciso Rush cab build so the race leader lights up for whoever is in first (or leader of the two racers if not a ton of code). What device are you using to light up though? Short of buying an old Rush light or a Daytona USA topper with race leader lights on it, are you seeing anything you can purchase that will light up like those? I am guessing this applies to people who have old racing cabinets and not modded from scratch ones?

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9403
  • Last login:Today at 10:06:39 am
  • Designated spam hunter
Re: Adding Race Leader lights - advice needed
« Reply #11 on: January 25, 2023, 05:13:07 pm »
i have a MAME cab
What device are you using to light up though?
As mentioned earflier, he's using an Arduino.

Short of buying an old Rush light or a Daytona USA topper with race leader lights on it, are you seeing anything you can purchase that will light up like those? I am guessing this applies to people who have old racing cabinets and not modded from scratch ones?
This brings up the question of whether this can be done on original PCB systems.

For systems using emulation, the preferred approach is the one Buttersoft is using: emulator ==> outputs ==> MAMEhooker ==> Arduino/controller ==> lights.

Disclaimer:  I haven't looked at availability/pricing of original leaderboards or if repros are available, so you might want to check that before diving into the processes described below.   :dunno

If you want to create a leaderboard for original PCB systems from scratch, you would need to find the outputs from the original PCB.
- For example, see step 1 of reply 7 above where I link to the "race leader" lamps in the Daytona schematic.

Those outputs will likely work in one of four ways:
1. The output is designed to directly drive the lamp.
- No need for more power or logic handling, just connect the lamp.   ;D.
- According to the schematics, Daytona is like this.

2. The output is designed to directly control the lamp.
- Needs more power but no logic handling.
- Add a driver circuit (MOSFET? Relay?) and connect the lamp.

3. The output is designed to work with an external logic PCB to control the lamp.
- Probably needs more power and logic handling.
- You'll need to safely connect those PCB outputs to an Arduino.
- Write a sketch to translate those PCB outputs into light outputs.
- Use some sort of driver to power those light outputs since the lamps will almost certainly draw more current than the Arduino can provide.

4. The outputs are on a data bus.
- You're on your own, son. [/Blazing Saddles]   :lol


Scott

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #12 on: January 25, 2023, 10:03:57 pm »
What device are you using to light up though?
As mentioned earflier, he's using an Arduino.
I don't mean what is he using to process the code to light up the device, I mean what is the target device that is being lit up that looks nice and says "Leader".  IE a Dayton USA topper with race leader, an oem SF Rush "Leader" below marquee light, etc. I cannot find a single example of a pre-built aftermarket product that adds "Leader" type light boxes or even someone who custom built one. If I missed any please do let me know where you have seen them as this has a lot of potential. I may have to make a light box myself with a custom marquee type print I guess. I checked eBay real quick and I see nothing at all whether aftermarket or original arcade leaderboard lights.

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #13 on: January 25, 2023, 10:08:44 pm »
This just gave me an idea... I could have an extra green led bulb in the marquee of each cab and when that racer is in 1st, it turns on the green led bulb so the marquee turns green. I just have no clue if a green led bulb would look right and shine brightly on a regular marquee. Of course it would not say "Leader" either.

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9403
  • Last login:Today at 10:06:39 am
  • Designated spam hunter
Re: Adding Race Leader lights - advice needed
« Reply #14 on: January 25, 2023, 11:08:26 pm »
I don't mean what is he using to process the code to light up the device, I mean what is the target device that is being lit up that looks nice and says "Leader".
I just have no clue if a green led bulb would look right and shine brightly on a regular marquee.
I have no idea what specific lamps/LEDs will work with whatever form of leaderboard anyone would want to use.   :dunno
- Start with the desired board design and test various lamps/LEDs/dividers to find what looks good.
- Whatever lamps/LEDs look good, choose a way to drive them.  Depending on the voltage/current requirements, you might be able to use a MOSFET or a relay.


Scott

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1758
  • Last login:April 21, 2024, 08:06:32 am
  • Is running at 15kHz
Re: Adding Race Leader lights - advice needed
« Reply #15 on: January 26, 2023, 12:28:39 am »
Just to add it back again...

I'm struggling! Any chance someone with M2emu, Supermodel, and ideally some TP games, could please zip up working mamehooker ini and settings folders and link them? I'd love to check to see if i've missed anything :/

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #16 on: February 07, 2023, 07:07:31 am »
Just to add it back again...

I'm struggling! Any chance someone with M2emu, Supermodel, and ideally some TP games, could please zip up working mamehooker ini and settings folders and link them? I'd love to check to see if i've missed anything :/
Did you have any luck? I will be doing this at some point as well and can share if no one has anything by then.

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1758
  • Last login:April 21, 2024, 08:06:32 am
  • Is running at 15kHz
Re: Adding Race Leader lights - advice needed
« Reply #17 on: February 07, 2023, 05:51:09 pm »
Boom kindly replied to me on discord. Easiest way to do it is to use his FFB plugin for m2emu, and check the enable outputs box in there.

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #18 on: March 21, 2023, 12:21:30 pm »
Boom kindly replied to me on discord. Easiest way to do it is to use his FFB plugin for m2emu, and check the enable outputs box in there.
Awesome. Do you have a couple example ini files you can upload? I realize the com port and little things will change but at least it would be a good head start. I just bought everything to make a race leader light and I will make a post with exactly how I am doing it and how I am making the race leader light. There is so little info on this I figure I need to get it to a point where someone can easily copy it and not spend hours researching and still not find much.

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1758
  • Last login:April 21, 2024, 08:06:32 am
  • Is running at 15kHz
Re: Adding Race Leader lights - advice needed
« Reply #19 on: March 21, 2023, 09:23:48 pm »
So you run MAMEhooker as admin, set mame path and enable hooking. Then, I hope Baritonomarchetto's is ok with me cribbing from his post and site(http://forum.arcadecontrols.com/index.php/topic,167200.msg1761662.html#msg1761662)

Quote
/*
Arduino - Mamehooker outputs read setup sketch

This sketch lets Arduino read outputs signals from
Howard Casto's Mamehooker.
Pins from #2 to #13 are set to outputs and can be used
to send hardware outputs signals.
Here is an example of mamehooker .ini code
(message sent to Arduino serial port COM4):

[General]
MameStart=cmo 4 baud=9600_parity=N_data=8_stop=1
MameStop=cmc 4
StateChange=
OnRotate=
OnPause=
[KeyStates]
RefreshTime=
[Output]
lamp0=
lamp1=cmw 4 3., cmw 4 %s%, cmw 4 x
lamp2=cmw 4 4., cmw 4 %s%, cmw 4 x
lamp3=cmw 4 5., cmw 4 %s%, cmw 4 x
lamp4=cmw 4 6., cmw 4 %s%, cmw 4 x
lamp5=cmw 4 7., cmw 4 %s%, cmw 4 x
lamp6=cmw 4 8., cmw 4 %s%, cmw 4 x
lamp7=cmw 4 9., cmw 4 %s%, cmw 4 x
lamp8=cmw 4 10., cmw 4 %s%, cmw 4 x
lamp9=cmw 4 11., cmw 4 %s%, cmw 4 x
lamp10=cmw 4 12., cmw 4 %s%, cmw 4 x
lamp11=cmw 4 13., cmw 4 %s%, cmw 4 x

Code adapted from fruit-emu.com (majoris and eric)

by Barito, 2018
*/

int pin;
int value;

void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);

Serial.begin(9600);
}

void loop(){
while (Serial.available()>0){
pin = Serial.parseInt();
value = Serial.parseInt();
if (Serial.read() == 'x'){
digitalWrite(pin, value);
}
}

The actual arduino code is the part from "int pin;". Before that in an example ini file. When you run a MAME game and everything is set right, MAMEhooker generates an ini file with the same name as the game zip. That way you know what the outputs are called. Outrunners is a side-by-side driving game running from a single board. One instance of the game is for two players, and generates the orunners.ini file below, to which has been added some com port config info to start and stop things.

Quote
[General]
MameStart=cmo 9 baud=9600_parity=N_data=8_stop=1
MameStop=cmc 9
StateChange=
OnRotate=
OnPause=
[KeyStates]
RefreshTime=
[Output]
MA_Check_Point_lamp=cmw 9 2., cmw 9 %s%, cmw 9 x
MA_Race_Leader_lamp=cmw 9 6., cmw 9 %s%, cmw 9 x
MA_Steering_Wheel_motor=
MA_DJ_Music_lamp=
MA_<<_>>_lamp=
MB_Check_Point_lamp=cmw 9 4., cmw 9 %s%, cmw 9 x
MB_Race_Leader_lamp=cmw 9 5., cmw 9 %s%, cmw 9 x
MB_Steering_Wheel_motor=
MB_DJ_Music_lamp=
MB_<<_>>_lamp=

MAMEhooker sends a message each time the state of one of those outputs changes - as long as there's any instructions next to that output. in this example the com port is configured up the top, and the Leader and Checkpoint lamps for P1 and P2 are sending data over it. So, each time the MA checkpoint lamp turns on or off it writes "2." to com port 9, then writes the state of the lamp (%s%) to com port 9, then terminates (x's) the com port write). The arduino code, above, reads the serial message, and acts on it to turn on an output.

The MAMEhooker docs folder goes into much more detail about different devices and different commands and ways to use them. Most TP games, M2emu, and others can be directly seen by MAMEhooker once you turn outputs on in either TP itself, or Boom's FFB plugin. Howard's site contains info about titlebar hooking for emulators/games that MAMEhooker doesn't automatically see, like Supermodel.

Note that an arduino can't deliver much current. You should use transistors or relays to deliver more. Baritono's site linked above provides some options for doing that.
« Last Edit: March 22, 2023, 01:57:08 am by buttersoft »

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #20 on: April 01, 2023, 10:02:42 am »
So you run MAMEhooker as admin, set mame path and enable hooking. Then, I hope Baritonomarchetto's is ok with me cribbing from his post and site(http://forum.arcadecontrols.com/index.php/topic,167200.msg1761662.html#msg1761662)

Quote
/*
Arduino - Mamehooker outputs read setup sketch

This sketch lets Arduino read outputs signals from
Howard Casto's Mamehooker.
Pins from #2 to #13 are set to outputs and can be used
to send hardware outputs signals.
Here is an example of mamehooker .ini code
(message sent to Arduino serial port COM4):

[General]
MameStart=cmo 4 baud=9600_parity=N_data=8_stop=1
MameStop=cmc 4
StateChange=
OnRotate=
OnPause=
[KeyStates]
RefreshTime=
[Output]
lamp0=
lamp1=cmw 4 3., cmw 4 %s%, cmw 4 x
lamp2=cmw 4 4., cmw 4 %s%, cmw 4 x
lamp3=cmw 4 5., cmw 4 %s%, cmw 4 x
lamp4=cmw 4 6., cmw 4 %s%, cmw 4 x
lamp5=cmw 4 7., cmw 4 %s%, cmw 4 x
lamp6=cmw 4 8., cmw 4 %s%, cmw 4 x
lamp7=cmw 4 9., cmw 4 %s%, cmw 4 x
lamp8=cmw 4 10., cmw 4 %s%, cmw 4 x
lamp9=cmw 4 11., cmw 4 %s%, cmw 4 x
lamp10=cmw 4 12., cmw 4 %s%, cmw 4 x
lamp11=cmw 4 13., cmw 4 %s%, cmw 4 x

Code adapted from fruit-emu.com (majoris and eric)

by Barito, 2018
*/

int pin;
int value;

void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);

Serial.begin(9600);
}

void loop(){
while (Serial.available()>0){
pin = Serial.parseInt();
value = Serial.parseInt();
if (Serial.read() == 'x'){
digitalWrite(pin, value);
}
}

The actual arduino code is the part from "int pin;". Before that in an example ini file. When you run a MAME game and everything is set right, MAMEhooker generates an ini file with the same name as the game zip. That way you know what the outputs are called. Outrunners is a side-by-side driving game running from a single board. One instance of the game is for two players, and generates the orunners.ini file below, to which has been added some com port config info to start and stop things.

Quote
[General]
MameStart=cmo 9 baud=9600_parity=N_data=8_stop=1
MameStop=cmc 9
StateChange=
OnRotate=
OnPause=
[KeyStates]
RefreshTime=
[Output]
MA_Check_Point_lamp=cmw 9 2., cmw 9 %s%, cmw 9 x
MA_Race_Leader_lamp=cmw 9 6., cmw 9 %s%, cmw 9 x
MA_Steering_Wheel_motor=
MA_DJ_Music_lamp=
MA_<<_>>_lamp=
MB_Check_Point_lamp=cmw 9 4., cmw 9 %s%, cmw 9 x
MB_Race_Leader_lamp=cmw 9 5., cmw 9 %s%, cmw 9 x
MB_Steering_Wheel_motor=
MB_DJ_Music_lamp=
MB_<<_>>_lamp=

MAMEhooker sends a message each time the state of one of those outputs changes - as long as there's any instructions next to that output. in this example the com port is configured up the top, and the Leader and Checkpoint lamps for P1 and P2 are sending data over it. So, each time the MA checkpoint lamp turns on or off it writes "2." to com port 9, then writes the state of the lamp (%s%) to com port 9, then terminates (x's) the com port write). The arduino code, above, reads the serial message, and acts on it to turn on an output.

The MAMEhooker docs folder goes into much more detail about different devices and different commands and ways to use them. Most TP games, M2emu, and others can be directly seen by MAMEhooker once you turn outputs on in either TP itself, or Boom's FFB plugin. Howard's site contains info about titlebar hooking for emulators/games that MAMEhooker doesn't automatically see, like Supermodel.

Note that an arduino can't deliver much current. You should use transistors or relays to deliver more. Baritono's site linked above provides some options for doing that.

Awesome! How did you get Mamehooker to send serial commands to the Arduino? I have a led strip configured via my Arduino nano to turn on and do various effects that look great. I also have it so that in the Arduino ide serial monitor I can send “6.,1,x” to turn on the led strip and “6.,0,x” to turn it off which works great. I also have mamehooker configured and I can see the games lamps changing as expected in the mamehooker debug window but no matter what I do, Mamehooker sends nothing to the Arduino. I have tried:

1) Mamehooker as right click admin and as regular open and with hooking
2) Tried multiple games that all show fine in debug window
3) Go to test option in mamehooker to get around ini games and send test commands but nothing is sent
4) Tried a 2nd computer
5) tried a different ch340 driver on the second computer
6) Read the install doc again
7) Created bat to open Mamehooker and set Mamehook.exe to admin option in properties

Yours just sends serial commands without anything else? Am I missing something stupid? You can just go to the test menu in Mamehooker and send “cmw 4 6., cmw 4 %s%, cmw 4 x” and it works fine changing the 4’s to your com port?

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1758
  • Last login:April 21, 2024, 08:06:32 am
  • Is running at 15kHz
Re: Adding Race Leader lights - advice needed
« Reply #21 on: April 02, 2023, 06:46:11 am »
i haven't actually tried the command interface in MAMEhooker itself. But it works as shown, yes. I program the arduino with that code, and then script the orunners.ini file as so.

Have you tried programming only that code onto your arduino, and leaving the rest out, for testing?

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:April 22, 2024, 01:51:33 pm
Re: Adding Race Leader lights - advice needed
« Reply #22 on: April 02, 2023, 09:05:52 am »
Launch mamehooker with admin privileges only the first time you run it. Then there's no more the need for admin privileges (it could be detrimental after first run, not sure why but I can confirm I had problems in more than one PC when admin priv. were given).

Is mamehooker sending serial messages to the correct COM port? It must be the arduino's COM port
« Last Edit: April 02, 2023, 09:14:23 am by baritonomarchetto »

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #23 on: April 02, 2023, 04:56:13 pm »
Thanks guys. Mamehooker was working fine and it was my Arduino code. I downloaded Serial Port Monitor (free 14 day trial) and I was able to use the Mamehooker test menu (after a few opening and closing ports to still monitor but not conflict on the port) to validate that my mamehooker test was using 6 followed by a 1 (or 0 for off) followed by an x. Whereas my arduino test was sending "6,1,x" all at once and my parsing of the code used a comma. Anyhow I fixed the code and we are in business. I will post a tutorial with all of my code and how exactly I am did all of this once I have it finalized. Thanks!
« Last Edit: April 02, 2023, 04:58:24 pm by jorgenjl2 »

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:April 22, 2024, 01:51:33 pm
Re: Adding Race Leader lights - advice needed
« Reply #24 on: April 03, 2023, 01:22:51 am »
You were not using the code buttersoft linked you, then, being that tested and working...

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #25 on: April 03, 2023, 09:28:55 am »
You were not using the code buttersoft linked you, then, being that tested and working...

Correct. Besides a missing bracket at the end (your pages code was fine), the code ran fine but did not turn on the led strip. I quickly realized the digitalwrite I think it was would not work for an led strip and was more for an led. The good news is my method requires no mosfets, special circuits, etc. It also requires no soldering. Obviously there are different use cases though.

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:April 22, 2024, 01:51:33 pm
Re: Adding Race Leader lights - advice needed
« Reply #26 on: April 04, 2023, 02:23:56 am »
You can bet a microcontroller GPIO is not capable to drive a led strip: it outputs 20-50 mA (depending on the pin). That's why no loads other than small leds are commonly seen in arduino's examples: they absorb 5-20 mA max, depending on the current limiting resistor value used
« Last Edit: April 04, 2023, 02:25:28 am by baritonomarchetto »

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #27 on: April 04, 2023, 07:08:44 am »
You can bet a microcontroller GPIO is not capable to drive a led strip: it outputs 20-50 mA (depending on the pin). That's why no loads other than small leds are commonly seen in arduino's examples: they absorb 5-20 mA max, depending on the current limiting resistor value used
It is my understanding that the Arduino gives up to 500ma which in the examples I have seen can run a very small number of leds (<10 even though I saw examples where people ran huge strips through usb and one pin only I don’t think that is recommended at all). However, in my test case so far I have 40 leds running off a 5v3amp power supply. Each led uses about 50ma (or 20ma green plus 20ma red plus 20ma blue = 60ma each led at 255 brightness white) so if my math is right that would be about 2000ma or 2 amps (up to 2.4ma full white) so leaves a little room with 3amps power supply. So far it works great.

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9403
  • Last login:Today at 10:06:39 am
  • Designated spam hunter
Re: Adding Race Leader lights - advice needed
« Reply #28 on: April 04, 2023, 10:24:43 am »
You can bet a microcontroller GPIO is not capable to drive a led strip: it outputs 20-50 mA (depending on the pin). That's why no loads other than small leds are commonly seen in arduino's examples: they absorb 5-20 mA max, depending on the current limiting resistor value used
I agree that you can't provide operating power to a string of LEDs via GPIO (red and black wires), but you can drive the data line for an addressable LED strip via GPIO. (yellow wire)
- The only downside is that the RasPi may not be able to accurately control the timing for the addressable LEDs and run other software at the same time.  For example, Sjaak wrote a skeeball program for RasPi that uses an Arduino to run the addressable LEDs as shown here.



I saw examples where people ran huge strips through usb and one pin only
Sounds like they were using USB, not GPIO pins, for the LED operating voltage and the one pin was the data line for the addressable LEDs.

if my math is right that would be about 2000ma or 2 amps (up to 2.4ma full white) so leaves a little room with 3amps power supply. So far it works great.
Sounds good.   :cheers:


Scott

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:April 22, 2024, 01:51:33 pm
Re: Adding Race Leader lights - advice needed
« Reply #29 on: April 04, 2023, 10:33:13 am »
The 500mA Arduino can provide are out of the 5V pin (after the built-in voltage regulator), not out of a GPIO. As Scott pointed out, you can drive the data line, not operating power. From what you write I argue you are using the 5V pin, but do not forget a load of some hundreds mA will drive the built-in regulator hot.
That regulator is not really intended to drive an external load, but step down the 9-12V one could use to power the arduino.
« Last Edit: April 04, 2023, 10:35:11 am by baritonomarchetto »

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #30 on: April 05, 2023, 05:23:29 pm »
Ahh I got ya now.

@buttersoft - As far as games you have so far, do you know if this is accurate so far? I have SFRush, The Rock, and SF Rush 2049 all working so far. I am in the process of downloading Output Blaster to get Teknoparrot games to work with you outputs. 

Race Leader
San Francisco Rush
San Francisco Rush the Rock
SF Rush 2049
Scud race
Daytona USA

Police lights on top
ChaseHQ2 (race leader?)

Unsure
Daytona USA 2
Daytona Championship USA
Outrun 2 SP DX
Mario Kart SP DX
Pixar Cars
Fast n Furious Super Cars

No race leader
Cruis’n USA /World
California Speed
Outrun

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1758
  • Last login:April 21, 2024, 08:06:32 am
  • Is running at 15kHz
Re: Adding Race Leader lights - advice needed
« Reply #31 on: April 05, 2023, 06:45:30 pm »
I don't have a lot of those games set up. Model 1, 2 and 3 games have leader lights, so i'm pretty sure Daytona 2 will? Virtua Racing light "led5" is the leader light for that game, i think.

Apart from that, it seems right. I was sort of planning to find out what the cab lights are for games like MKDX and WMMT5 by just programming one and seeing what happens. Then if i don't like what it does, changing which light is outputting and going again. IF you get there first, let me know :)

Fursphere

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1207
  • Last login:Today at 12:35:01 pm
Re: Adding Race Leader lights - advice needed
« Reply #32 on: April 05, 2023, 06:53:31 pm »
It looks like the vertical yellow lights on the far left and far right sides are the Daytona 2 Twin "Leader Lights" if I was to guess. 

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #33 on: April 06, 2023, 09:31:06 pm »
It looks like the vertical yellow lights on the far left and far right sides are the Daytona 2 Twin "Leader Lights" if I was to guess.
Based on the manual it looks like you are right.

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #34 on: April 06, 2023, 09:35:33 pm »
Another possible approach for games like F1 Super Lap that don't have leader lamps, but do display the position number on the screen is to use a LUA plugin script to read the memory location(s) and send a lamp signal via the output system to MAMEHooker.



The details of how to make this approach work are far beyond my abilities, but someone like Jon (10yard) could probably pull it off.

Scott

You make a great point. I wonder how hard this would be for a few small games that (as far as I know) don’t have leader lights but would be cool to have them for like Mario Kart GP DX / Outrun 2 (Tekno) or Crusn USA/World (Mame).

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #35 on: April 15, 2023, 04:42:57 pm »
Boom kindly replied to me on discord. Easiest way to do it is to use his FFB plugin for m2emu, and check the enable outputs box in there.
Did you have to do anything else to get Daytona USA model 2 (m2emu) to output? I have 1.1 m2 and I put the ffb plugin files in the same folder and enabled outputs on the misc ffb plugin screen but with Mame Hooker running and kicking off Daytona USA, the debug screen shows no items. I see old mentions of an old TP2 program and lua and ini files but I assume that is old and no longer needed for output in m2? http://forum.arcadecontrols.com/index.php?topic=155698.0

Is your mamehooker ini called Daytona.ini and what is the folder name it is in? I only have .ini, default.ini, and then a folder called MAME but no M2 etc type mamehooker folder but maybe this would auto create once I get it it going.



EDIT: It looks like m2emu also needs output blaster and the 32 bit files for Daytona. So ffb plugin has output to yes and output blaster does as well. I have mamehooker seeing it now and “M2 Emulator.ini” in the Mame mamehooker folder. I don’t yet have the debug numbers going to 1 in debug or the leds working for some reason but I will test it.
« Last Edit: April 15, 2023, 05:13:40 pm by jorgenjl2 »

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1758
  • Last login:April 21, 2024, 08:06:32 am
  • Is running at 15kHz
Re: Adding Race Leader lights - advice needed
« Reply #36 on: April 16, 2023, 02:15:05 am »
Yeah i'm a bit stuck on M2emu right now. I have the M2emulator.ini file but nothing changes state. I think i have the output files in there but will check :)

If you get it running, please let me know how :)

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #37 on: April 16, 2023, 03:51:20 pm »
Yeah i'm a bit stuck on M2emu right now. I have the M2emulator.ini file but nothing changes state. I think i have the output files in there but will check :)

If you get it running, please let me know how :)
It does not change state for me either. I tried setting the 32 bit outputblaster.ini to have outputsystem=1 or 0 and also the LF output option to 1 or 0 with no luck. The only thing I can think of is we need that TP2 program or something. I think Boomslang got it working a while ago somehow.

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:April 22, 2024, 01:51:33 pm
Re: Adding Race Leader lights - advice needed
« Reply #38 on: April 17, 2023, 01:13:15 am »
I think you guys should copy these lua scripts in M2 "scripts" folder
https://github.com/njz3/vJoyIOFeederWithFFB/tree/master/gameassets/nebula_m2_1.1/scripts

jorgenjl2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:March 07, 2024, 07:10:47 pm
  • I want to build my own arcade controls!
Re: Adding Race Leader lights - advice needed
« Reply #39 on: April 20, 2023, 08:33:02 pm »
I think you guys should copy these lua scripts in M2 "scripts" folder
https://github.com/njz3/vJoyIOFeederWithFFB/tree/master/gameassets/nebula_m2_1.1/scripts
Thanks that partially worked. It works for 1 player (Deluxe regular) Daytona USA where I can randomly see the lights coming on before the race starts but I am not good enough yet to get 1st in single player to know for sure.

In link mode (master and slave deluxe version) Daytona USA m2 does not show any debug window info at all. I verified I have ffb plugin outputs turned on and outputblaster 32 but files and ini set to outputs (both output and lf output needed in ini) enabled. Any ideas?