The Output Interface of electronic circuits, PIC's and microcontrollers allows them to control the real world by moving objects or lighting up a few lights.
As we have seen in the previous input interface training, an interface circuit allows one type of circuit to be connected to another type of circuit, which can have a different degree of voltage or current.
However, we can interface input devices such as switches and sensors, as well as output devices such as relays, magnetic solenoids and lights.Then the interface of output devices to electronic circuits is generally known as: Output Interface.
The Output Interface of electronic circuits and microcontrollers allows robots to control the real world by moving things like their engines or arms. However, output interface circuits can also be used to TURN things ON or OFF, such as indicators.Then the output interface circuits can have a digital output or an analog output signal.
Digital logic outputs are the most common type of output interface signal and the easiest to control.Digital output interfaces use controller software to convert a signal from the output port of microcontrollers or digital circuits to on/OFF contact output using relays.
Analog output interface circuits use amplifiers to produce a changing voltage or current signal for speed or positional control type outputs. Pulse output switchingis another type of output control that changes the duty cycle of the output signal for lamp dimming or speed control of a DC motor.
Input interface circuits are designed to accept different voltage levels from different sensor types, while output interface circuits are required to produce larger current driving capacity and/or voltage levels.Voltage levels of output signals can be increased by providing open collector (or open drainage) output configurations.This is the collector terminal of a transistor (or an evacuation terminal of a MOSFET) normally connected to the load.
The output stages of almost all microcontrollers, PIC's, or digital logic circuits can provide useful amounts of output current or resources to switch and control a wide range of output interface devices to control the real world.When we talk about sinking and welding currents, the output interface can both "give" a switching current (source) or "absorb" (sink) a switching current.This means that depending on how the load is connected to the output interface, a HIGH or LOW output will activate it.
Perhaps the simplest of all output interface devices are those used to produce light as a single ON/OFF indicator or as part of a multi-part or bar-graphics display.However, unlike a normal bulb that can be connected directly to the output of a circuit, leds, which are diodes, need a series of resistance to limit their forward current.
Output Interface Circuits
Light-emitting diodes, or LEDs for short, are an excellent low power choice as an output device for many electronic circuits, as they can replace high voltage, high-temperature filament bulbs as status indicators.An LED is typically operated with a low-voltage, low-current source, making them a very attractive component for use in digital circuits.In addition, as a solid state device, they can have an expectation of over 100,000 hours of working life, which makes them an excellent disposable component.
Single LED Interface Circuit
In our Light Emitting Diode Training, we found that an LED is a one-way semiconductor device; when it is polarized forward, that is, negative enough compared to the cathode (K) anodyna (A), it can produce a series of colored outputs. light and brightness.
Depending on the semiconductor materials used to create the pn-connection of the LED, it will determine the color of the emitted light and the forward voltage of the opening.The most common LED colors are red, green, amber or yellow light.
Unlike a conventional signal diode with a forward voltage drop of about 0.7 volts for silicon or about 0.3 volts for Germanyum, a light-emitting diode has a greater forward voltage drop than the common signal diode.However, it produces visible light when it is pre-recessed going forward.
A typical LED can have a constant forward voltage drop when illuminated, an LED of about 1.2 to 1.6 volts V, and the light intensity changes directly with the forward LED current.But since the LED is effectively a "diode" (its arrow-like symbol resembles a diode, but next to the LED symbol there are small arrows to indicate that it emits light), it needs a current limiting resistance to prevent the source from short-circuiting in the following cases.
Because standard LEDs can operate with forward currents between 5mA and 25mA, LEDs can be operated directly from most output interface ports.A typical color LED requires a forward current of about 10 mA to provide a reasonably bright display.That is, assuming that a single red LED has an advanced voltage drop when 1.6 volts are lit, and that a 5-volt microcontroller that feeds 10mA will be operated by the output port.Then the value of the current limiting serial resistance is calculated as follows:
However, the E24 (5%) series does not have 340Ω resistance in preferred resistance values, so the nearest preferred value selected will be 330Ω or 360Ω.In reality, any serial resistance value between 150Ω and 750Ω will work perfectly, depending on the supply voltage (V S) and the required forward current (I F).
Also, since it is a serial circuit, it does not matter which way the resistance is connected.However, because the LED is one-way, it needs to be connected correctly.If you connect the LED incorrectly, it will not be damaged, it will not only burn.
Multiple LED Interface Circuit
In addition to using single LEDs (or lamps) for output interface circuits, we can connect two or more LEDs together and provide power from the same output voltage for use in optoelectronic circuits and displays.
Connecting two or more LEDs together in series is no different from using a single LED, as we saw above, but this time we need to take into account extra advanced voltage drops, the V LED of additional LEDs in the series combination.
For example, in our example of the simple LED output interface above, we said that the forward voltage drop of the LED is 1.6 volts.If we use three LEDs in series, the total voltage drop in all three is 4.8 (3 x 1.6) volts.At that time our 5 volt source was almost usable, but it would be better to use a source 6 volts or 9 volts higher than powering the three LEDs.
Assuming a feed of 9.0 volts at 10mA (as before), the value of the serial current limiting resistance is calculated as follows: R S = (9 – 4.8)/10mA = 420Ω.Again, since the E24 (5%) series does not have 420Ω resistance in the preferred resistance values, the nearest preferred value will be 430Ω.
Ideal as LEDs with low voltage, low current devices, direct microcontroller and digital logic gates, or status indicators that can be driven from the output ports of the systems.Microcontroller ports and TTL logic gates are capable of ingrationing and therefore can burn an LED by grounding the cathode (if the anode is connected to +5v) or applying +5v in the anode (if it is a cathode).
Digital Output That Interfaces an LED
The output interface circuits above work well for one or more serial LEDs or for any other device with current requirements of less than 25 mA (maximum LED forward current).However, what happens if the output drive current is insufficient to operate an LED, or if we want to operate or replace a load with a higher voltage or current rating, such as a 12v filament lamp?The answer is to use an additional switching device, such as a transistor, mosfet or relay, as shown.
Output Interface High Current Loads
Common output interface devices such as motors, solenoids and lamps require large currents to be optimally controlled or operated by a transistor switch arrangement, as shown.In this way, the load cannot overload the output circuit of the switching interface (lamp or motor) or controller.
Transistor switches are very common and very useful for switching high power loads or output interfaces of different power sources.In addition, in pulse width modulation, as with PWM circuits, they can be turned on and off several times per second if necessary.However, there are a few things we need to think about first when it comes to using the transistor as the key.
The current flowing into the base-emitter connection is used to control the larger current flowing from the collector to the emitter.Therefore, if the current does not flow into the base terminal, if the current does not flow from the collector to the emitere (or through the load connected to the collector), it is said that the transistor is completely OFF.off.
When the transistor is fully switched on (saturation), the transistor switch acts as an effectively closed switch, that is, the collector voltage is at the same voltage as the emiter voltage.But as a solid state device, even when saturated, there will always be a small voltage drop in transistor terminals called V CE (SAT).This voltage varies from about 0.1 to 0.5 volts depending on the transistor.
In addition, since the transistor will be placed completely ON, the load resistance will limit the transistor collector current to the actual current required by the I C load (in our case, the current passing through the lamp).Then too much base current can overheat and damage the switching transistor, which somehow disrupts the purpose of using a transistor, which is to control a larger load current with a smaller current.Therefore, a resistance is required to limit the basic current, I B .
The basic output interface circuit that uses a single switching transistor to control a load is shown below.
Basic Transistor Switch Circuit
Let's say that we want to control the operation of a 5 watt filament lamp connected to a 12 volt source using the output of a TTL 5.0v digital logic gateway via a suitable output interface transistor switch circuit.If the DC current gain of the transistor (ratio between the collector (output) and the base (input) current is beta (β) 100 (you can find this Beta or h FE value from the datasheet of the transistor you are using), and this is V CE exactly 0.3 volts zamaN, what will be the value of the base resistance, saturation voltage, R, B collagen is the time required to limit the collagen.
Transistor collector current, I C , will have the same value of the current passing through the filament lamp.If the power rating of the lamp is 5 watts, the current will be as follows when it is fully ON:
As a Chi-lamp (load) equals current, transistors will depend on the current gain of the transistor as the base current I B = I C / P.Current gain was previously given as follows: β = 100 , so the minimum base current I B(MIN) is calculated as follows:
Once we have found the value of the required base current, we now need to calculate the maximum value of the base resistance, R B (MAX).The information provided indicated that the base of the transistor will be controlled from the output voltage of 5.0v (Vo) of a digital logic gateway.If the base emitter forward pre-voltage voltage is 0.7 volts, the R B value is calculated as follows:
Then, when the output signal from the logic gate is LOW (0v), the base current does not flow and the transistor is completely off, that is, the current does not pass through the 1kΩ resistance.When the output signal from the logic gate is HIGH (+5v), the base current is 4.27mA and turns on the transistor by putting 11.7V in the filament lamp.Basic resistance R B is dispersed less than 18mW when transmitting 4.27mA, so a resistance of 1/4W will work.
When using a transistor as a switch in an output interface circuit, a good basic rule is to select a basic resistance, R B value, with the basic drive current I B being about 5% or even 10% of the required load. current, I C , minimizes V CE and power loss to help the transistor be well driven into the saturation zone.
In addition, to calculate resistance values faster and slightly reduce mathematics, if you want in your calculations, you can ignore the voltage drop of 0.1 to 0.5 along the collector emitter connection and the 0.7 volt drop along the base emitter connection.The resulting approximate value will still be close enough to the actual calculated value.
Single power transistor switching circuits are very useful for switching relays that can be used to control low-power devices such as filament lamps or to switch much higher power devices such as motors and solenoids.
But relays are large, voluminous electromechanical devices that can be expensive when used, for example, to use an 8-port microcontroller as an output interface, or take up a lot of space on a circuit board.
One way to overcome this and replace heavy current devices directly from the output pins of a microcontroller, PIC or digital circuit is to use a darlington pair configuration consisting of two transistors.
One of the main drawbacks of power transistors when used as output interface devices is that the current gain (β) can be very low, especially when switching high currents. To overcome this problem and reduce the value of the required basic current, it is to use two transistors in the Darlington configuration.
Darlington Transistor Configuration
Darlington transistor configurations can be made from two interconnected NPN or two PNP transistors or as a ready-made Darlington device that integrates both transistors and some resistors in a single package to help with rapid shutdown, such as 2N6045 or TIP100.
In this Darlington configuration, the transistor is used to control the transmission of the TR 1 control transistor and the power dial-up transistor TR 2.The input signal applied to the base of the TR 1 transistor controls the base current of the TR 2 transistor.The Darlington arrangement has the same three cables, whether single transistors or as a single package: Transmitter ( E ), Base ( B ) and Collector (C).
Darlington transistor configurations can have between several hundred and several thousand DC current gains (i.e. the ratio between collector (output) and base (input) current, depending on the transistors used.Then it will be possible to control our example of the above filament lamp with a base current of only a few micro-amps as a collector current (uA), the β of the first transistor is 1 I B1, the base current of the second transistor.
Then the current gain of TR 2 will be 1 β 2 I B1 β, since the two earnings are multiplied by β T = β 1 ×β 2.In other words, a pair of bipolar transistors assembled to make a single Darlington transistor pair will multiply their current earnings together.
Therefore, by selecting suitable bipolar transistors and with accurate pre-redeveration, dual emitter tracker darlington configurations can be considered a single transistor with a very high β value and, as a result, a high input impedance to thousands of ohms.
Fortunately for us, someone has already placed several darlington transistor configurations in a single 16-pin IC package, making it easier for us to output interfaces to a number of devices.
ULN2003A Darlington Transistor Array
The ULN2003A is an inexpensive unipolar darlington transistor array with high efficiency and low power consumption, making it a highly useful output interface circuit to drive a wide range of loads, including solenoids, relays DC Motors and LED displays, or filament lamps directly from the ports of microcontrollers.
The Darlington series family consists of ULN2002A, ULN2003A and ULN2004A, high-voltage, high-current darlington arrays, each containing seven open collector darlington pairs in a single IC package.The ULN2803 Darlington Drive, which includes eight darlington pairs instead of seven, is also available.
Each isolated channel of the array is rated at 500mA and can withstand peak currents of up to 600mA, making it ideal for controlling small engines or lamps or the doors and soles of high-power transistors.Additional suppression diodes are included for inductive load driving, and inputs are fixed opposite the outputs to simplify connections and card layout.
ULN2003 Darlington Transistor Array
The ULN2003A Darlington drive has an extremely high input impedance and current gain that can be driven directly through a TTL or +5V CMOS logic gate.Use ULN2004A for +15V CMOS logic and it is better to use the SN75468 Darlington array for higher switching voltages up to 100V.
If more switching current capacity is required, the inputs and outputs of darlington pairs can be parallelized for higher current capacity.For example, input pins 1 and 2 are connected to change the load, and output pins 16 and 15 are connected.
Power MOSFET Interface Circuits
In addition to using single transistors or Darlington pairs, power MOSFETs can also be used to replace medium-power devices.Unlike BJT, the bipolar connection transistor, which requires a basic current to drive the transistor to saturation, the MOSFET switch receives almost no current as the door terminal is isolated from the mainstream transport channel.
Basic MOSFET Switch Circuit
With positive threshold voltage and extremely high input impedance, N-channel, development mode (normally off) power MOSFET (eMOSFET) makes it an ideal device for direct interface to microcontrollers, PIC's and digital logic circuits.
MOSFET switches are controlled by a door entry signal, and due to mosfet's extremely high input (door) resistance, we can parallelize many power MOSFET together, which is almost unlimited until we achieve the power processing capabilities of the connected payload.
In N-channel development type MOSFET, the device is disconnected (Vgs = 0) and the channel is normally turned off, acting as an open switch.When a positive pre-voltage is applied to the door, the current flows through the channel.The amount of current depends on the front voltage of the door, Vgs.In other words, in order to operate MOSFET in the saturation zone, the voltage from door to source should be sufficient to maintain the necessary evacuation and therefore the load current.
As discussed earlier, n-channel eMOSFETs are driven by a voltage applied between the door and the source, so adding a zener diode to the door-to-source connection of MOSFeTs, as shown, is useful to protect the transistor from excessive positive or negative input voltages as follows. For example, those produced from a saturated op-amp comparator output.Zener traps the positive door voltage and acts as a traditional diode that begins to transmit that the door voltage reaches –0.7V, keeping the door terminal well away from the reverse fault voltage limit.
MOSFETs and Open Collector Doors
The output from TTL, which interfaces a power MOSFET, is a problem when we use open collector-output doors and drives, since the logic gate may not always give us the necessary V GS output.One way to overcome this problem is to use a tensile resistance, as shown.
The pull-up resistance is connected between the TTL feed rail and the output of the logic doors connected to the door terminal of the MOSFETs.When the logic level of the output of TTL logic gates is "0" (LOW), the MOSFET is "OFF" and the logic gates output is the logic level "1" (HIGH), the resistance pulls the door voltage to + value.
With this pull-up resistance arrangement, we can make MOSFET completely "ON" by connecting the door voltage to the upper feed rail as shown.
Output Interface Motors
We found that we could use both bipolar connection transistors and MOSFeTs as part of an output interface circuit to control a range of devices.A common output device is the DC motor, which creates a rotational motion.There are hundreds of ways engines and stepper motors interface microcontrollers, PIC's and digital circuits using a single transistor, darlington transistor or MOSFET.
The problem is that motors are electromechanical devices that use magnetic fields, brushes and coils to create rotational motion, and therefore motors, and especially cheap toy or computer fan motors, produce a lot of "electrical noise" and "voltage spikes". switching may damage the transistor.
The electric noise and overvoltage generated by this engine can be reduced by connecting a free wheel diode or non-polarized suppression capacitor to the engine terminals.However, a simple way to prevent electrical noise and reverse voltages from affecting semiconductor transistor switches or output ports of microcontrollers is to use separate power supplies for control and motor control through a suitable relay.
A typical connection diagram for interface an electromechanical relay to a DC motor is shown below.
ON/OFF DC Motor Control
The NPN transistor is used as the ON-OFF switch to provide the desired current to the relay coil.Since the current flowing from the inductive coil cannot be reduced to zero instantly when the energy is cut off, a free rotating diode is required in the same way as above.When input to the base is set to HIGH, the transistor becomes "ON".The current flows through the relay coil and its contacts turn off by starting the motor.
When the input to the transistor base is LOW, the transistor becomes "OFF" and the engine stops because the relay contacts are now turned on.Any back-absorbed diode produced by disabling the coil flows through the free rotating diode and slowly drops to zero to prevent damage to the transistor.In addition, the transistor (or MOSFET) is isolated and is not affected by any noise or voltage spikes produced by the operation of the engine.
We saw that a DC motor can be switched on and off using a pair of relay contacts between the engine and the power supply.However, what happens if we want the engine to rotate in both directions for use in a robot or other motorized project?The engine can then be controlled using two relays, as shown.
Reversible DC Motor Control
The rotation direction of a DC motor can be simply reversed by changing the polarity of the feed connections.Using two transistor switches, the rotational direction of the motors can be controlled via two relays with unipolar double-shot (SPDT) contacts, each fed from a single voltage source.By operating one of the transistor switches at a time, the motor can rotate in both directions (forward or backward).
The output interface of the engines through the relays allows us to start and stop them or control the direction of rotation.The use of relays prevents us from controlling the rotation speed, as the relay contacts will be constantly switched on and off.
However, the rotational speed of a DC motor is proportional to the value of the power supply voltage.The speed of a DC motor can be controlled by adjusting the average value of the DC supply voltage or using pulse width modulation.This is done by changing the signal-to-gap ratio of the feed voltage from 5% to 95%, and many motor H-bridge controllers do just that.
Output Interface Network-Connected Loads
We've seen before that relays can electrically isolate one circuit from another, meaning they allow a smaller power circuit to possibly control a larger power circuit.Relays also protect the smaller circuit from electrical noise, excessive voltage spikes and transient currents that can damage the sensitive semiconductor switching device.
But relays also allow the output interface of circuits with different voltages and soils, such as a 5-volt microcontroller or those between the PIC and the main voltage source.But in addition to using transistor (or MOSFET) switches and relays to control devices powered by the mains, such as AC motors, 100W lamps or heaters, we can also control it using opto-isolators and power electronic devices.
The main advantage of the opto-isolator is that it provides a high degree of electrical insulation between the input and output terminals, as it is optically connected and therefore requires minimal input current (typically only 5mA) and voltage.This means that opto-isolators can easily interface from a microcontroller port or digital circuit that offers adequate LED drive features on the output.
The basic design of an opto-isolator consists of an LED that produces infra-red light and a semiconductor light-sensitive device used to detect emitted infra-red rays.Both LED and light-sensitive device, which can be a single photo-transistor, photo-darlington or photo-triage, are enclosed in a light-proof body or metal-footed package for electrical connections as shown.
Different Types of Opto-isolators
Since the input is an LED, the value of the serial resistance can be calculated as above, the R S required to limit the LED current.The LEDs of two or more opto-isolators can be connected to each other in series to control multiple output devices at the same time.
Opto-triage isolators allow control of AC-powered equipment and mains lamps.Opto-connected triages such as the MOC 3020 have voltage values of about 400 volts, making them ideal for direct network connectivity and a maximum current of about 100mA.For higher-power loads, opto-triage can be used to provide door impact for another larger triage through a current limiting resistance, as shown.
Solid State Relay
This type of optocuplor configuration forms the basis of a very simple solid state relay application that can be used to control the load fed from any AC network, such as lamps and motors, directly from the output interface of a microcontroller, PIC or digital circuit.
Output Interface Summary
Solid-state software control systems using microcontrollers, PIC's, digital circuits and other microprocessor-based systems should be able to connect to the real world to control engines or turn LED indicators and lamps ON or OFF, and in this case in this electronic tutorial we found that different types of output interface circuits can be used for this purpose .
The simplest interface circuit ever is a light-emitting diode or LED circuit that acts as a simple ON/OFF indicator.However, using standard transistor or MOSFET interface circuits as solid state switches, we can control a much larger current flow even if the controller's output pins provide only a small amount of current (or sink).Typically, for many controllers, their output interface circuit can be a current sinking output, where the load is usually connected between the supply voltage and the switching device's output terminal.
For example, if we want to control a number of different output devices in a project or robotic application, it may be more convenient to use an ULN2003 Darlington drive IC consisting of several transistor switches in a single package.Or when we want to control an AC actuator, we can output to a relay or opto-isolator (optocoupler) interface.