Story
Basic circuit for different types of sensors [DIY]
Hi!
I present a circuit that can work with several types of sensors, very useful for DIY projects with Arduino.
The semi-adjustable potentiometer is included in the resistive divider next to the sensor. Changing the resistance of the potentiometer causes the current to change through the sensor, therefore, the sensor is inserted with a resistor of 150 ohms, to limit the current through it. The advantage is that, using the potentiometer, the analog voltage can also be adjusted at the A0 output. Another difference is the connection of the sensor to the inverter input of the comparator, so to pass D0 in logic state 1, the voltage drop on the sensor must fall below the voltage given by the divider R6-R2 (half the supply voltage). Therefore, this type of module is suitable for sensors whose resistance decreases (for example a thermistor with a negative temperature coefficient, whose resistance is inversely proportional to temperature), even a reed magnetic switch can be used as a sensor. The following modules are built according to the diagram shown: flame sensor (infrared light), touch sensor, sound sensor with small microphone, temperature sensor, sensor with magnetic switch, sensor with large microphone, magnetic field sensor (Hall).
P.S. I'm not the original author of this circuit, I just drew it.