Go Down

### Topic: Controlling a 5v relay, only getting 2.4v? (Read 9505 times)previous topic - next topic

#### aj88keys

#15
##### Jun 29, 2013, 02:25 am

What's going on at A1 ?

A1 is a 12 volt source going through a diode and a 750 mA polyfuse for some 12 volt electronics and a motor. Negative terminals are both connected to gnd, left side positive rail has +12.2V supplied by Vin, right positive rail has +4.85V supplied by arduino 5V out.

You say you are losing 2.5V through the transistor, it's connecting to ground, so are you measuring from the E pin to ground? (after the 5V has passed through the relay coil)..?

I am measuring from Collector to Emitter. I also measured across the relay coil and got about 2.3 - 2.4v

I wonder if the current to initially pull the relay in is too great? And 42mA is the current to hold it in?

I hadn't thought about the pull-in current, however I measured the coil's resistance to be 121 ohms, which still works out to  5V / 121 = 0.0413 or 41.3 mA. That is just math though, and stupid reality is never as easy. :0 Do relays normally draw more current while pulling in?

#### runaway_pancake

#16
##### Jun 29, 2013, 03:05 am
Slightly more, not major.

Attached drawing.  Is yours set up accordingly?
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

#### aj88keys

#17
##### Jun 29, 2013, 03:20 am
560 ohm instead of 470, but otherwise identical

#### runaway_pancake

#18
##### Jun 29, 2013, 03:23 am
Have you measured the coil resistance (out of circuit) with an ohmmeter?
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

#### aj88keys

#19
##### Jun 29, 2013, 03:27 am
121 ohms. Just did some poking and prodding with the voltmeter and discovered that I'm only getting 0.7 volts out of my digital pin when its connected, and only 4.3 volts unconnected. 5 volt rail is still solid at 4.95V

#### runaway_pancake

#20
##### Jun 29, 2013, 03:29 am
4.3/0.7 = OK

The resistor, 560?, is green-blue-brown, verified with ohmmeter?
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

#### aj88keys

#21
##### Jun 29, 2013, 03:37 am
Yep. And it had nothing to do with the problem whatsoever. Turns out I forgot to set pinMode(dirPin, OUTPUT).

Oops.

All is well now. I guess the lesson is, don't give a pin a name that sounds like derpin'

#### oric_dan

#22
##### Jun 29, 2013, 03:57 am
The way to do something like this is in 3 steps:

1. check relay directly with 5V.
2. check NPN driver ckt exclusive of Arduino - connect base R to 5V.
3. hook to Arduino I/O pin.

Then you know exactly where the problem comes in.

#### runaway_pancake

#23
##### Jun 29, 2013, 04:00 am

Yep. And it had nothing to do with the problem whatsoever. Turns out I forgot to set pinMode(dirPin, OUTPUT).

Oops.

All is well now. I guess the lesson is, don't give a pin a name that sounds like derpin'

Carumba.
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

#### aj88keys

#24
##### Jun 29, 2013, 04:02 am
You know, the stupid thing is, I was thinking of trying to connect the transistor base directly to 5v to see if the Arduino was the problem, I really don't know why I didn't do that. I guess that's why my profile says "Newbie"

#### larryd

#25
##### Jun 29, 2013, 05:10 am
Quote
I was thinking of trying to connect the transistor base directly to 5v

I was thinking of trying to connect the transistor base resistor directly to 5v
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

#### 1ChicagoDave

#26
##### Jun 29, 2013, 06:27 am
What's the 1K resistor there for? Can someone more experienced than I explain why it would be needed?
I could be wrong.....probably am (so someone please verify?)....but if the Arduino is putting 5V @ 20-30mA through a 1000 Ohm resistor.....wouldn't that limit current to the transistor to only like a half a mA?

Personally, I'd try it without the resistor. But, I'm a bit of a risk-taker. Maybe try a smaller resistor?

Anyone else have an opinion on this?

#### nickgammon

#27
##### Jun 29, 2013, 06:34 am
Where do you see a 1K resistor?
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

#### 1ChicagoDave

#28
##### Jun 29, 2013, 07:51 am

Where do you see a 1K resistor?

On base of transistor. In the photo he posted. And the schematic.

I didn't see the whole second page of the conversation until after I asked about the 1K though. Guess it's working now.

I am a little curious about it though.

#### oric_dan

#29
##### Jun 29, 2013, 08:27 am
Risktaker is always fun, but with electronics you need to learn a little theory,
although the good thing is, when you make a bad, something usually smokes
as a result. Or just stops working, so then you can sit there and 2nd guess the
universe.

You ALWAYS need a series base R with an NPN inverter, as it sets the actual current
into the base.

Ib = (5V - 0.7V) / 1K = 4.3mA.

Do a google search on NPN inverter, and read a bit.

Go Up