Starting to get the hang of plugging these sensors in. I wanted to do a quick post about the KY017 Mercury Sensor.
I found that it wasn't documented well and even the sensor itself, I wasn't sure which was Gnd, which was data and power. Given that one pin said '-', I assume that is ground (see I'm learning). The right most pin said 'S' But I plugged that into my GPIO13 pin. Therefore the middle pin, is power so I plugged that into the '+' line.
What confirmed that it worked, is that I actually plugged into my breadboard with the jumpers. That means I can move the sensor around. When the little ball of mercury hit the right side (closest to the board), a light light up on the sensor.
Sensor Pointing Under Horizontal
Sensor Pointing Over Horizontal
Jumpers Plugged In
Notice the Black jumper on the right and it's plugged into the '-' line. That plugged into the '-' on the sensor. The Yellow jumper is plugged in the middle pin on the sensor.
import RPi.GPIO as GPIO
print "Program Cancelled..."
The Python code, as you can see above has something plugged into GPIO27 for output. That's a Piezo thing I plugged on. So basically, when the mercury sensor points down, the Piezo makes a clicking sound,.