Difference between revisions of "Tilt Sensor"

From LinkSprite Playgound
Jump to: navigation, search
(Overview)
(Overview)
Line 1: Line 1:
 
== Overview ==
 
== Overview ==
 +
 +
A tilt sensor is a simplified accelerometer.  It is a switch that can detect basic motion/orientation. The metal tube has a little metal ball that rolls around in it. When it is tilted upright, the ball rolls onto the contacts sticking out of end and shorts them together.
 +
 +
Shown in Figure 6.1 is the tile sensor SW-460D.  The electric characteristics of this sensor are listed in Table 6.1. The minimum tilt angel of this sensor is 2-5°.
 +
 +
[[File:tilt sensor.jpg]]
  
 
== Specifications ==
 
== Specifications ==

Revision as of 09:19, 7 December 2012

Overview

A tilt sensor is a simplified accelerometer. It is a switch that can detect basic motion/orientation. The metal tube has a little metal ball that rolls around in it. When it is tilted upright, the ball rolls onto the contacts sticking out of end and shorts them together.

Shown in Figure 6.1 is the tile sensor SW-460D. The electric characteristics of this sensor are listed in Table 6.1. The minimum tilt angel of this sensor is 2-5°.

Tilt sensor.jpg

Specifications

Specificaitons of Quality

  • Working voltage: 3.3/5V DC
  • Interface types: Digital interface
  • 2.54mm general interface
  • Module conduction angle:2~5°

Module specifications

Items Min
PCB Size 2.5cm*2.7cm
Interface 2.54mm pitch pin header
IO structure IN, NC, VCC, GND
VCC 3/5V

Tilt Sensor PCB

Tilt PCB.jpg

Characteristics

Electrical Characteristics
Model Voltage Current Conduction Time Path Resistance Open Circuit Resistance Resistance To Temperature
SW-460D 12V 5mA 20mS >10M omh 10M omh 100°C

Schematic

Schematic of tilt.jpg

Programming

The program below uses the tilt sensor to control the LED.

Sample code:

<syntaxhighlight lang="c">

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
    }

}

</syntaxhighlight>