LoPy + NPN Transistor + Ratiometric Sensor
-
Hi all,
I'd like to use an NPN transistor to switch a 3-wire ratiometric depth sensor. This will be for a remote sensing application where there will only be battery power.
I'm happy with the circuit, which will essentially consist of the following:
https://drive.google.com/file/d/12dS4cT9PYJwJD4lgy872UdlRTb3DlDjh/view?usp=sharingBase of NPN connected to Pycom Digital Pin through a resistor (to trigger)
Emitter connected to groundRatiometric sensor -ve connected to NPN Collector
Ratiometric sensor +ve connected to 3V3
Ratiometric Sensor signal connected to Pycom Analogue PinI'm happy with the above, as it's a standard NPN setup, however I'm worried about how the ratiometric sensor will react to being tied to ground, through the transistor.
The sensor has an output type: 10...90% of Vs (3V3) to detemine the depth (between 0-2.5m), however this is of course with reference to ground.
Am I right in thinking that the ground potential of the sensor will be 0.7V higher than the ground potential of the Pycom, therefore the readings will be off by 0.7V?
I could combat this by using a PNP transistor as then the grounds for both will be at the same potential, but then likewise my voltage reference will be 3V3-0.7V?
Alternatively, I could use a relay, but I'd be worried about the power consumption. Any thoughts welcome!
-
@robert-hh - Further to this - I actually haven't got the sensor to hand (awaiting shipment), but once it arrives, I'll measure the current draw at 3V3 to confirm that the datasheet is accurate.
-
@joearkay Yes, then you can drive that directly from an output Pin. So I assume, you want to switch it to save power.
-
@robert-hh Thanks for the message. From the datasheet, the sensor only draws ~1.5mA. Considering the LoPy can drive a load of around 12mA I may actually be ok just driving this directly from a digital pin? I could put a current limiting resistor in series to protect the pin, but otherwise, this may be the simplest solution?
Diagram below:
https://drive.google.com/file/d/1TmE-ulGR9s9a7mh2CFjcRc2YaHuIrYuj/view?usp=sharing(P.s.: Why can't I upload images to the forum? Says I don't have the correct permissions)
-
@joearkay What kind of sensor is this, and how is the current consumption?
Instead of a NPN transistor you could also use a N-Channel CMOS. They are available with very low Drain-Source resistance. Even a plain vanilla type like the 2N7000 has an ON resistance of about 2 Ohm. Other models are in the mOhm range.
-
Just some further thoughts:
I've been mulling this over, and the voltage to the sensor may vary slightly - I can't figure out a stable way of knowing the voltage reference to the sensor, which I'll need when calculating depth from the voltage output from the sensor.
Perhaps it might be better to use a mechanically-latching dual coil relay. A single pulse on one coil would latch it open, I then take the measurement, and close the contacts by pulsing the other coil. This way, there is a direct 3V3 path to my sensor.
Thoughts?