Mintice Red Cover Rocker Toggle Switch SPST For Arduino Review and Code

This post talks about using the Mintice Red Cover Rocker Toggle Switch SPST with the Arduino.

Mintice Red Cover Rocker Toggle Switch SPST

The Mintice Red Cover Rocker toggle switch is a standard SPST switch. Before being able to toggle the switch the red rocker cover must be lifted up and locked into place. Once this is done you will be able to turn the switch on. When the rocker cover is pulled down the switch will automatically be turned off.

SPST stands for single-pole single-throw, which is the simplest method of switching, having two pins on the switch. When the switch is off the pins are fully disconnected. When the switch is toggled the connection is made between the two pins.

These switches are rated for 12 volts, 20 amps which means they can be used for higher voltage and amperage applications.

Wiring it up to an Arduino

To wire up the switch to an Arduino you will need one 10k ohm resistor.

One pin of the switch is connected to the 5 volts and the other is attached to the digital in pin and a 10k resistor. The other side of the 10k resistor is connected to ground to complete the circuit.

The 10k resistor acts as a pull-down resistor to ensure that the digital input is pulled to ground when the switch is off.

Programming the Arduino with the Mintice Switch

To check the state of the switch I only need to use one digital pin.

#define SWITCH_PIN 2

void setup() {
  Serial.begin(115200);
  pinMode(SWITCH_PIN, INPUT);
}

void loop() {
  int btnState = digitalRead(SWITCH_PIN);
  Serial.println(btnState);
  delay(100);
}

Here I configure the switch pin, pin 2, to be used as a digital input in the setup function. In addition to this, I also configure the serial connection to log the information.

In the main loop the state of the switch is read using digitalRead which returns either 0 or 1. Once the value has been read it is printed to the serial connection.

Final Review

This switch has a very nice physical action when lifting the cover and pressing the switch. Since it is rated at 12 volts, 20 amps this can be used for higher voltage applications as well as using it as above, with an Arduino.

For some applications, the fact that it turns off when the cover is closed may be problematic however, this can be a useful feature.

I really like the look and feel of this switch, and, while pricier than standard SPST switches the style of these are well worth it.

Would buy again!

Leave a Reply

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