![]() |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Micro Controller InterfacingLimitationsA micro-controller can be a very versitile piece of control equipment, working to a set rountine, or set of conditions, at high speed - monitoring inputs and switching outputs. There are however a number of restrictions on the configuration of these inputs and outputs relating to either Voltage or Current. These applications look at microcontrollers in general terms rather than focusing on a specific brand or model.
Regulation of the controllers power supply voltage will be covered under in seperate application but requirements can generally be found on the data sheets as VDD and VSS or similar. The article Reading Data Sheets should help you decipher things if your new to electronics. For these applications we are interested in the high and low voltage levels triggering a logic level on an input, eg. VIH or VIL, and the output voltages which may be described by VOH or VOL. We will also see limits placed upon our controller for current sink & supply as well as total power disipation. These limits will be shown for both pin and device such as ICC, PTotal, PDIS or simply listed as Absolute Maximum Ratings. Simple Switch Input
Should the input be held high accidently, as an output for example, then the current from the microcontroller will be very small, consider V=IR when we use 5V as the positive voltage. The switch offers some protection against the high voltage and a pin programmed to be held low, better protection would see a second resistor on the connection between resistor/switch junction and the controller but this isn't a must have requirement.
While this type of input could be used for multiple push buttons on a keypad but it would be more usual to have some sort of multiplexing to reduce the number of inputs required. The simplest circuitry would use multiple switches connecting differing resistors as a potential divider to an analog input. We can calculate what values correspond to which button but some allowance may be required for variation in supply voltage. You may wish to employ a multiplexing IC or special features on a specific controller, such as the PICaxe keyin function, these are beyond the scope of this application. This input circuitry will also work with Micro Switches which are more suited to mechanical switching for bump detection. Simple LED Output
When we first considering the limiting resistor for the LED we might consider IF at 20mA. If this is driving the controllers outputs to the limit of their supply then consideration should be given to a reduced current supply and reduced LED brightness, 15mA may be more suitable.
When calculating limiting resistor (R = V / I) for a high output on a 5v supply we may find :- In a similar consideration for lighting the LED from a low output VOL may not be 0v but 0.6v Transistor LED OutputOne or two LEDs may not present a problem but if we are to drive numberous LEDs, in a seven segment display for example, then we may reach the maximum current supply for the controller. We need to think about the interface and how we can use a smaller current without detremental effect on our LED brightness. This application considers the use transistors to boost the current supplied as it leads into other high current outputs but we might use a display driver IC to reduce the output requirements in terms of current, pins and processing.
The data sheets will help us with our design but it's worth a note that the same part from different manufacturers may differ on it's maximum values. We're looking at :-
Note that these figures are based on an ambient temperature of 25° C, other parameters become can become important as we push our designs but are not being considered at this time.
If we consider the limiting resistor for driving our LED we now need to consider the voltage drop both across the LED, VF, and the Transistor, VCE(sat).
We can see that our LED current, IF, is much lower than the collector current, IC, and can check the power dissipation:-
When turning our transistor on and off we need to consider the voltage on the base to give VBE and the current IB. As HFE is a ratio IC / IB we can see that we only need to supply a fraction of the current required by our load. While we might use a BC548 transistor and calculate IB as 0.2mA it will only just turn on, however doubling up to 1.0mA we still have a small load but the transisitor is driven hard on. The calcultaion for our base resistor would be based upon the High Voltage level (VOH) from our controller, the voltage drop on the transistor (VBE(on)) and the calculation V=IR once more.
If we now consider the Off voltage we can see that Transistors may prove problematic, the On voltage VBE(on) is only 0.66v and the controllers low voltage may be in the same region, out example gives VOL as 0.6V. This may mean that the transistor doesn't fully turn off, aside from our load still being driven it may be that there is a higher voltage across the transistor and problem with much higher than expected power dissapation.
However if we consider our Darlington Transistors we see that we have much higher VBE values and the potenial divider is not required, with some transistors and darlington transistors have similar prices many circuits become cheaper and similar with this solution. Note too that the voltage drop across the darlington transistor is higher, VCE, this may be significat in battery powered circuits.
Transistor Output Inductive Loads
Relays cannot be driven directly from our controllers output, note that we have shown a transistor drive circuit once more but with an additional diode. Inductive loads such as relays and motors can produce high voltage, opposite to the supply voltage as they are turned off, this may distroy your transistor circuits. The diode offers protection against this voltage and should not be omitted from the circuit.
Final word on simple input and outputWhen switching larger loads MOSFET devices may be better suited to the task. These will be covered in another article as they have differing requirements, as will driver ICs and relay changeover circuits that would be better suited to Mini-Sumo motor drives and direction contol. There are more sensors and interfaces than can be listed here but their data sheets will give enough information for you to use them safely. Some of the more common one will be covered in an article.
If your looking for a little help, drop by the forum.
References
|
|
Terms of Use | © MiniSumo.org.uk, 2005 - 2011. | Web Master Contact. |