Step 15Controlling devices
The first is a simple transistor circuit. A picaxe chip can turn on a maximum of 20mA per pin which is good for turning on a LED but not much else. A 547 transistor increases the current to 100mA which is good for small light bulbs.
The second circuit shows a mosfet. Mosfets need virtually no current to drive them - only volts so they can be directly controlled by a picaxe. There are all sorts of mosfets available but my preference is one called the BUK555 60B http://www.ortodoxism.ro/datasheets/philips/BUK555-60A.pdf It can be directly driven from 5V (unlike some which need 10V) but the main advantage is it has an extremely low resistance when turned on - 0.045 ohms which is not much more than the resistance of the wires one would connect to it. This means it doesn't get hot when driving quite high loads which saves power and also saves on heatsink costs. As an example driving a 5amp load like a car headlamp; watts=current squared x resistance, so W=5*5*0.045=1.12 watts which would only need a heatsink like a 1inch square piece of thin aluminium.
The third circuit shows a relay. There are several parameters for all relays - the coil voltage, coil resistance and the load voltage and current. For instance a relay might have a 12V coil with a coil current of 30mA, coil resistance of 400 ohms and might be able to drive up to 240V at 1 amp. The coil current is more volts and amps than a picaxe can supply, so we use the transistor circuit to switch the coil. There is a diode included as well - this supresses the back EMF when the relay turns off. Back EMF is what creates the spark for a sparkplug so you don't want these high voltages anywhere in a circuit. The contacts will have a maximum current and volts - the current might be a few amps and the volts are often 240V so switching 12V or 24V will be well within range. If you are inexperienced with electronics don't play with mains voltages.
There are also small relays that have coil voltages of 5V or 6V. For these relays you may not need a seperate 12V supply but just watch the coil resistance as many of these have current draws of over 100mA. If so and you are using a 78L05 100mA 5V regulator you might want to change this to a 7805 regulator which can supply up to 1 amp.
Relays are particularly useful for switching AC - eg 24VAC garden sprinkler solenoids, 12VAC garden lights and in electrically noisy environments such as a car. They are also useful for controlling big loads, eg a picaxe supplying 20mA at 5V = 0.1W controlling a transistor 12V at 100mA=1.2W to a relay 24V 100mA =2.4W to a contactor driving a 3600W pump. If you want to control power like that then get an electrician to wire up a control box and give you two wires coming out (coil wires for a 12V relay) that you can control. This way the electrician can sign off on the power box and you can do all the electronics without having to worry about being electrocuted.
Another use for relays is a reverse control for a motor. Using pulse width modulation into a mosfet you can control the speed of a DC motor, and with a DPDT power relay you can change the direction. This is a simple way of controlling big motors like the ones used in 'robot wars'.
Please post a comment if you need help building something.
| « Previous Step | Download PDFView All Steps | Next Step » |



















































The problem is interfacing them with a matrix..
Any help is welcome :)
Here they are. In front of the relevant AT commands I have typed here serout -> or serin -> to show you what goes out and comes in as answer from the modem
serout -> AT+CREG=2
serin -> OK
serout -> AT+CREG?
serin-> +CREG: 2,0
serout ->AT+CPIN=2004
serin -> OK
serin -> +CREG: 2
serin -> +CREG: 5
serin -> +CREG: 5,"11BA","2F00"
Above were relevant AT commands to register the modem to the GSM network. Below are 2 types of sending an alarm phone call:
1. with number:
serout -> ATD 0592170185
serin -> NO CARRIER
2. with number from first postion of SIM's phonebook:
serout -> ATD>1
serin -> NO CARRIER
The 'NO CARRIER' is good here, because it shows that the person who was called did not pick up the phone.
serout 1,T1200,("AT+CREG=2")
serin 1, T1200,("OK")
serout 1,T1200,("AT+CREG?")
etc
Only catch is that the exact data has to be received by serin. If it isn't the expected bytes, then it just hangs till the right bytes come through. Unless you use one of the newer picaxes (20x2) that have a timeout on serin.
and to read in,
Huh? I was taught that watts = volts x amps.
Suggestion: Excellent instructible. Pictures where appropriate, and step-by-step instruction. I've been wanting to make things move with a click of the mouse, but wasn't sure how. I have a few picaxes "fresh outta the box", so this is perfect for them. Perhaps a line-by-line explanation as to what the VB code does. If you could do that, then those familiar to programming can translate it to their favorite language or simply add on to the code provided.
I= current, V=volts, W=Watts and R=resistance then
W=V*I (as you say)
V=I*R (Ohms law)
So if you take W=V*I and substitute the V from Ohms Law as I*R you get
W=I*R*I
Or W=I squared *R
Which is kind of anti intuitive. The bottom line is when switching big currents, you don’t have any control over the I, so the only thing you can vary is the R, and so it has to be as small as possible. It may explain why, in the world of semiconductors, relays are still popular.
I'll have a look at commenting the vb code more.
V=I*R
W=V*I
substitute V's equivalent (I*R) for:
W=(I*R)*I
Now I get it! Oh, my brain, MY BRAIN!!!!
Is it just me, or is thinking harder on Saturdays?
http://www.communitymx.com/content/article.cfm?page=2&cid=8658A
I don't know a lick of PHP, and this application of it makes this language worth taking a look at.
...After looking at the following link, the language looks much more complicated and hard to learn. Maybe I should look up a few books from my library.
http://en.wikipedia.org/wiki/Php