Author Topic: How to detect a sensor plugged in?  (Read 2675 times)

0 Members and 1 Guest are viewing this topic.

Offline cdevidalTopic starter

  • Contributor
  • Posts: 32
  • Country: us
How to detect a sensor plugged in?
« on: December 09, 2020, 09:24:58 pm »
EDIT: Nevermind! The sensor output is high when not detecting any obstruction, which is perfect. If that ever goes low it will be recorded as an obstruction, and if it stays low the user will be notified.
==
I am thinking of including an E18-D80NK infrared proximity sensor in my chicken door product, but I want to have the Raspberry Pi detect if the customer has plugged one in, or if it breaks for some reason and is no longer passing current. So I need a voltage at a clear logic high (or low). I could use an opto-isolator to detect that there is a connection but those have forward voltage of at least 0.8V. The power supply is 5V and the sensor requires 5V.

What is another way I might detect the sensor is plugged in without using any voltage? Maybe a MOSFET? I tried this Falstad but setting the voltage of the bottom resistor high enough to turn on a FET gate may have an impact on the LED transmitter's current and voltage.

If the sensor were normally-closed that would solve this problem. They only offer normally-opened so if it breaks or is disconnected, the RPi wouldn't know.
« Last Edit: December 09, 2020, 09:41:34 pm by cdevidal »
 

Offline S. Petrukhin

  • Super Contributor
  • ***
  • Posts: 1144
  • Country: ru
Re: How to detect a sensor plugged in?
« Reply #1 on: December 12, 2020, 04:23:34 am »
I use a sensor with two pairs NO/NC contacts.

For signal processing, I use NO xor NC for periodic sensors (shaft rotation, for example). In this case, a malfunction of one pair will allow you to issue a warning, but still use this sensor. For static sensors, any signal. To detect an accident, I use NO=NC. In addition, the current consumption is monitored. This is some redundancy.

Most often, it is enough to use a sensor that normally gives a signal of 1. If the wire is broken, the sensor is out of order, it will give 0, i.e. an alarm signal.

NO sensor is very bad, it can not allow itself to be detected because in a normal situation it is silent. But you can equip this sensor with a local NO/NC relay, just next to the sensor in the junction box, then you can at least control the safety of the wire and switching.

Or change the design, position of the sensor so that it is in the vehicle state under normal conditions.
« Last Edit: December 12, 2020, 04:30:16 am by S. Petrukhin »
And sorry for my English.
 
The following users thanked this post: cdevidal


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf