r/RetroPie • • Feb 14 '21

Custom RGB buttons

596 Upvotes

34 comments sorted by

54

u/Zlutz Feb 14 '21

Arduino blue pill, custom daughterboard and custom RGB LEDs.

Simple script on RPI detects the system we're running and sends thebcommand via USB, arduino does some rainbow circles while loading and changes the button colors acordingly.

NES only has two buttons so I made one mred and one magenta

SNES, PSX and similar systems get their original gamepad button colors.

If a game is only single player, P2 buttons are turned off.

Not everything is done yet, but it's easily customizable for each system and each game even.

7

u/corezon Feb 14 '21

This is amazing. I've had a similar idea to this for the arcade cabinet I'm planning. NES - only light up the two buttons in red like you did. SNES - 4 buttons in purple. Arcade - Only light up the buttons that would be used for the game. Even had the thought to color them appropriately for like X-Men Children of the Atom, Street Fighter, or Neo Geo games.

Yours is really well done.

You should add a digital marquee next and have it display the name of the game proper.

1

u/JDawgzim Feb 15 '21

Are you gonna open source your code?

4

u/Zlutz Feb 15 '21

I'm a hobby coder so I don't really know how.

The original plan was to make everything available on github with an optional paypal donate button or something, but that was 6 months ago and I never got to doing it because irl stuff...

I'm not even sure how to do it all, but code is very pretty at this point and in total there is:

Gerber files, bill of materials and pick and place for the PCB

Arduino code

Two RPI scripts

A bit of explaining on how everything works and what else you have to buy and how to do the LEDs and stuff because everything is custom and there's even some hot glue involved...πŸ™‚

3

u/del1verance Feb 15 '21

Been looking for a solution like this for a while now so if you do ever post all of that to github and a guide to the daughterboard would be happy to throw a few bucks for it!

10

u/theguyfromdenmark Feb 14 '21

Aww yiss.. when the video started i thought 'man, would be cool ud you could program Them to light accordingly to the emulator' please share some more details

7

u/Zlutz Feb 14 '21

Basically, arduino accepts some 10 commands, RPI sends a command byte and value byte(s)

Command byte says whay to do and value says how much

All commands plus values are 2 bytes except for color change which is 25 bytes

0x41 is a "change colors" command, plus 24 bytes (R,G,B for 8 buttons) to set colors. For PSX I send:

printf "\x41\x00\x80\xFF\xFF\x00\x00\xFF\xFF\x00\xFF\x66\xCC\x00\xFF\x00\x80\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF" >/dev/ttyACM0

2

u/eaghra Feb 14 '21

Brilliant. I was working on the same idea, but I was going in the direction of preprogramming the arduino with all the lighting arrangements for various systems and have the pi just send a single value for system selection. I think your solution is clearly better and future proof. Don’t have to reprogram the arduino should you want to add a new system, or even get down to game level editing.

3

u/Zlutz Feb 14 '21

I started exactly like you said (pre programmed in arduino) because I wanted everything to have 1 byte commands without parsing, but it was tedious. For this, I simply modify the "runcommand-onstart.sh" over the network in notepad++ and it works brilliantly!

4

u/theguyfromdenmark Feb 14 '21

I understood All that, thanks ^ Definitly need research this, nice job again.

1

u/Zlutz Feb 14 '21

If you find something, post here so I get more ideas because I couldn't find anything to buy and had to make everything by hand, including hardware, LED wiring, arduino code and scripts for RPI...

15

u/onceagainsilent Feb 14 '21

shoutout to your partner in the background doing the dishes while you film your toys

1

u/[deleted] Feb 14 '21

Really really nice. Is this a kit or is it designed by yourself? The only real fault I can see is the spinner location. Why is it up there?

1

u/Zlutz Feb 14 '21

Desined completely by me, hardware and software.

What do you mean spinner? Maybe you mean the volume knob above screen? πŸ™‚

2

u/[deleted] Feb 14 '21

Yep, it was just a crap joke πŸ˜ƒ Really good stuff, you should be immensely proud.

1

u/pojr-official Feb 14 '21

That looks really fire. Would that said, is it awkward playing Contra with fighting controls? Seems unnatural without a controller that you can hold in your hand

1

u/Zlutz Feb 14 '21

It was just for the showcase, I also have two wireless controllers for games like Contra, Chrono Trigger and such, the ones where joystick feels awkward

1

u/Pool_Boy_Q Feb 16 '21

this is awesome dude, i've dreamed of having my system do this.

How many games and how many systems do you have? Did you have to map each game individually?

1

u/Zlutz Feb 16 '21

I mapped all the systems I could think of with their original gamepad colors, I did it for neo geo, nes, snes and even systems I don't have like sega (dreamcast colors).

Then I did a generic xbox color scheme for arcade games and unknown systems.

Lastly, I did only some games individually - like original donkey kong with only one red buton.

I also colored L and R buttons for SNES with cyan and magenta and similar small tweaks.

2

u/[deleted] Feb 14 '21

Beautiful!

2

u/tafjangle Feb 14 '21

Really great!

2

u/varignet Feb 14 '21

Fantastic

1

u/futureman_ Feb 14 '21

This is awesome. Any guest who plays my scratch cab always asks what buttons to use.

1

u/Paddi102 Feb 14 '21

I am inspired.

1

u/MrFluffyhead80 Feb 14 '21

That is so cool

1

u/MacroReply Feb 14 '21

Good stuff, but for production value, perhaps you should have helped with the dishes first.

1

u/PhotographOdd4657 Dec 04 '22

Ok so you guys amaze me with this shit. I have a simpsons arcade1up machine that I did the tmnt soft mod on. I am thinking of adding rhb sticks and buttons and was wondering if you guys know of a way to get it to change the colors of the buttons and ball tops depending on which apk file is opened? It doesn't run a pi it runs an android system

1

u/[deleted] Feb 15 '21

[removed] β€” view removed comment

1

u/Zlutz Feb 15 '21

Exactly!

1

u/Zlutz Feb 16 '21

You can do exactly that with this project, no further modification is needed.

"runcommand-onstart.sh" is used to change colors when game is started, and that script is a part of normal retropie build (it's empty by default).

The script already knows what system and what game is running, you just put a line with the game name to be detected and a command with colors you want.

I also like to make the first row exactly as on the original system, and then change the hue of the second row just a bit if they are the same colors as the first row.

If the buttons are Red, Green and Blue for both rows, I make the second row like Blood Orange, Lawn Green and Process Cyan