SOME EXPLAINED SCHEMATICS
1 Watt LED Transistor Driver
In LEDLabs this circuit allows micros and some lower output logic Ic's to drive a heavier load than there output pins can sink and source, which could be typically 10-20ma,
As these 1 watt leds consume up to 350ma a collector driven load circuit is used, known as the common emitter.
The bc337 transistors can handle up to around 600/800ma of collector current so will be okay for this reason.
We want to drive a load current of around 150ma, not the maximum of 350ma (as will be to bright) so from the data sheet for the bc337, the hFE or gain of the transistor is around 100 @ 100ma and as low as 60 for 300ma so for base resistor ib=ic/hfe = .150/100= 2ma. As there is a .7v drop across base-emitter, our equation is 5v-.7 = 4.3v
so.. 4.3/.002 = 2150 ohms, we want to ensure the transistor is in full saturation and operating as a switch, and not in its linear region,
We factor in a safety margin of at least half times this value and have chosen a 1k resistor, this will ensure the transistor will fully saturate and switch on.
So we want to drive an led at around 150ma and the data sheet shows us that we can go up to about 350mA. The forward voltage drop across the led is 3.2v. We will require a current limiting resistor (r2) we will factor in the voltage drop (vce) across the transistor switch, the data sheet shows that vce(sat) = 1v max, these conditions are for high current and voltage which we are not using so .3v is the most likely and will use this here.
So we have: Vsupply=vr2 + vled + vce
rearranging this give us vr2 = vsupply – vled – vce = 5 – 3.2 – .3 = 1.5v
we know that r2 will drop 1.5v and the current will be 150ma
Ohms law says r=v/i = 1.5/.150 = 10 ohms so the power is = vxi = 1.5vx150ma = 225mw or .22w for the resistor.
This is the minimum resistor value to gain maximum brightness. (this is assuming that 150ma was the maximum led current) to keep within safe tolerances use resistor values higher than the calculated value if maximum brightness is not required.
These kind of leds maximum current is up to 350ma, but we don't need them this bright, so have based it on around 150ma, and there is a variable brightness adjust resistor, which we don't want to exceed its max power rating which is typically up to 150/300mw and when this is adjusted it can share up to half of the load of the other resistor at a certain point.
The other useful reason for this transistor type driver, is it can power higher voltage circuits, this transistor can be connected to a 12 volt supply as its ratings of vceo is 45v.
By way of example, if this board was powered by a 12 volt source, the circuit would have a 5 volt regulator for the micro, then this transistor circuit could be wired straight back to the 12 volt line. This would change the equation above,
the supply voltage – the forward voltage drop of led/Led current would = 12v-3v = 9v/150ma = 60 ohms. Rated at 1.35w. Note: Ledlabs is 5 volt only.
The main reason for connecting to a higher source is that a component like a 9 volt sounder/buzzer might want to be used, this circuit at 5 volts would not be high enough to drive it correctly.
As the large leds above do not require maximum brightness for this project board, a higher value of resistor is chosen, this makes the leds run dimmer, and consequently reducing the power, however they still are bright enough.
Care should be taken when switching on any of the larger Leds as they are very bright when the variable brightness is set high and should avoid looking directly into them, always make sure the brightness is set low first. The 20R resistor can be changed to say a 100R to reduce further if required. The 20R resistor sets a current of around 110ma, and not their maximum range of 350ma which is too bright for this purpose. UV should not be looked directly into, as the peak wavelength can not be seen, just the visible side as in the purple colour.
LM393 Comparator Circuit
The LM393 dual comparator is used in this circuit, the power supply is pre-wired to the board, and the inverting input to one of the comparators is wired to a 10k potentiometer in order to set the reference voltage.
An output connector is available to measure and set this voltage, this can be measured by connecting it to the lm3914 voltage input connector.
The other comparator is left open for free use, but has the power supply wired.
The lm393 is an open collector, so will require a load or pull-up resistor connected from its output to the +ve rail. (earlier revision) In one of the comparator circuits a load/pullup resistor is used, which offers the voltage drop required and toggles a red led and a green led
These represent: Red led: High output, and green led: Low output.
When the ldr etc is connected to the non-inverting input and gets close to the reference voltage of the comparator, set out by vref and analogue out from ldr circuits, the differential inputs can get very close, and because a signal from an ldr is generally a slow moving signal, this can cause the comparator to oscillate .Which in turn could send several pulses out and confuse micros.
So a small amount of hysteresis is added in the form of a 100k resistor from the output back in to the non inverting input, this gives a nice clean single switch over pulse and helps with circuit stability, it also acts a bit like a schmitt trigger.
This can be connected to the pulse counter on board, or indeed a microcontroller.
The other circuits can also be connected to the comparator or pulse counter. The light switch, over temperature and under temperature switches.
The lm3914 voltmeter can be used to set the threshold voltages for the ldr and thermistor circuits and the voltage reference to the comparators, the scale is 0v-3.6v every led on the lm3914 represent 360mv. Comparator 1, has one input available as the inverting input is connected to a potentiometer, whereas comparator 2 has both inputs available for free use, and can be made to drive given circuits, which comparator 1 may not, as it has leds already attached. remembering that comparator 2 is open collector and would require a pull-up resistor to provide an output voltage. (earlier revision lab).
LDR/Thermistor Circuit
Four of the various sensor circuits in LEDLabs are in the form of light and temperature, analogue level outputs, comprising light switch / dark switch and over temperature / under temperature these can be set relative to ambient conditions.
An output connector can be used to measure the corresponding analogue voltage level across the potential divider circuits, which in turn can be measured in the lm3914, which scales from 0v -3.6v . or indeed the op-amp comparator lm393 for sensing.
An analogue input to a micro can also measure this value.
The thermistors used here are 10k negative temperature coefficient (ntc) whose resistance changes with temperature, the lower the temperature the higher the resistance.
A 10k thermistor is a good choice and measures approximately 10k @ 25 degrees, so with a 10k variable resistor a good swing is achieved.
The light dependent resistors (ldr) used here have a dark resistance of around 1M ohm. And whose resistance changes with the amount of light falling on it. The more light falling the lower the resistance.
A voltage divider is shown in (fig1) and is generally made up of two or more resistances, here we are looking at r1 and r2, and vout is the right hand side equation with the remaining voltage leftover v1.
So for the ldr circuit above (fig2) in the dark it has high resistance of 1M ohm + and hence has a high vout and acts as a dark activated switch. Under light conditions vout is lower, as the resistance falls of the ldr, and may turn some device off when light falls, if connected to the lm3914 voltmeter the voltage and behaviour of these four circuits can be monitored.
Transposing the ldr and resistor, we then have a light switch as (fig3). LEDLabs has an extra 1k resistor in series with a variable resistor making up the dividing network as shown above, the 10k variable can be swept through 1k to 11k to set the levels more precisely, the 1k allows for more finer control and if used to control a transistor, this fixed resistor must be used to stop zero ohm to the base of the transistor.
To work out the series resistor for an ldr circuit, the equation is : r = square root of rmin x rmax, example rmin = 100 ohms rmax = 1Mohm therefore, 100×1000000 and the square root of this product = 10k, so LEDLabs uses a 10k variable,
if the parameters of the ldr is not known from data sheets, it can be measured under both conditions, to find rmax and rmin measure the resistance when in total darkness and similarly with bright light falling upon it.
Pull Up Resistors
LEDLabs has a set of pull-up resistors and pull-down resistors, as fig1 shows, this is useful for micro-controllers, as some pin ports require pulling up or down through a given value resistor to the voltage rail, however some now have embedded pullups.
Various logic ic’s also require these, particularly when interfacing between two types of technologies, for example TTL and CMOS.
It also ensures that a pin is at a logic level either 5v or 0v, so it is not ‘floating’ which could cause oscillation and erratic behaviour by the ic monitoring this. It could take the input as a logic 1 or logic 0.
Two leds, red for high and green for low are just opto indicators for the set of pullups. LEDLabs also has two button commands, one with a pull-up resistor and one with a pull-down resistor as seen in (fig2).
When sw1 is pressed this pulls down cn1 to 0 volts so is active low when sw2 is pressed this pulls up cn2 to 5 volts so is active high.
So these are useful tools for microcontrollers and various other kinds of logic.
Two crystal oscillators are on board as shown in (fig3) a 4mhz and a 16 mhz with 22pf capacitors for quick connection to microcontroller pins if required. Also the zif socket can be used for add-on sensor modules, as it has breakout connections.
8 leds of various colours as shown above in (fig4) are indicators for an 8 bit port test, they are all common to the 0 volt rail, and will light when port pins are active high (logic 1).
The microcontroller port has connections to ‘breakout’ to other circuits etc as shown in (fig5).
555 Astable Clock Generator
The 555 timer module gives a variable frequency clock generator, of square waves.
The frequency is varied through a potentiometer (vr1) and a set of four dip switch settings which change the capacitance, which allows for 10hz, 200hz, 5khz, and 50khz.
By selecting the dip switch 1 with the others off will allow the slower range of frequencies then sweeping (vr1) to its maximum will end that range,
this can be seen through the repeater led as blinking.
If higher frequencies are required turn off dip switch 1 and select dip switch 2 for the next set of frequencies and so on.
As frequency increases the led will flash so fast that it becomes out of our persistence of vision and appears on all the time.
Clock pulses or serial trains, are useful for toggling logic gates or being read by a micro’s serial interface.
if this output is fed into the 4026b counter,you can see how this toggle effect works.
555 Monostable Trigger Circuit
The 555 timer is wired as a monostable delay/trigger circuit.
The timing is achieved through the rc network, vr1 c2 capacitor and r2.
A larger capacitor will allow for longer delays a 220uf is used here in LEDLabs
with a 470k variable which gives around about 1 second delay to a couple of minutes or so.
If the variable is moved to a given setting, switch 1 can be pressed to see how long the delay lasts for, an led light and sounder is triggered.
When a signal from a micro etc goes active low, this will trigger the module, this is a very useful tool for making sure an event has happened, and can be audible or visually realised when program testing.
A reverse bias diode is across the coil of the buzzer in case of any back emf generated, which could damage the 555 timer.
Stepper Motor Controller
The stepper motor controller IC used is a ULN2003, which has seven npn darlington pair transistors which are known as current amplifiers, each having a reverse biased diode inbuilt to clamp any back EMF transients caused by switching inductive loads.
Stepper motors have coils so are therefore inductive, and the diode inbuilt protects the transistors from potentially high switching voltages.
This is a good interface IC to drive heavier loads, as it has high current gains formed by the darlington pair transistors, which are open collector and are in common emitter configuration, and can drive up to 500ma per channel.
The UlN2003 is not limited to driving stepper motors, as they are quite versatile and can drive relays, solenoids, filament lamps, led displays etc.
The stepper motor bit pattern led indicators A B C D, will show which phase is switched on and how fast they are switched on.
The five port connector drives the four phases of the motor and the common.
The four port input comes from a micro or some other timed switching controller.
Driving Dot Matrix Displays
LEDLabs is equipped with an onboard atmega 328p microcontroller; the same controller used for the Arduino.
This can be programmed in situ, by simply connecting the tx and rx and reset and common ground to the inputs on the LEDLabs board provided, from such as the arduino uno board(s) output connectors.
Analogue inputs and digital pins including PWM, are accessible on LEDLabs Which can receive input signals from LEDLabs, and act on them, and also output to the LEDLabs board, or indeed any other circuit or device, if another circuit is used make sure to connect the ground from LEDLabs to the ground on the other device, to ensure they use a common ground, or undesirable effects may be noticed like program code not working correctly.
Other micro’s are programmed in the usual way through their programmers, then the micro removed and placed in Led Labs. Some programming boards such as Raspberry pi have output connectors, which can be linked to devices on LedLabs, just connecting the ground from one of these programmers to LedLabs to common them together.
Two dot matrix displays are driven by the max 7219 driver integrated circuits, which have a data, load, and clock connectors, which can be controlled by the atmega 328p, and reprogrammed without moving the chip, by connecting the rx, tx, reset and common ground pins of the arduino uno board.
A boot loader may have to be installed on the atmega328p to match the programmer board used, and information on this is available on the arduino website, using the arduino as a avr isp.
If the atmega was removed from the uno board and placed in LedLabs it would work straight away as it matches programmer, and can be programmed in situ, by connecting rx, tx, rst, and 0v from the uno board to led labs. If using the uno board, when purchasing the atmega328pu microcontroller chip on its own, purchase with uno bootloader already installed. In any case, the atmega328pu ic should be removed from the uno board when programming the led labs board.
Other Micro’s such as the pic can also control the displays.
If no particular program is running on the dot matrix displays, it will just have random data loaded and may flash or light all segments when not in use, if the data in to the max7219 is taken to 0v, this should blank the display and save power.
LEDLabs has 3 x 8 bit shift registers, forming a 24 led propagation fountain, very good effects can be seen on the display, such as walking ‘ones’, or even sharing the data line which controls the dot matrix displays, (when it is running) to the data input of the shift register, and clock from the 555 astable circuit on board to slow the clocking down.
It has output enable always on. 3 connectors are provided, one for the strobe and data and clock
The registers shift automatically to the next device. These can be used from the atmega or pic, or other ways like the 555 timer for the clock and two switches manually toggling the strobe and data.