Difference between revisions of "Tilt Sensor/Switch Brick"

From ITEAD Wiki
Jump to: navigation, search
(Demo)
(Download)
Line 63: Line 63:
  
 
==Download==
 
==Download==
 +
[ftp://imall.iteadstudio.com/Electronic_Brick/IM120710019/DS_IM120710019.pdf Datasheet for Tilt Sensor/Switch Brick]
 +
 +
[ftp://imall.iteadstudio.com/Electronic_Brick/IM120710019/SCH_IM120710019.pdf Schematic for Tilt Sensor/Switch Brick]
 +
 +
[ftp://imall.iteadstudio.com/Electronic_Brick/IM120710019/DEMO_IM120710019.zip Demo code for Tilt Sensor/Switch Brick]
  
 
==Useful Links==
 
==Useful Links==

Revision as of 06:02, 27 May 2014

Overview

Tilt switch.jpg

Electronic brick of tilt switch can be connected to analog I/O port and used in tilt sensor for smart car or robot. When the sensor is in the horizontal position, the output is high level; when the sensor rotates counterclockwise to form an angle of more than 15 ° with the horizontal line, the output is low level.

Features

1. Plug and play, easy to use. Compatible with the mainstream 2.54 interfaces and 4-Pin Grove interfaces in the market. IM120710019_2.jpg

2. With use of M4 standard fixed holes, compatible with M4-standard kits such as Lego and Makeblock. IM120710019_3.jpg

Specifications

PCB size 24.0mm X 21.0mm X 1.6mm
Working voltage 3.3 or 5V DC
Operating voltage 3.3 or 5V DC
Compatible interfaces 2.54 3-pin interface and 4-pin Grove interface(1)

Electrical Characteristics

Parameter Min. Typical Max. Unit
Working voltage 3 5 5.5 VDC
Digital output voltage(VCC=5V) 0 - 5 V
Working current(VCC=5V) - 450 - uA

Demo

Connect S port of electronic brick of tilt switch to D2 port of Arduino board, and we will use the following program to read its digital value. When the digital value read is high level, LED lamp will be ON; when the digital value read is low level, LED lamp will be OFF.

 int tilt=2;     //connect tilt to D2
 int LED=13;
 void setup()
 {
 pinMode(LED, OUTPUT);
 pinMode(tilt, INPUT);  
 }
 
 void loop()
 {
 if(digitalRead(tilt)==HIGH) //when the digital output value of tilt is high, turn on the LED.
 {
   digitalWrite(LED, HIGH);   
 }
 if(digitalRead(tilt)==LOW)  //when the digital output value of tilt is low, turn off the LED.
 {
   digitalWrite(LED, LOW);
 } 
 }

Download

Datasheet for Tilt Sensor/Switch Brick

Schematic for Tilt Sensor/Switch Brick

Demo code for Tilt Sensor/Switch Brick

Useful Links