

A whisker limit switch is a tactile sensor that is widely used in the field of robotics and automation. It operates by making physical contact with an object through a flexible, wire-like actuator known as a whisker. This simple yet effective component is essential for providing feedback on the position of mechanical parts, ensuring precision and safety in various applications.








| Pin Number | Description | Notes | 
|---|---|---|
| 1 | Common (C) | Connect to ground or Vcc based on NO/NC configuration | 
| 2 | Normally Open (NO) | Closed when whisker is activated; otherwise open | 
| 3 | Normally Closed (NC) | Open when whisker is activated; otherwise closed | 
// Define the pin connected to the limit switch
const int limitSwitchPin = 2;
void setup() {
  // Set the limit switch pin as an input
  pinMode(limitSwitchPin, INPUT_PULLUP);
  // Initialize serial communication at 9600 bits per second
  Serial.begin(9600);
}
void loop() {
  // Read the state of the limit switch
  int switchState = digitalRead(limitSwitchPin);
  // Check if the switch is pressed (assuming NO configuration)
  if (switchState == LOW) {
    // The whisker has made contact
    Serial.println("Whisker is in contact");
  } else {
    // The whisker is not in contact
    Serial.println("Whisker is not in contact");
  }
  // Delay a bit for debounce
  delay(50);
}
Q: Can I use the whisker limit switch with an AC power source?
Q: How do I know if my switch is in NO or NC configuration?
Q: Is it possible to adjust the sensitivity of the whisker?