Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    LoPy + NPN Transistor + Ratiometric Sensor

    Scheduled Pinned Locked Moved LoPy
    battery poweredtransistornpnratiometricsensor
    6 Posts 2 Posters 1.2k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • joearkayJ Offline
      joearkay
      last edited by

      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=sharing

      Base of NPN connected to Pycom Digital Pin through a resistor (to trigger)
      Emitter connected to ground

      Ratiometric sensor -ve connected to NPN Collector
      Ratiometric sensor +ve connected to 3V3
      Ratiometric Sensor signal connected to Pycom Analogue Pin

      I'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!

      1 Reply Last reply Reply Quote 0
      • joearkayJ Offline
        joearkay
        last edited by

        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?

        robert-hhR 1 Reply Last reply Reply Quote 1
        • robert-hhR Offline
          robert-hh @joearkay
          last edited by

          @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.

          joearkayJ 1 Reply Last reply Reply Quote 0
          • joearkayJ Offline
            joearkay @robert-hh
            last edited by

            @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)

            robert-hhR 1 Reply Last reply Reply Quote 2
            • robert-hhR Offline
              robert-hh @joearkay
              last edited by

              @joearkay Yes, then you can drive that directly from an output Pin. So I assume, you want to switch it to save power.

              1 Reply Last reply Reply Quote 0
              • joearkayJ Offline
                joearkay
                last edited by

                @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.

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • 1 / 1
                • First post
                  Last post

                Pycom on Twitter

                Pycom