I'm working on Arduino Kit book's Project 8: the digital hourglass. I've got the picture and the circuit diagram below.

picture of the circuit

diagram of the circuit

My question is a fundamental one, and I really don't know how others figured it out. The question is: How do I correctly tie a four-pin tilt sensor to the power and to the ground? I've been through a couple of datasheets for the RBS040100 and none of them were particularly helpful in determining which pin is responsible for what. The most helpful anything has got to be is this pdf sheet where the PCB layout diagram points out an index for every pin and how the pins within the sensor are related, yet it does not explain where the power goes and where the ground is connected.

I also ran into this Arduino SE page but nobody got close to actually explaining how to use (i.e., correctly integrate) the sensor into the circuit.

I know that if you plug a capacitor in the wrong way, it may explode. By the same token I do not want to screw up the sensor or the board, but what do I know. This is the only tilt sensor I've got.

Before my board goes live, I'd like to confirm whether I have the tilt sensor connected correctly.

picture of the tilt sensor currently plugged in

Any help would be appreciated. Let me know if you need anything else for further clarification. Thank you in advance.

Edit: Here's a picture of the four-pin tilt sensor:

picture of the tilt switch

New contributor
AndrewGreen is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • the tilt sensor us most likely mechanical switch ... find two pins that open and close the circuit when the switch is moved ... connect it between a data pin and ground ... enable the pullup resistor on the data pin
    – jsotola
    Mar 16 at 5:39
  • @jsotola : This doesn't quite hit the core of the OP. At the crux of it is my ignorance of which pin is power and which is ground. Also, it is unclear to me whether there is a data pin, which is new information to me. According to the datasheet for the RBS040100, there is only a connection for the power and a connection for the ground. Nothing related to any kind of data. Mar 16 at 6:31
  • there is no power and ground connection... it's just two wires that get shorted together by a metal ball ... connect it same as a pushbutton switch ... there are many tutorials about connecting switches to an arduino
    – jsotola
    Mar 16 at 7:32
  • hold one wire in you left hand ... hold another wire in your right hand ... touch the ends of the wires together ... that is the exact same circuit as the tilt switch
    – jsotola
    Mar 16 at 7:38
  • @jsotola : Then how can any switch possibly yield an "on" signal without power and ground? No power and ground, no current. No switch output of 1 to be read, right? Mar 16 at 7:56

1 Answer 1


So I've asked this question on the Arduino.cc forum (just to get a safe answer quickly to hustle up on the project). If you look at the pins on the four-pin tilt switch with the notch facing down (as shown on the aforementioned RBS040100 datasheet's PCB layout diagram), you need to know that the connected pins 1 and 2 are to be tied to the power and the connected pins 3 and 4 are to be tied to the ground with a high-Ohm-value resistor (which will serve as a pull-down resistor, e.g. 10kOhm). That means that the "up" arrow on my pictures is indeed to face "east" (in relation to the breadboard) if northern pins are power and southern pins are grounded with a resistor. If for some reason you need it pointing "to the west", then the pins on the northern half are to be connected to ground with a good resistor and the pins to the south are to be connected to power.

updated power-ground schematic

Edit: Here are the results. Image 1 is for the first take and image 2 is for the second take after a tilt to the switch.

take one

take two

New contributor
AndrewGreen is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    if you connect one pin to power and the other to ground, then you will short circuit the power supply when the switch closes
    – jsotola
    Mar 16 at 7:40
  • @jsotola : I'm not sure if a short circuit would be possible considering that I have a 10kOhm resistor channeling the tilt sensor to the ground. Mar 16 at 7:52
  • then that side of the switch is not connected to ground ... it's connected to an input pin and to a pulldown resistor on one side and to V+ on the other side
    – jsotola
    Mar 16 at 7:54
  • @jsotola : Then what is the 10kOhm resistor even for in the first place? Because my experiments guided by the book's instructions (see the images of the results in the edit section of my answer) show something different from what you are suggesting. Mar 16 at 8:12
  • 1
    an understanding that short-circuiting a power supply is a bad thing should supercede
    – jsotola
    Mar 16 at 15:46

Your Answer

AndrewGreen is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.