Go Down

Topic: [solved] OJ-CG316 New Arduino Tilt Sensor Module (Read 3382 times) previous topic - next topic

cark

Apr 07, 2013, 03:24 pm Last Edit: May 14, 2013, 02:59 am by cark Reason: 1
Hello, i have found this sensor: http://dx.com/p/oj-cg316-new-arduino-tilt-sensor-module-red-176794.



The only informations are:

Quote
Features: OJ tilt sensor is direct derived by four pins; When detect a direction, connects one of the two pins of the same direction to the ground, the other joints IO mouth, and the sensor works.

Specification: Digital mode: pin definition: Sensor pin 1, 2; Sensor pin 2, 3; Sensor pin 3, 4; Sensor pin 4.

Application: Can sense 4 directions, one horizontal position; Sensor the angle title degree: 45 degrees.



I can't understand, from this informations, how use it. Someone has some experience about this sensor? Or has some idea?

Thank you!


Simone

JimboZA

#1
Apr 07, 2013, 03:33 pm Last Edit: Apr 07, 2013, 03:38 pm by JimboZA Reason: 1
I think it means that since there are 4 pins inside the white "sugar cube", depending on which way it tilts it connects 2 of the 4 pins- the ones on the "downhill" side. So for example in the picture, if it tilts down to the right, pins 2 and 4 as marked on the board would short. That would be as if you had closed a switch across pins 2 and 4 of the header. I think....

Edit... but then I'm confused about what they say about ground: 4 pins at the sugar cube and ground would need 5 pins on the header. Perhaps the mounting holes are ground- they look plated- and so the tilt is actually a "diagonal" tilt, eg down to the right and back would short pin 2 to ground. Not sure....
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

cark

Thanks for your replay, it's clear, any idea about the circuit? Which pin i have to link to the ground, and which one to the 5V? In other words, i don't understand how to alimentate the sensor and how read his values.

JimboZA

I don't think it needs 5v... it's a switch, as far as I can tell. Or 4 switches actually.

Do you have one physically?- or are you trying to figure it out from the link?

If you actually have one, you should be able to figure it out with an ohm-meter (or just a led on a battery) and see what pins and / or ground connect when you tilt it various ways. I can't tell which one is ground... maybe the holes as I said, but it's really difficult to tell.

If it is 4 pins and a ground, then I'd just connect each pin to an Arduino input with pullups enabled, and the ground to Arduino ground. Then those 4 Arduino pins will be high until one is pulled low by the sensor shorting that pin to ground. It would be 4 of these, but in the absence of a schematic on the link site, or you measuring the continuity across pins and a possible ground, I'm guessing just like you.
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

cark

Ok, thanks, i haven't one of this sensors at the moment, but now it seems a little more clear. So i'll buy one of this and then i'll share my experience ;)

cark

Hello, i found an example for this tilt sensor: http://x.openjumper.com/en/tilt/.
It is very simple, and works quite well: simply connect the four pins to four Arduino's digital pins, and run the example code.

Go Up