Tilt Sensor
|

Tilt Sensor
|
|
|
|
|
|
|
|
Primary Attribute
|
|
|
Category: Sensor, Modules
|
{{{userDefinedInfo}}}:
|
{{{userdefinedvalue}}}
|
Brand: Waveshare
|
|
|
|
|
Overview
Specifications
- Voltage: 3C ~ 5.5V
- Output Type: TTL
- Dimension: 53.0mm * 18.0mm
- Fixed Hole Dimension: 2.00mm
Applications
- Shake detection
- Guard alarm
- Smart car
- Electric bricks
Pinouts
- VCC ↔ 3.0V ~ 5.5V
- GND ↔ power supply ground
- DOUT ↔ MCU.IO (digital output)
Get Started at Pico
If you are the first time o use the Pico, you need to first learn how to get started at the Pico before you run other examples.
The Pico supports C and the Micropython which requires different firmware.
In most of the examples archives (Demo codes), we provide a Micropython firmware (uf2 file), we recommend you to use the provided firmware to test the board. Because the codes may run abnormally with different firmware.
If the board is tested to be workable, you can also download the newest firmware from Raspberry Pi and do further programming.
- If you want to use C codes, please refer to the C/C++ Guides
- If you want to use Micropython codes, please refer to the Micropython Guides.
- The link of the newest Micropython firmware of Pico
- Official Guides of Raspberry Pi Pico
Hardware Connection
Sensor |
Pico |
Description
|
VCC |
3.3V |
Power input
|
GMD |
GND |
Power ground
|
DOUT |
GP22 |
Digital output
|

Download examples
Use the Raspberry Pi as the host device. Open a terminal and run the following commands to download the example.
sudo apt-get install p7zip-full
cd ~
sudo wget https://www.waveshare.com/w/upload/b/b6/Tilt-Sensor-code.7z
7z x Tilt-Sensor-code.7z -o./Tilt-Sensor-code
Examples
C codes
cd ~/Tilt-Sensor-code/Pico/c/build
export PICO_SDK_PATH=../../pico-sdk
- Note that if the path of your SDK is different, you need to modify the command and use the correct path to export
- Generate Makefile and build
cmake ..
make -j9
- After building, a uf2 file is generated
- Press and hold the button of Pico, connect it to Raspberry Pi then release the button.
- Copy/Drag the uf2 file to the protable disk (RPI-RP2) recognized
cp main.uf2 /media/pi/RPI-RP2/
Micropython codes
- Flash the Micropython firmware first
- Open the Thonny IDE (Menu->Programming->Thonny Python IDE).
- 【Optiional】If the Thonny IDE in the Raspberry Pi is not the new version which supports Pico, please upgrade it first.
sudo apt upgrade thonny
- Configure Interpreter, choose Tools->Options... -> Interpreter, choose MicroPython(Raspberry Pi Pico) and the ttyACM0 port.

- Click File -> Open.. and browser the micropython codes (Tilt Sensor.py) to run the codes
Expected result
- When the module is shaken or tilted, the signal indicator on the module is on, and when the module is placed in parallel, the signal indicator on the module is off.
The STM32 examples are based on the STM32F103RBT6 and the STM32H743. The connection provided below is based on the STM32F103RB. If you need to use other STM32 boards, you may need to change the hardware connection and port the code yourself.
STM32
Hardware connection
Sensor |
STM32 |
Description
|
VCC |
3.3V |
Power input
|
GND |
GND |
Power ground
|
DOUT |
PA4 |
Digital output
|

Examples
The examples are developed based on the HAL libraries. Download the Demo codes archive to your PC. Unzip and find the STM32 project from Tilt-Sensor-code\STM32\STM32F103RB\MDK-ARM.
- Open the Tilt Sensor.uvprojx file by Keil
- Build and the project
- Program the project to your STM32 board.
- Connect the UART1 of your STM32 board to the PC and check the serial data by SSCOM software.

The Arduino example is written for the Arduino UNO. If you want to connect it to other Arduino boards, you may need to change the connection.
Arduino
Hardware connection
Sensor |
Arduino |
Description
|
VCC |
5V |
Power input
|
GND |
GND |
Power ground
|
DOUT |
D2 |
Digital output
|

Examples
- Download the demo codes to your PC and unzip
- Install the Arduino IDE in your PC
- Go into Tilt-Sensor-code/Arduino/Tilt_Senso
- Run the Tilt_Sensor.ino file
- Select the correct Board and the Port

- Build the project and upload it to the board.
- Open the serial monitor of the Arduino IDE or the SSCOM software and check the serial data.

Resources
FAQ
Answer:
This vibrating sensor is essentially an application of mercury switch. In a condition of vibrating or tilting, the sensor may enable the switch to close or loose.
{{{3}}}
{{{4}}}
{{{5}}}
Answer:
Perhaps you'd like:
Color Sensor
|
|
{{{2}}}
|
{{{3}}}
|
{{{4}}}
|
{{{5}}}
|
{{{6}}}
|
{{{7}}}
|
{{{8}}}
|
{{{9}}}
|
{{{10}}}
|
{{{11}}}
|
{{{12}}}
|
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{{{15}}}
|
{{{16}}}
|
{{{17}}}
|
{{{18}}}
|
{{{19}}}
|
{{{20}}}
|
{{{21}}}
|
{{{22}}}
|
{{{23}}}
|
{{{24}}}
|
{{{25}}}
|
{{{26}}}
|
{{{27}}}
|
{{{28}}}
|
{{{29}}}
|
{{{30}}}
|
{{{31}}}
|
{{{32}}}
|
{{{33}}}
|
{{{34}}}
|
{{{35}}}
|
{{{36}}}
|
{{{37}}}
|
{{{38}}}
|
{{{39}}}
|
{{{40}}}
|
{{{41}}}
|
{{{42}}}
|
{{{43}}}
|
{{{44}}}
|
{{{45}}}
|
{{{46}}}
|
{{{47}}}
|
{{{48}}}
|
{{{49}}}
|
{{{50}}}
|
Infrared Reflective Sensor
|
|
{{{2}}}
|
{{{3}}}
|
{{{4}}}
|
{{{5}}}
|
{{{6}}}
|
{{{7}}}
|
{{{8}}}
|
{{{9}}}
|
{{{10}}}
|
{{{11}}}
|
{{{12}}}
|
{{{13}}}
|
{{{14}}}
|
{{{15}}}
|
{{{16}}}
|
{{{17}}}
|
{{{18}}}
|
{{{19}}}
|
{{{20}}}
|
{{{21}}}
|
{{{22}}}
|
{{{23}}}
|
{{{24}}}
|
{{{25}}}
|
{{{26}}}
|
{{{27}}}
|
{{{28}}}
|
{{{29}}}
|
{{{30}}}
|
{{{31}}}
|
{{{32}}}
|
{{{33}}}
|
{{{34}}}
|
{{{35}}}
|
{{{36}}}
|
{{{37}}}
|
{{{38}}}
|
{{{39}}}
|
{{{40}}}
|
{{{41}}}
|
{{{42}}}
|
{{{43}}}
|
{{{44}}}
|
{{{45}}}
|
{{{46}}}
|
{{{47}}}
|
{{{48}}}
|
{{{49}}}
|
{{{50}}}
|
Laser Sensor
|
|
{{{2}}}
|
{{{3}}}
|
{{{4}}}
|
{{{5}}}
|
{{{6}}}
|
{{{7}}}
|
{{{8}}}
|
{{{9}}}
|
{{{10}}}
|
{{{11}}}
|
{{{12}}}
|
{{{13}}}
|
{{{14}}}
|
{{{15}}}
|
{{{16}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}}
|
{{{20}}}
|
{{{21}}}
|
{{{22}}}
|
{{{23}}}
|
{{{24}}}
|
{{{25}}}
|
{{{26}}}
|
{{{27}}}
|
{{{28}}}
|
{{{29}}}
|
{{{30}}}
|
{{{31}}}
|
{{{32}}}
|
{{{33}}}
|
{{{34}}}
|
{{{35}}}
|
{{{36}}}
|
{{{37}}}
|
{{{38}}}
|
{{{39}}}
|
{{{40}}}
|
{{{41}}}
|
{{{42}}}
|
{{{43}}}
|
{{{44}}}
|
{{{45}}}
|
{{{46}}}
|
{{{47}}}
|
{{{48}}}
|
{{{49}}}
|
{{{50}}}
|
Sound Sensor
|
|
{{{2}}}
|
{{{3}}}
|
{{{4}}}
|
{{{5}}}
|
{{{6}}}
|
{{{7}}}
|
{{{8}}}
|
{{{9}}}
|
{{{10}}}
|
{{{11}}}
|
{{{12}}}
|
{{{13}}}
|
{{{14}}}
|
{{{15}}}
|
{{{16}}}
|
{{{17}}}
|
{{{18}}}
|
{{{19}}}
|
{{{20}}}
|
{{{21}}}
|
{{{22}}}
|
{{{23}}}
|
{{{24}}}
|
{{{25}}}
|
{{{26}}}
|
{{{27}}}
|
{{{28}}}
|
{{{29}}}
|
{{{30}}}
|
{{{31}}}
|
{{{32}}}
|
{{{33}}}
|
{{{34}}}
|
{{{35}}}
|
{{{36}}}
|
{{{37}}}
|
{{{38}}}
|
{{{39}}}
|
{{{40}}}
|
{{{41}}}
|
{{{42}}}
|
{{{43}}}
|
{{{44}}}
|
{{{45}}}
|
{{{46}}}
|
{{{47}}}
|
{{{48}}}
|
{{{49}}}
|
{{{50}}}
|
DHT11 Temperature-Humidity Sensor
|
|
{{{2}}}
|
{{{3}}}
|
{{{4}}}
|
{{{5}}}
|
{{{6}}}
|
{{{7}}}
|
{{{8}}}
|
{{{9}}}
|
{{{10}}}
|
{{{11}}}
|
{{{12}}}
|
{{{13}}}
|
{{{14}}}
|
{{{15}}}
|
{{{16}}}
|
{{{17}}}
|
{{{18}}}
|
{{{19}}}
|
{{{20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}}}
|
{{{23}}}
|
{{{24}}}
|
{{{25}}}
|
{{{26}}}
|
{{{27}}}
|
{{{28}}}
|
{{{29}}}
|
{{{30}}}
|
{{{31}}}
|
{{{32}}}
|
{{{33}}}
|
{{{34}}}
|
{{{35}}}
|
{{{36}}}
|
{{{37}}}
|
{{{38}}}
|
{{{39}}}
|
{{{40}}}
|
{{{41}}}
|
{{{42}}}
|
{{{43}}}
|
{{{44}}}
|
{{{45}}}
|
{{{46}}}
|
{{{47}}}
|
{{{48}}}
|
{{{49}}}
|
{{{50}}}
|
|
{{{3}}}
{{{4}}}
{{{5}}}
Support
If you require technical support, please go to the Support page and open a ticket.