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

Netduino Stops when switching relay through transistor


  • Please log in to reply
4 replies to this topic

#1 Imi3est

Imi3est

    New Member

  • Members
  • Pip
  • 4 posts

Posted 04 November 2012 - 10:01 PM

Hi! I trying to use an 5V relay with Netduino but after hours I still have the same problem. I try to swith the relay though a BC182 transistor. The transistor works, but when I turn on and off the relay the netduino's onboard led turns off (with a little fade effect) and it stops working. The current of relay is around 60mA. I use paralell diode in the right direction, and I use an 1kOhm base resistance. I figured out that If I use the external power supply (5,2V) through Vin then it is much more stable, but one time it halted with this configuration also. I tried to connect the exernal 5,2V to netduino's 5V -> The netduino started properly, but on the first relay switching on - it halted. I tried it with pnp transistor also but the symptoms are the same. So I think the relay creates some kind of noise which kills the netduino. I ordered an opto isolator so I hope it will solve the problem. But I think it should work without it. Does anybody have some idea? Thanks!

#2 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 04 November 2012 - 10:17 PM

It sounds like the power supply is being shorted out. Could you show us the circuit schematic, or better yet the actual wiring? Does any part of the circuit get warm or hot (e.g. the transistor or Netduino regulators)?

#3 Nobby

Nobby

    Advanced Member

  • Members
  • PipPipPip
  • 70 posts

Posted 05 November 2012 - 06:09 AM

As CW2 mentioned, a short could be occuring. Do you have a series resistance on the transistor collector or emitter? Another cause could be your base resistance. 1kOhm is too small. Assuming you don't use an emitter-follower BJT configuration, the base current into your BJT is 3.3V/1kOhm = 3.3mA. This current might seem small but BJTs have a current gain of at least 50 for common BJTs. When your control pin goes high, the BJT will try to draw 165mA from the 5V regulator. When you try to pull too much current from a supply, the voltage of the supply will dip and cause a reset of the Netduino. You should find out what the gain of your transistors are and calculate the base resistance to work well with your relay. For example, you need about 60mA to operate the relay and your BJT has a gain of 100. The base resistance needs to be in the ball-park figure of 55kOhms. Actual(peferred) values you can buy close to that at 56k and 47k. 56k will give you less than 60mA so I'd choose 47k in this case. For saftey, you probably have or should have a series resistor connected to the BJT collector or the emitter. If you drive a BJT hard enough, it's collector-emitter voltage can go down to 0.3V. If you don't have the series resister in there, you can virtually short the 5V rail and cause the Netduino to reset and possibly damage the board. Since your relay runs on 5V, you have to have a small series resistance so that the drop across it when you draw 60mA is small. Secondly, you don't need the anti-parallel diode since it's only for dealing with protection against negative voltages.

#4 Imi3est

Imi3est

    New Member

  • Members
  • Pip
  • 4 posts

Posted 08 November 2012 - 10:14 PM

Hi! Thanks for help! Finally I found the problem with Nobby's tip. I changed the base resistance from 1k to 6k and it works now in every variations. However I don't understant totally because I think that the relay's inner resistance limits the current to 70mA. So I don't know why is it a problem if the transistor's gain is too high. By the way I use a BC327-40. As I checked the datasheets its gain is above 250. Now it works, so thank you!

#5 Nobby

Nobby

    Advanced Member

  • Members
  • PipPipPip
  • 70 posts

Posted 09 November 2012 - 01:03 AM

Hi!

Thanks for help! Finally I found the problem with Nobby's tip. I changed the base resistance from 1k to 6k and it works now in every variations. However I don't understant totally because I think that the relay's inner resistance limits the current to 70mA. So I don't know why is it a problem if the transistor's gain is too high. By the way I use a BC327-40. As I checked the datasheets its gain is above 250.

Now it works, so thank you!



Awesome work!!


250 gain is pretty high for low power circuits and 6k would be a lot better than 47k in your case. When you design in the future, transistor parameters are important. High gain will usually mean a higher forward-bias base current and larger voltage drop from base to emitter which means you'll choose a smaller base resistance etc.


As for the relay, devices like that don't have the capability to regulate/limit current unless they switch off from over-current(built in protection) so it's important to do power calculations for your transistor circuits. The current in simple circuits like this are always determined by the voltage level of your power source (i.e. 5V) and the total resistance/impedance of the circuit path the current is travelling along. If you follow those fundamental rules in design then your systems will function predictably and safely.




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.