I am trying to use a GP1S036HEZ tilt sensor in a project, and I am having a problem reading it digitally.
Here is my hookup: Pin 1 goes to 100Ohm resistor to arduino 5v pin Pin 2 goes to ground Pin 3 goes to Analog 0 and through XXXohm resistor to ground (pulldown) Pin 4 goes to Analog1 and through XXXohm resistor to ground pin 5 goes through YYYohm resistor to 5v arduino pin.
I have varied XXX and YYY and have received all kinds of results. At first I started with XXX as a very high resistor for pulldown but then all my readings were 1000+. I did see changes when tilted but only on the order of +- 15 Then I brought XXX down to 160Ohms and got values between 0 and 24. These values changed with tilting as they should, 0:0 for upright 25:25 for upsidedown etc. If I brought XXX to 320 I would get a bigger range 25-75, and at 500ohm 75-175 but there it would start acting flakey. At the 1000ohm level I am seeing 1000 high, but around 440 low, and the change in one direction is not correct.
My thought at that point is that I am pushing too much current through and that is messing things up. So I made YYY at 1K ohms but this did nothing.
I really just want to be able to read digital HIGH and LOW but am going to need better numbers (like 1000 for high and 300 or less for low) to do that.
Did I wire up something wrong?