Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Transistors and resistors


  • Please log in to reply
36 replies to this topic

#21 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 22 April 2012 - 06:32 PM

Hi,

Thanks everyone for all the help, I know this is a rather simple concept but understanding this will help me no end with all my projects.

Taking in to account all of the advice and comments you have given I have had another go and have redrawn the fritzing.

To calculate the actual resistors I have gone off the following (which are actual values)

LEDs: 2v Fwd/ 30ma Fwd
Relays: 2.5v Fwd/ 25ma Fwd

Resistor:

(12v - 2v - 2.5v) / (30ma + 25ma) = 7.5v/0.055a = 150Ohm +/- 10%

Does this look right? And is there any other comments, suggestions or additions you would make?

PS Red wires are mains live, green main earth (neutral is not shown but can be assumed to be split for each IEC.
Brown is positive from the 12v supply and blue is the ground for the 12v supply.
The 12v gnd and netduino ground are tied together.

Thanks again,

Andy

Posted Image



Hi Andy,

Zooming in on your picture, I can see that you have the protection diodes and LEDs all facing the correct way - like in the first relay diagram posted by smarcus3.

You have wired the LEDs in series with the relay coils. This means they will both have the same current flowing through them. Given that they have very similar forward currents I don't think this is an issue.

But, your calculation is not quite right.

If we limit the current flowing to 25mA so the coils are not being over driven, then the calculation is just (12V - 2V - 2.5V) / 25mA = 7.5V / 0.025A = 300 Ohms.


One thing that is worrying me about your diagram is that the low voltage and mains voltages appear to be crossing over. For safety, it would be best if they did not. Ideally you would want to be able to draw a horizontal line across your circuit that passes through the relays; below the line would be low voltage, above it mains voltage.

Hope this helps - Paul

#22 mcinnes01

mcinnes01

    Advanced Member

  • Members
  • PipPipPip
  • 325 posts
  • LocationManchester UK

Posted 22 April 2012 - 09:02 PM

Hi Paul

Thanks, I have put a better image up now including the adjusted resistor your recommended. In terms of the mains crossing the low power, the relays in this image are only a representation, my real enclosure is already wired for mains and everything is fully insulated and grounded, this board will only provide wires out to the "coil" side of my SSR relays. There are more details of the full enclosure here: Relay Enclosure.

In terms of the transistors are the one listed (2N3904 and 2N3906) no good as they are only rated for 200ma? If so would these be any good?

The final part of this circuit (if you don't think I need any additional protection? in circuit fuses etc?) is the fan circuit.

Would you use the same circuit as the relays for this or something else perhaps with an opto?

Thanks again,

Andy





Hi Andy,

Zooming in on your picture, I can see that you have the protection diodes and LEDs all facing the correct way - like in the first relay diagram posted by smarcus3.

You have wired the LEDs in series with the relay coils. This means they will both have the same current flowing through them. Given that they have very similar forward currents I don't think this is an issue.

But, your calculation is not quite right.

If we limit the current flowing to 25mA so the coils are not being over driven, then the calculation is just (12V - 2V - 2.5V) / 25mA = 7.5V / 0.025A = 300 Ohms.


One thing that is worrying me about your diagram is that the low voltage and mains voltages appear to be crossing over. For safety, it would be best if they did not. Ideally you would want to be able to draw a horizontal line across your circuit that passes through the relays; below the line would be low voltage, above it mains voltage.

Hope this helps - Paul



#23 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 23 April 2012 - 06:26 AM

Hi Andy,

I'm a bit rushed as I am about to leave for work.

Just on the transistors, the 2N3904 data sheet and 2N3906 data sheet I just found says the 2N3904 and 2N2906 are good for 100mA as a switch - not 200mA.
If you are switching less than that with the transistors, then that is fine. If more, then you will need to find a new transistor.

Paul

#24 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 23 April 2012 - 04:59 PM

Hi Paul

Thanks, I have put a better image up now including the adjusted resistor your recommended. In terms of the mains crossing the low power, the relays in this image are only a representation, my real enclosure is already wired for mains and everything is fully insulated and grounded, this board will only provide wires out to the "coil" side of my SSR relays. There are more details of the full enclosure here: Relay Enclosure.

In terms of the transistors are the one listed (2N3904 and 2N3906) no good as they are only rated for 200ma? If so would these be any good?

The final part of this circuit (if you don't think I need any additional protection? in circuit fuses etc?) is the fan circuit.

Would you use the same circuit as the relays for this or something else perhaps with an opto?

Thanks again,

Andy


Back from work.

I've just followed your link and looked up your "relays". These are Solid State Relays "SSR"s containing a triac that is triggered using an LED inside the package of the relay. (They also have a network around the triac to help reduce electrical noise when it switches.)

As you have already said, the relay just requires 2.5V 25mA to switch it on (because the "coil" is just and LED), so a 100mA transistor will be OK for switching this.

Also since it is just and LED and not an actual coil of wire, you don't need a protection diode across the coil because there will not be any back emf when the current is turned off.

(With a real relay that has a coil, as the current is shut off, the magnetic field collapses and generates a spike of voltage across the coil that can damage other components. The protection diode gives this a safe place to go.)

I am not qualified to advise you on the safety side of the project. Very few people on this forum would be.

In my unqualified opinion, I would expect to see protection such as grounding and fuses on any project using mains voltages. If the project is being used outside or with water or in a wet environment I would expect to see a residual current device to cut off the mains if there is a path to earth. The list is endless.
Mario had some recommendations in the relay enclosure topic.

How much current do the fans take?

Paul

#25 mcinnes01

mcinnes01

    Advanced Member

  • Members
  • PipPipPip
  • 325 posts
  • LocationManchester UK

Posted 23 April 2012 - 05:42 PM

Hi Paul,

Thanks, I will be supplying the whole circuit with 12v 1amp, this is more where question arises from in terms of the transistors. The total load for the componets that the transistors will swich is 55ma, but does it matter if 1amp is flowing through the circuit?

The mains side of my enclosure I feel is pretty solid, maybe there are some additions such as stray current shut off as recommended, the enclosure itself is for indoor use, but near an aquarium so perhaps this is a consideration. The case itself is grounded to the earth terminal and I will run it using a surge protector for its power, plus the power inlet is switched and fused and all the power outlets are fused. I was wondering if I need any fuses or addition protection on the low power side?

The fans draw 120ma each so my total circuit (not including anything lost from other components) is 120ma x 2 + 30ma x 6 + 25ma x 6 = 570ma.

Thanks again,

Andy

Back from work.

I've just followed your link and looked up your "relays". These are Solid State Relays "SSR"s containing a triac that is triggered using an LED inside the package of the relay. (They also have a network around the triac to help reduce electrical noise when it switches.)

As you have already said, the relay just requires 2.5V 25mA to switch it on (because the "coil" is just and LED), so a 100mA transistor will be OK for switching this.

Also since it is just and LED and not an actual coil of wire, you don't need a protection diode across the coil because there will not be any back emf when the current is turned off.

(With a real relay that has a coil, as the current is shut off, the magnetic field collapses and generates a spike of voltage across the coil that can damage other components. The protection diode gives this a safe place to go.)

I am not qualified to advise you on the safety side of the project. Very few people on this forum would be.

In my unqualified opinion, I would expect to see protection such as grounding and fuses on any project using mains voltages. If the project is being used outside or with water or in a wet environment I would expect to see a residual current device to cut off the mains if there is a path to earth. The list is endless.
Mario had some recommendations in the relay enclosure topic.

How much current do the fans take?

Paul



#26 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 23 April 2012 - 08:53 PM

Hi Paul,

Thanks, I will be supplying the whole circuit with 12v 1amp, this is more where question arises from in terms of the transistors. The total load for the componets that the transistors will swich is 55ma, but does it matter if 1amp is flowing through the circuit?

I think you are saying that you have a power supply that is rated at 12 Volts 1 Amp. The power supply should supply 12 Volts all the time, but the 1 Amp is the limit of the current that can be taken from the power supply. If your components don't need that much current then they will not take it.
For example, if you just connect one LED with a resistor, the power supply will only supply 12V at 25mA.


The mains side of my enclosure I feel is pretty solid, maybe there are some additions such as stray current shut off as recommended, the enclosure itself is for indoor use, but near an aquarium so perhaps this is a consideration. The case itself is grounded to the earth terminal and I will run it using a surge protector for its power, plus the power inlet is switched and fused and all the power outlets are fused.

In the UK it is possible to buy an RCD plug. Typically these are used for garden tools to ensure the power is shut off if you run the lawn mower over the cable, or drop the hedge trimmer in a pond. Its wired up just like a normal plug - you might consider something like this.


I was wondering if I need any fuses or addition protection on the low power side?

The fans draw 120ma each so my total circuit (not including anything lost from other components) is 120ma x 2 + 30ma x 6 + 25ma x 6 = 570ma.

Since the low voltages are all contained inside your case (there are no wires leaving the case that might fray and short circuit), there seems little chance that a fault will develop, but it would be prudent to add a 1 Amp fuse at the power supply input.

The data sheet for the 2SD882 transistor says it can carry up to 3 Amps - so these will be fine for the 120mA fans.

Hope this all helps - Paul

#27 mcinnes01

mcinnes01

    Advanced Member

  • Members
  • PipPipPip
  • 325 posts
  • LocationManchester UK

Posted 23 April 2012 - 10:03 PM

Hi Paul Thanks for the great answer. In terms of the transistors then, is the the components they are driving rather than the current that comes in to the circuit? I.e. these will have 55ma (30ma from the leds and 25ma from the relays) so the 100ma switching rating is enough? In terms of the fans the transistors I linked will be ok, what rating do I need to look for in terms of the diodes which I guess I will need in this case? Is there any additional components I will need to control the transitor using PWM? Also if I decided to use the pwm from my 2 spare TLC5940 outputs as they are open drains? Thanks again, Andy PS I will definately be using an RCD thanks for the tip

#28 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 24 April 2012 - 06:13 AM

Hi Paul

Thanks for the great answer. In terms of the transistors then, is the the components they are driving rather than the current that comes in to the circuit? I.e. these will have 55ma (30ma from the leds and 25ma from the relays) so the 100ma switching rating is enough?

Andy I think you have not quite grasped what is happening with the current in the circuit. When you put a chain of components in series the same current flows through each of them. So it is just 25mA, not 25mA + 30mA, but the voltages in the chain add up to the total voltage (12V).
This web page seems to explain series and parallel circuits quite clearly. Have a look at the series diagram about half way down:

Posted Image


In your circuit, the battery is actually a 12V power supply, and you have two LEDs in series (one is inside the SSR relay). Your components form a single chain "a series circuit", so the current is the same all the way round, and the voltages add up to 12V.
Try re-drawing the diagram above and write down the numbers around the components.

In terms of the fans the transistors I linked will be ok, what rating do I need to look for in terms of the diodes which I guess I will need in this case? Is there any additional components I will need to control the transitor using PWM? Also if I decided to use the pwm from my 2 spare TLC5940 outputs as they are open drains?


Have you got a link to the fans?

I think if they are typical computer cooling fans they will have an electronic controller built in, it may not be possible to drive them with PWM as this will cause problems to the controller.

Paul

#29 mcinnes01

mcinnes01

    Advanced Member

  • Members
  • PipPipPip
  • 325 posts
  • LocationManchester UK

Posted 25 April 2012 - 05:59 PM

Hi Paul,

The fans are just some salvaged from an old pc, they are 2 wire not the "posh" 3 wire type that have a control signal. These are the fans.

Thanks for the description I get current now, simple things hey! Is there a max amount of current you have to consider at any point or will things just take what they want regardless how much you make available?

Finalising the original transitor queries, they are rated at 100ma for switching does this mean for the load they are switching NOT the current available for the circuit.

And finally in terms of voltage which you disipate with resistors...

E.g. 12v supply - 2.5v from Relay - 2v from LED = 7.5v do you have to make sure voltage is 0v when it gets ack to ground?

So if you have a really simple circuit of the above flowing from the positive supply in that order, do you use 1 resistor before the relay and this should disipate 7.5v leave 4.5v to the relay and finally 2v to the LED resulting in 0v by the time you get to the negative (gnd) of the supply?

Sorry for the simpleton questions, but I just want to make solid my understanding before I go trying to wire up things on my own back without instructions.

Thanks again,

Andy

#30 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 25 April 2012 - 08:30 PM

Hi Paul,

The fans are just some salvaged from an old pc, they are 2 wire not the "posh" 3 wire type that have a control signal. These are the fans.

I am not sure if you will be able to control the speed of those fans with PWM. I know that some fans have electronics in the hub to drive a series of motor coils - that type would probably not like being driven with a PWM signal.

I think you should just give it a go and see what you get.
If they don't work very well, then it might be worth adding a large capacitor (100uF plus) across the fan terminals to help average the PWM pulses into a variable DC voltage.

When you write the software, you will probably want to turn the fans on at full speed at first for a second or so to ensure they start to spin, and then reduce the PWM to slow them to the desired speed. You will have to determine the PWM setting when they stall, and have it as a lower limit in the driver software.

Thanks for the description I get current now, simple things hey! Is there a max amount of current you have to consider at any point or will things just take what they want regardless how much you make available?

If you give them the correct voltage (by using a resistor) then they only take the current they need.

Finalising the original transitor queries, they are rated at 100ma for switching does this mean for the load they are switching NOT the current available for the circuit.

Yes, its for the load they are switching.

And finally in terms of voltage which you disipate with resistors...

E.g. 12v supply - 2.5v from Relay - 2v from LED = 7.5v do you have to make sure voltage is 0v when it gets ack to ground?

Yes, calculate the resistor so that the total voltage adds up to the power supply voltage:
2.5V (relay) + 2.0V (LED) + 7.5V (resistor) = 12V (power supply)

So if you have a really simple circuit of the above flowing from the positive supply in that order, do you use 1 resistor before the relay and this should disipate 7.5v leave 4.5v to the relay and finally 2v to the LED resulting in 0v by the time you get to the negative (gnd) of the supply?

Yes that's right.

Sorry for the simpleton questions, but I just want to make solid my understanding before I go trying to wire up things on my own back without instructions.

Thanks again,

Andy

OK - happy to help.

Remember that all electronic components have to have exactly the right amount of smoke inside them. If the smoke comes out, it is really hard to get it back in again.

Paul

#31 mcinnes01

mcinnes01

    Advanced Member

  • Members
  • PipPipPip
  • 325 posts
  • LocationManchester UK

Posted 13 June 2012 - 10:46 PM

Hi I am still playing around with some transitors and an led I have PNP 2n3904 and NPN 2n3906. The led has 12v and resistor going in to it that then goes to the collector. Pin 10 on the netduino goes through a 2k resistor to the base and the emittor goes to the 12v gnd and the netduino ground. The problem I have is that although the LED is going on and off, it never goes fully off. I.e. it switches between half and full brightness. Any clues? Andy

#32 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 13 June 2012 - 11:50 PM

Hi

I am still playing around with some transitors and an led I have PNP 2n3904 and NPN 2n3906. The led has 12v and resistor going in to it that then goes to the collector. Pin 10 on the netduino goes through a 2k resistor to the base and the emittor goes to the 12v gnd and the netduino ground. The problem I have is that although the LED is going on and off, it never goes fully off. I.e. it switches between half and full brightness. Any clues?

Andy

Andy,

Are you using a pulldown or pull resistor?

Chuck

#33 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 14 June 2012 - 04:30 AM

Hi

I am still playing around with some transitors and an led I have PNP 2n3904 and NPN 2n3906. The led has 12v and resistor going in to it that then goes to the collector. Pin 10 on the netduino goes through a 2k resistor to the base and the emittor goes to the 12v gnd and the netduino ground. The problem I have is that although the LED is going on and off, it never goes fully off. I.e. it switches between half and full brightness. Any clues?

Andy


If I understand correctly the wiring, you can't use a PNP transistor, but a NPN.
Here is a couple of pictures that show how to drive a led with both a NPN and a PNP: http://www.electroni...ommande-led.php
The article is in French, but the pictures are clear anyway.
Cheers
Biggest fault of Netduino? It runs by electricity.

#34 mcinnes01

mcinnes01

    Advanced Member

  • Members
  • PipPipPip
  • 325 posts
  • LocationManchester UK

Posted 14 June 2012 - 07:41 PM

Hi this is exactly what I have done with an npn, as I said you can see it half working in that it goes from half brightness to full brightness.

Posted Image

#35 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 14 June 2012 - 09:21 PM

Hi Andy,

I think you have the transistor the wrong way round.

The data sheet shows (from left to right) "E B C" when the flat side faces the Netduino in your layout.
You need "C B E" - so try turning it 180 degrees.

(I am viewing this on my Palm with a very small screen - so appologies if I am mistaken about the layout.)

Hope this helps - Paul

EDIT:

One other thing is that the 2N2906 is actually the PNP transistor according to the data sheet.
You want to be using the NPN 2N2904, data sheet.

#36 mcinnes01

mcinnes01

    Advanced Member

  • Members
  • PipPipPip
  • 325 posts
  • LocationManchester UK

Posted 26 June 2012 - 11:46 PM

Thanks Paul you hit the nail on the head.

Here is a post with a video of my working prototype: Netduino Relay Control Board

#37 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 27 June 2012 - 06:32 AM

Well done - happy to help. I think I'll have to learn how to use youtube myself one day. Paul




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.