Hello everyone!
I just got my inventors kit yesterday and I’ve been doing the illustrated circuits with the pre-programmed codes, but I got stuck at nr. 13.
I am new to everything involving arduino and programming, so I might be missing something terribly obvious :?
The circuit is correctly wired and the code is successfully loaded to the R3, but when the NO contact is supposed to close the led only dims a little bit, I’ve also measured the resistance over the pins and there is no indication that the relay switches when given a jolt (I raised the delay to 5 seconds to be sure I got an accurate reading). It seems to me that the relay isn’t receiving enough power, any suggestions to what I might try next?
If you have a DMM go through the following measurements and see what you see.
-
w/power off, confirm less than 2 ohms from the Arduino ground and the transistors emitter. Measure to the actual pin if possible, this ensures good contact btw the emitter and the breadboard.
-
w/power on and the sketch running, measure the voltage on both sides of the 330 ohm resistor, btw pin 2 and the transistors base. You should see (on the Arduino end) the voltage flipping btw near 0V and >4.5V. This again says you’ve got a good connection and the code is running. On the base side of the resistor you should see the voltage flipping btw 0V and about 0.65V. Basically the transistor looks like a diode btw it’s base and emitter. When current flows from pin2 through the resistor and base to the emitter and ground, there should be 1 diode drop of voltage across the base to emitter. If you don’t see this then current isn’t flowing (for some reason).
-
On the relay coil, verify one side is always >4.5V and the other side flips btw that voltage and near 0V. The transistor should act like a switch to ground; open when pin2 is 0V, closed when pin2 is >4.5V. When closed, current should flow through the relay’s coil causing it to switch state, usually with an audible click.
So I switched the polarity of the diode to check that, and now it works…
What is the function of the diode in this setup? is it to stabilize the current when the relay is activated and deactivated?
The diode goes across the relay coil “backwards”. In normal operation it doesn’t conduct any current as it is reversed biased. But when the relay coil voltage is removed, the coil (as does any inductor) generates a reverse voltage due to the energy in the magnetic field which is collapsing. This voltage can damage the transistor (or other components) and so a diode is used to short it out.
When you had it in the wrong way, it was conducting whenever the transistor was on and thus shorting out the coil and prohibiting it from working.
Not doing the transistor much good either !
Well, when it was in the wrong way I was actually following the illustrated instructions. This is copied from the sketch “… Connect the side of the diode with the band (cathode) to 5V connect the other side of the diode (anode) to the COLLECTOR pin of the transistor…” The illustrations show that the side with the band should face the collector pin :think:
You should e-mail SF tech support and let them know. While some SF employees read these forums, it’s not guaranteed they will see your thread. That’s the kind of silly thing that can frustrate a beginner to no end and certainly is not good to have in a kit intended to help newbies learn.
This certainly frustrated me, but seeing as relays are one of the components I will use for future projects I had to find the cause of the problem.
I might just do that, it struck my mind that it could be an error in the wiring from the illustration, so I googled it but was puzzled when I got no results describing the problem I had.