1

I recently purchased four of these SW-420 based vibration sensor modules, and am following along with this question: Python code for SW-420 vibration sensor.

SW-420 based vibration sensor

I am brand new to circuitry and want to know basically how to connect the sensors to the Pi and, more specifically, can I connect them directly to the Pi? I have four sensors, I have already tried to splice four power and four ground wires from each device and connect them to the 5V and ground pins on the Pi, then connect each of the digital out pins to the gpio pins on the board.

Any input or thoughts on why my first crack at this didn't work is greatly appreciated!

  • Have you tried the 3.3v with only sensor? – zaf Feb 22 '17 at 13:36
  • 2
    WARNING If they are powered from 5V they may well output 5V. Connecting 5V to a Pi GPIO can destroy the GPIO and the Pi. – joan Feb 22 '17 at 14:06
1

Per joan's comment below the answer, you can't use 5V logic with a Raspberry Pi's GPIO pins. They're only 3.3V tolerant and have no over-voltage protection, so if you exceed 3.3V you're quite possibly looking at a fried Pi (I notice I added a similar comment to my answer to the question you've linked to).

More often than not the output voltage of a sensor like yours is determined by its input voltage. If you powered it using 5V it's likely that it was sending 5V logic back out again. This would be bad news for your Pi. It would be sensible to confirm the output voltage level of the sensor using a meter before attempting to reconnect it.

It would be worth checking that your Pi's still working as it should by running some tests on your GPIO pins. Presuming that everything's still up and running, you should connect the sensor to the Pi's 3.3V pin (rather than the 5V pin), test its output level to ensure that it's compatible with the Pi's 3.3V input requirement, then reconnect the sensor output pins to the Pi's GPIO pins and try again.

Your Answer

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.