Orders placed by 3:00 PM will be shipped the same day!
All Categories
Menu
Cart

The tilt sensor module is equipped with a tilt sensor and a potentiometer. You may attach it to any object and it will determine whether the object is tilted or not. It is simple as it returns a digital output. It uses SW-460D or SW-520D tilt sensor. This tilt sensor is a ball rolling type, NOT the Mercury type.

It comes with a M3 mounting hole for ease of attaching it to any object. A power LED and a status LED are attached to the module for visual indicator.

This module will output logic LOW when the sensor is tilted below the threshold angle; logic HIGH when it is tilted above the threshold angle. The threshold angle ranges from 45 degree to 130 degree. Aside from threshold angle, angular velocity also affect the tilt module. It can also be used as a vibration sensor, too!

This module can be interfaced with any microcontroller with digital input such as PIC, SK40C, SK28A, SKds40A, Arduino series for tilt detection capability. Also, not to forget, interfacing the module with a Relay module forms a tilt switch 

Features:

  • Operating voltage: 3.3 to 5VDC
  • Ball Rolling type of tilt sensor.
  • PIN: VCC = 5V, GND = 0V, DO = digital output from module
  • AO is not use in this module.


* If the DO is not working, you might need to turn the on board potentiometer to center.

Application

Introduction

As a student myself, I do not find lecture sessions to be the most entertaining thing to attend to. In fact, there are only 2 cases when lectures can be interesting: either the lecturer is super cute and handsome  or you have deep interest in that subject. Sadly, most university students suffer from sleep deprivation because they tend to stay up late the night before either to finish up assignments and projects, play games or hang out.The worse thing is if they have a 8:00AM lecture the next day. 

and slowly….. he or she becomes a sleeping beauty. It’s all cozy and nice until your lecturer bust you out. That would be embarrassing, eh?

Introducing the Lecture Alarm! An alarm that will automatically turn on whenever your head feels heavy and starts tilting.

DSC00434

Set up

Components:

  • 1X CT-UNO
  • 1X Buzzer
  • 1X 2k2 ohm resistor
  • 1X Tilt sensor module
  • 1X NPN2222 transistor
  • Male to male jumper wires
  • Male to female jumper wires
  • 1X USB Cable
  • 1X 12V DC power adapter
  • 1X half breadboard
tutorial3_bb

Set up diagram

The diagram above shows the connection of the CT-UNO, Tilt sensor module and the buzzer.

Pin connection of Tilt Sensor Module

  • The Vcc pin on the tilt sensor module is connected to the Vcc on the breadboard.
  • The GND pin on the tilt sensor module is connected to the GND on the breadboard
  • Do pin gives out digital signal and is connected to pin 3.
  • Ao is not connected.
BC547-45V100mA-NPN-Transistor-pinout

Pin connection of NPN transistor N2222

The diagram above shows the pins of the NPN transistor. Why do I use a transistor? To prevent high current sinking to occur. When dealing with buzzer, it is advisable not to connect it directly into your UNO or any microcontroller.

CT-UNO uses ATmega328p. Its maximum current per I/O pin is 40mA (Please note also: the maximum total supply is 200mA)

If you don’t know the specifications of the buzzer, you can manually measure it.

Step 1: Your buzzer should have ‘+’ terminal and ‘-‘ terminal marked. Connect the ‘+’ of the buzzer to the positive terminal of a 5V power supply

Step 2: Use a digital multimeter (DMM) to connect the ‘-‘ of the buzzer.

Step 3: The negative terminal of the DMM is connected to the negative terminal of the 5V power supply.

WP_20150317_11_05_16_Raw

Measuring the current flowing through buzzer in 5V power supply (I = 2.93mA)

We can see that the current drawn by the buzzer is 2.93mA. Although it does not exceed the current limit of one arduino I/O pin can supply, it is still safer to put a transistor.

If the buzzer draw more current than the uC I/O can supply, you can try adding a resistor according to the current, but it probably wont work or work out of the specifications. A NPN transistor will help you.

Program

[code lang=”c” highlight=””]
#define Tilt 2 //Digital output from tilt sensor module is connected to D2
#define BUZZER 3 //LED at D3 pin

void setup() {
//setup the input or output pin
pinMode(BUZZER, OUTPUT);
pinMode(Tilt, INPUT);
digitalWrite(BUZZER, LOW); //off LED
}

void loop() {
if(digitalRead(Tilt)) //if the DO from Tilt sensor is low, no tilt detected.
//You might need to adjust the potentiometer to get reading
digitalWrite(BUZZER,HIGH);
else
digitalWrite(BUZZER,LOW);
}[/code]

LCD Keypad Shield

You can also use an LCD to display some message. I am using a LCD Keypad Shield.

tutorial3_bb with keypad shield

Set up

Set up diagram with LCD Keypad Shield

NOTE: LCD Keypad Shield is using pin 4 to pin 9. Do not use these pins for other purpose.

Program

[code lang=”c” highlight=””]
/*
The circuit:
* 16×2 character LCD to ARDUINO UNO
* LCD RS pin to digital pin 8
* LCD Enable pin to digital pin 9
* LCD D4 pin to digital pin 4
* LCD D5 pin to digital pin 5
* LCD D6 pin to digital pin 6
* LCD D7 pin to digital pin 7
* LCD R/W pin to ground

Tilt Sensor module to Arduino UNO
*VCC to 5V
*GND to GND
*Do to D2
*AO of tilt sensor is not used
*/

// include the library code:
#include
#include

#define Tilt 2 //Digital output from tilt sensor module is connected to D2
#define BUZZER 3 //LED at D3 pin

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup() {
//setup the input or output pin
pinMode(BUZZER, OUTPUT);
pinMode(Tilt, INPUT);
digitalWrite(BUZZER, LOW); //off LED
// set up the LCD’s number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print(” Lecture”);
lcd.setCursor(0,1);
lcd.print(” Alarm”);
delay(1000); //delay for 1 second
lcd.clear();
}

void loop() {

if(digitalRead(Tilt)) //if the DO from Tilt sensor is low, no tilt detected. You might need to adjust the potentiometer to get reading
{
digitalWrite(BUZZER,HIGH);
lcd.setCursor(0, 0); //move LCD cursor
lcd.print(“SLEEPING”); //Display message
}
else
{
digitalWrite(BUZZER,LOW);
lcd.setCursor(0, 0); //move LCD cursor
lcd.print(“AWAKE “); //Display message
}
}[/code]

17883
Tilt Sensor Module
Tilt Sensor Module
:
30.97 TL + VAT
:
37.17 TL
Prepared by  T-Soft E-Commerce.