A Tilt sensor is a switch device that detects the change of orientation of an object and gives its output High or Low signal. The mercury tilt switch module uses a small mercury ball that open or close the circuit when you tilt the module. The output is HIGH when the mercury ball closes the circuit, and LOW when the mercury is placed away from the circuit
This module consists of a mercury switch, a 680 ohm resistor and an LED that will light up when tilt is detected. The mercury ball will open or close the circuit when the module is rotated or tilted. It has 3 pins, namely: signal (S), VCC and the GND. The signal pin should be connected to any digital pin of arduino. The VCC pin will be connected to the 5V of Arduino and the GND pin will be connected to the GND of the Arduino.
See below for the code example to test the Mercury Tilt Switch module
Upload and test the code in Arduino. The light on of led will turn on when the module is tilted. Enjoy tilting!
The Knock Switch Sensor Module (also known as Tap Module) is a mechanical sensor that detects knock or tap or vibration. It is almost the same behavior with our previous article using the Shock Switch Module. The only difference is that you have to apply more pressure or knock the module to trigger the desired output. The default desired output is LOW level (same with Shock Switch Module). This mechanical knock sensor in the module contains a coiled spring in a clear plastic housing and a pull-up resistor.
Note: If you want to reverse the desired output, from LOW level to HIGH level, you just interchange the connection of the GND and the power line (middle pin).
Code example for Knock Sensor Module
Upload the code to Arduino and test the knock sensor module. Tap harder. Once it detects the impact, the LED will turn on.
A key switch module is a push button device that would provide an output HIGH signal when the button has been pressed. The module contains a tactile push button switch and a resistor.
Upload the code and test the module. The LED should turned on when the button has been pressed, and turned off when it is not pressed.
Do you want to control your appliances at home like electric fan? Controlling the power of your stereo or any electronic computers in your room? Then you may consider using the relay module. The relay device is a switch that can control the higher voltage devices by applying an input 5V voltage to relay. The relay is electrically operated by an electromagnet that act as a switch, where it magnetized or pulls a contact when a 5V source apply into to this electromagnet.
As you can see the figure above, the relay can accommodate a maximum of 250V AC with 10A or 30V DC with 10A. The relay module has three pins from one side, dedicated for the external appliances connections (NO, NC, common), and another three pins from another side, for Arduino connection ("S", middle, and "-"). To control your appliances (a 220-volt appliances), you may use or cut one of its wire and connect the one end to the normally open (NO) pin and the other end to the middle (Common) pin. The normally close (NC) is normally not used, unless you want to power-up your appliances if Arduino is not working or turned off.
Warning: Make sure that you follow the instruction and you know how to use and connect the 220 wire to the relay device that I explained.
Sample code for Relay module
Upload the code above and check the relay module if it is working. The appliances should run for 1 minute and it will run again after 30 seconds. Enjoy controlling your appliances!
The touch sensor is a type of sensor that detects the touch of the hand or finger. The module produce a signal output if the metal pike of the sensor was touched. there's a built-in potentiometer where you can adjust the touch sensitivity. Turning the trimmer of the potentiometer to right (clockwise), the touch sensitivity increases, and it decreases when you turn it counter-clockwise. There are two built-in leds in the module, to shows the sensor has power voltage, and the sensor detects the touch.
See the code below for testing the functionality of the metal touch sensor module.
Code sample for analog and digital output of metal touch sensor module
Upload the code to Arduino and test the module. When you touch the metal sensor, the new value will display to serial monitor for analog output, and HIGH value will be displayed for the digital output.