Leonardo Arcade controller with LEDs


This is my first project so I apologize for my nobby questions.

I'm currently at the step of buying components.

Right now I have:
1 Leonardo
8 buttons with 12V LED (8 switches)
1 8-way joystick with 12V LED (4 switches)
1 12V power supply
some cables + connectors

So my project consists of lighting the LEDs with the PC "game" and react to the button presses.
I would like to make something similar to the "reaction games" that you can find in some arcades where you need to hit the button that lights up. Like whack-a-mole but with LEDs.

There are 20 I/O on the Leonardo. I was thinking to use 8 for the buttons, 8 for the button LEDs and 4 for the joystick (no space for the joystick LED :sob: )

So my questions are more related on how to wire this up. I have no experience doing something like this.

First, my LEDs are specified as 12V, so I should probably use the power supply to power them. What are the downsides of not using the power supply, or plugging the power supply to the Leonardo instead of using it as an external power supply?
If I understand correctly I would need 1 Mosfet for each LED to control it using digital I/O while feeding it the 12V. Could someone recommend what mosfet to use?
How would I connect all the LEDs to the same power supply but with different I/Os? I have only found examples with 1 LED strip, 1 mosfet, and 1 12V power supply, not more.

Next, I saw that most projects with LEDs have resistors. How do I choose the correct resistor and where should I connect them?

Finally, I want to control the LEDs from the PC "game" how would that work. I would make it using the game engine Unity. Is there a way to control the Leonardo I/O from the PC, if so how?

Is it recommended to get a breadboard for prototyping? My main concern is how I am supposed to wire everything up since I kind of forgot all my analog electronics knowledge (which was never brilliant). I think I can figure out the programming stuff, somehow.

Thank you for your time, I look forward to your replies.

Being as you are so NEW...

Perhaps getting a power source that is rated for 5v.. and either different buttons..or checking to see if its just a resistor thing that makes them accept/require 12v..

If you had normal leds.. that are (normally/roughly) 3.3v in nature (required forward voltage.. little less for reds..etc) you could eliminate all the transistors/mosfets... and have a more direct project to work with..

As far as resistors go..

1.) ALWAYS use a resistor

2.) Calculate the required resistor value by using an LED calculator

  • source voltage = battery/power source
  • diode forward voltage = voltage your LED spec sheets it needs
  • diode forward current = current your LED spec sheets it needs (usually 20mA tops for most accent leds)

3.) Resistor can go on either leg..

As far as your Unity engine questions..... no clue.. Probably better served asking the questions over in their developer forums..


Thank you for the reply.
I contacted the button supplier asking for more details on the LEDs since there's not much on their product page.

and thank you for the Led resistor calculator it is very useful.

If it turns out they are 3.3V and 20mA do I need an external power source or will the Leonardo board be able to light the LEDs on its own?

Now the only thing I do not understand is how to control the LED from the controller. I would have one I/O for each LED. So I would connect the LED to one Port and ground.
But now if I use an external power supply I need to connect the LED to three things, I/O, ground and power. I do not know how to connect these.

Would you be so kind as to point me to some documentation or tutorials where I can learn more about how to connect LEDs. By googling I only found specific projects or people using RGB, LED strips, or controlling multiple LEDs with a single I/O.

Thank you for your time

If the LED is rated for 12V then it already has a built in resistor, so you might want to replace that resistor with one of a suitable resistor for 5V operation. Then you would not need an external supply.


I got confirmation that the LED is 12V and 20A. That's all they could say.

I think I will use the external power supply simply because the LED are going to be behind semi-transparent plastic and I need it to be very bright. I would be Lighting 9 of these. I'll use a mosfet for each of the 8 LEDs that I want to control using the controller.

In some designs I saw that some people use resistors for switches. Is that necessary?

Using fritzing (Fritzing) really helped me out understanding how I could connect some of these things.

Once I finish making up the digital breadboard connections I'll post it here for some more specific feedback.

Thank you

I got confirmation that the LED is 12V and 20A. That's all they could say.

Let’s assume that it is 20mA. But if that is all they could tell you it is a bit pathetic. Have you a link to this switch? Most of the switches with LEDs I have seen can have a resistor simply swapped out. Well simple if you can solder.

in some designs I saw that some people use resistors for switches. Is that necessary?

No. Assuming that is a resistor from input to ground and then a switch between input and 5V then that is a bad way of connecting an input. You should use the switch between input and ground and enable the internal pull up resistors with a pinMode(3,INPUT_PULLUP) if you are using pin 3 as an input.


I bought it from a chinese website. I believe the manufacturer is BLEE. They make a lot of arcade related hardware. I looked around but all I could get is that their Leds are 12V...

Here is the link: 10cm Arcade Push Buttons Hot Selling 10cm Pushbutton Switch China Popular 100mm Game Machine Pushbutton - Buy 10cm Arcade Push Buttons,10cm Pushbutton Switch,100mm Game Machine Pushbutton Product on Alibaba.com

Once I actually get my hands on the LEDs I'll probably be able to tell if they come with a resistor. Anyways I think it is more prudent for me to not swap out anything and just use them as is.

So here is the wiring I would be going for:

As you said I connected the switch to the input and the ground.

Assuming the LEDs come included with a resistor and are 12V and 20mA (they told me 20A but I assume that was a typo), do you think the wiring is viable?

If so then I'll search how to choose an adequate logical level MOSFET

Thank you

Yes those sort of switches have a resistor solders into the LED lead.

As to the proposed wiring that is a total disaster, you have no current limiting resistor on the power indicator LED. It is a physical layout diagram and they are always impossible to read. Think of them as wiring only diagrams, we need to see a schematic to see if the circuit is correct.

You connect the +5V to a blue line and ground to a red line on the bottom bus bars but you have this swapped over on the top bus bars. That is going to confuse the hell out of you.