User Tools

Site Tools


2019_cargo_present_sensor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
2019_cargo_present_sensor [2019/02/21 23:32] – [Inverting the sensor output] tell2019_cargo_present_sensor [2019/02/24 22:51] (current) – [combining open-drain outputs to make a logic gate] tell
Line 64: Line 64:
 ===== An inverter with one transistor ===== ===== An inverter with one transistor =====
  
 +Here's the basic idea:
 +
 +{{ :mosfet-inverter.png |}}
 +
 +The 2n7000 is a "mosfet", a type of transistor.  It has three terminals:
 +  * Source, (pin 1 above) which we connect to ground, or the most negative voltage.
 +  * Gate (pin 2), an input.  Voltage on the gate controls current flow between the other terminals
 +  * Drain (3), into which current can flow
 +
 +When the gate is connected to a positive voltage (with respect to the source) the source and drain are connected, and current flows from drain to source.   This causes the output to be low, because any current flows to ground.
 +
 +When the gate is low (near ground potential or zero volts) the transistor is off, and the pullup resistor 
 +provides a tiny bit of current to pull the output up to a 5 volts, representing a logic 1.
 +
 +For a few more details on discrete mosfets for logic, see [[mosfet hints]].  For a lot more info, see https://en.wikipedia.org/wiki/MOSFET
 +
 +
 +===== combining open-drain outputs to make a logic gate =====
 +
 +{{ :mosfet-nor.png?400 |}}
 +
 +Finishing up:
 +
 +Instead of pullup resistors, we can use a resistor in series with an LED.  In fact, we can connect the output of this gate to one of our [[DIO tester and breakout]] boards.
 +
 +If we build anything with mosfets as a standalone board, we never want to connect a mosfet gate only to an input connector (as drawn above for clarity).  The input resistance of a fet gate is so high that can stay charged to either a logic high or low or somewhere in between.  We always want to use either a pullup or pulldown resistor on a mosfet gate that would otherwise connect only to an off-board connector.  Of course, if an LED is also connected to that input, it will serve to pull the mosfet gate to a defined value.  Merging this gate circuit into the DIO tester board would also do that.
2019_cargo_present_sensor.1550809956.txt.gz · Last modified: 2019/02/21 23:32 by tell