Tilt Sensing with the RPI-1031 + Arduino

Once in a while something comes out that I think is going to be really awesome, but when you get it, it is just so so. Im sure you all know what I mean… But yeah… This is one of those.

The RPI-1031 available from sparkfun is a pretty simple (heck, it is dead simple) sensor for sensing when it is tilted. And it does this really well. But it seriously only does that. If it is not tilted, it freaks out and reports tilt anyways.Tilt Sensing with the RPI-1031 + Arduino

It actually just uses a metal ball that rolls around inside (you can hear it moving around when you tip it). Because of how it is made, the ball is always up against one side even when it is flat. Unfortunately this means you can never know the difference between a reading, and it being flat, only changes in reading.

Hooking it up

This is as simple as it gets I guess. Just power and ground, then connect the 2 digital pins and you are done. These 2 digital pins will output LOW/LOW, LOW/HIGH, HIGH/LOW and HIGH/HIGH depending on the wall it is touching. Again, even if it is flat, it is still touching a wall.Schematic Tilt Sensing with the RPI-1031 + Arduino

Code

The code for this guy is really simple, it just checks 2 pins, to see what side is being touched – The simple function just takes the 2 digital outputs and returns 0,1,2 or 3 depending on the side.

For more detail: Tilt Sensing with the RPI-1031 + Arduino 


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top