Arduino Mercury Switch Breakout Module

From Geeetech Wiki
Revision as of 09:48, 14 May 2012 by Admin (talk | contribs) (Usage)

Jump to: navigation, search

introduction

Tilt sensor.jpg

The Tilt sensor is a digital mercury-based tilt sensor which allows you to detect orientation and inclination. It acts like a switch. When the tilt sensor is in horizontal position, it’s open. When tilt, the switch closed and pass current.

Note

Mercury is toxic substance, Please be careful to avoid breaking the case.

Features

They are small, inexpensive, low-power and easy to use. Their simplicity make them popular for toy , gadget and appliances and many other application.

Usage

Tilt wiring.jpg

VCC - 5V GND - GND S - Digital pin3

Example code

int ledPin = 13; // Connect LED to pin 13 int switcher = 3; // Connect Tilt sensor to Pin3

void setup() {

 pinMode(ledPin, OUTPUT);      // Set digital pin 13 to output mode 
 pinMode(switcher, INPUT);       // Set digital pin 3 to input mode 

} void loop() {

  if(digitalRead(switcher)==HIGH) //Read sensor value 
    {  
       digitalWrite(ledPin, HIGH);   // Turn on LED when the sensor is tilted 
    } 
  else
    { 
       digitalWrite(ledPin, LOW);    // Turn off LED when the sensor is not triggered 
    } 

}

How to buy it

Click here to buy Tilt sensor module