Skip to product information
1 of 8

vendor-unknown

Interfacing Tilt sensor with Arduino Uno showing output on led -KT759

Interfacing Tilt sensor with Arduino Uno showing output on led -KT759

SKU:KT759

1000 in stock

Regular price Rs. 750.00
Regular price Sale price Rs. 750.00
Sale Sold out
Shipping calculated at checkout.

For refund/return/replacement, call us at +91 95995 94524 For bulk and B2B enquiries kindly mail us at support@rees52.com

  • Fast Shipping
  • Affordable Price
  • Support
View full details

KIT INCLUDED:


HARDWARE REQUIRED

SOFTWARE REQUIRED

Arduino IDE 1.8.5 (programmable platform for Arduino)

Click To Download :https://www.arduino.cc/en/Main/Software



PIN DESCRIPTION

TILT SENSOR



LED



CIRCUIT CONNECTION

The tilt sensor module can be connected to Arduino using suitable jumper wires. First of all connect the power supply lines; VCC and GND of the module to 5V and GND of the Arduino respectively. Next link the digital output (DO) of the module to digital pin 2 (D2) and analog output (AO) to analog input 0 (A0) of the Arduino. The whole hardware should be powered by a 9V DC / USB source through the DC IN /USB socket of the Arduino board. Keep the tilt switch position in an upright position as indicated in the figure shown below.

CODE



This example code wakes the onboard indicator (LED at D13) of the Arduino when a tilt is inputted by the tilt sensor module through the occupied digital input (D2). Just copy-paste this code into your Arduino IDE, compile, and upload it to your Arduino as usual.

const int statusLED = 13;

const int switchTilt = 2;

int val = 0;

void setup(){

pinMode (statusLED,OUTPUT);

pinMode (switchTilt,INPUT);

}

void loop(){

val = digitalRead(switchTilt);

if (val == HIGH){

digitalWrite(statusLED,HIGH);

}

else {

digitalWrite(statusLED,LOW);

}

}

Note that this code does not include a “software-debounce” feature commonly used with button/switch inputs. This is not necessary here because the tilt sensor module have a built-in (1ms) “hardware debounce” arrangement using a simple RC network (R-10K & C-100n).