Junlinto 45mm Push Arcade Button 12V Power LED For Arduino Review and Code

This post talks about how you can use the Junlinto 45mm Push Arcade Button 12V Power LED with an Arduino.

Junlinto 45mm Push Arcade Button 12V Power LED

This 45mm push button is a relatively standard button for an arcade machine.

Inside of the button is a white LED which can be lit up independently of the button being pressed.

Pressing the button toggles a SPST switch which is exposed at the bottom of the housing.

The two tabs on either side of the switch are the positive and negative terminals of the inner LED. For me the red side was positive and black negative however the LED polarity can be flipped around if needed.

This LED can be accessed by twisting the black top slightly and will easily come off. This allows you to place the button on the top of your design and re-attach the switch below. This allows fitting the button flush on your design or raised with the provided collar.

In addition to this the LED can be replaced once the housing is removed if you wish to replace the LED.

The LED and switch is rated for 12 volts and the LED has an internal resistor attached.

The other two pins are the C (common) and NO (normally open) pins of the switch. This means that when the button is not pressed it will not be connected.

Wiring it up to an Arduino

On this image I am displaying the LED and the switch as two separate components. This is so its clearer what we are wiring up.

The LED is wired directly to the GND and the digital pin on the Arduino. For this example I am using digital pin 8. Since the LED already includes an internal resistor we do not need any resistors with this.

I am using the digital pin so we can programatically turn on the LED when the button is pressed.

The Common terminal of the switch is attached to the 5 volt line. The Normally Open pin on the switch is attached to digital pin 7 and a 10k resistor.

This resistor is in turn attached to the GND on the Arduino. This works as a pull-down resistor to stop the value floating.

Programming the Arduino with the Junlinto 45mm Push Arcade Button 12V Power LED

We are going to program the Arduino to turn the LED on when the button is pressed. This will give the user indication that the button is being pressed.

In addition to this the button state will be written to the serial line.

#define SWITCH_PIN 7
#define LED_PIN 8
 
void setup() {
  Serial.begin(115200);
  pinMode(SWITCH_PIN, INPUT);
  pinMode(LED_PIN, OUTPUT);
}
 
void loop() {
  int btnState = digitalRead(SWITCH_PIN);
  if(btnState) {
    digitalWrite(LED_PIN, HIGH);
  }else{
    digitalWrite(LED_PIN, LOW);
  }
  Serial.println(btnState);
  delay(100);
}

In this example first the two digital pins we are going to use are defined so we can use the string throughout the program.

In the setup phase the serial connection is established and the two pins are set to INPUT for the switch and OUTPUT for the LED.

In the loop the switch is read and if the button is pressed the LED pin is set to HIGH. If the button is not pressed then the LED will be set to LOW. Finally the button state is written out to the serial.

Final Review

This arcade style button really allows you to create a fun button which can easily be configured to light when pressed.

The internal resistor on the LED and the nice feel of the button makes it simple and easy to use with an Arduino or any other IoT device.

Would buy again!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.