Go Down

Topic: new to aurdino, simple ATTiny85 project questions. (Read 365 times) previous topic - next topic

gghouck

Hello, I've dabbled in electronics for 40+ years but have not really made a dent in understanding it much. I've started a project for my boat, which is to have a way to make the overhead lights pulse SOS if need be. I have gotten the bulk of it done, I have the tiny programmed and blinking an LED perfectly. My plan is to make it switch an marine grade 12volt relay. Am I correct that a MOSFET is the way to have the ATtiny85 control 12 volts that will activate the relay? If so, which do I need or what should I be looking for? Any help will be appreciated. I have searched the forum but don't know if I know what I'm looking for. Thanks, Greg

steve_mcdonald


Hi Greg,
first, select the relay you want to drive which has a contact rating to suit the lights you need to drive.  Note that the current at switching will be very high compared to the working current, and since you will be pulsing the contacts to generate your SOS, you need to rate the contacts effectively at the instantaneous current draw for cold lamps (more or less).  This is if your lamps are incandescent, because those lamps draw a very high current when they initially switch on since the filaments are cold and their resistance is very low - it increases as they heat, and the current reduces.  Note that pulsing incandescent lamps causes them to constantly switch from off to on, and that will reduce their lifetime  - which could be an issue when you most need it.  If the lamps are LED, then this does not apply.  

Now, I have no idea what power lamps you will drive, so can't offer any suggestion, but for example, if the total wattage drawn by the lamps when on is 120 watts (2 x 60 watt lamps for example), then the current draw when on and warm at 12v supply would be 10 amps, so when cold current draw could be several times that for a brief period; you might want 20 or 40 amp contacts. 

Okay, you now have a relay.  The coil voltage is 12v.  The coil current to activate might be, say, 120 milliamps (it will be on the datasheet).    You will need a MOSFET that can source or sink the activation current.  In your case, you need not worry about holding current so much as you are pulsing it off and on, so the relay is effectively drawing activation current much of the time.  

There's a bunch of background design stuff that an engineer would include in determining the correct MOSFET, but to simplify, you need to think about the Gate trigger (or threshold) voltage called VGS, which needs to be triggerable by the microcontroller logic level high (3.7v or higher in ATTINY (I think, I don't use ATTINY units, so check the datasheet)), and the maximum current draw (IDM).  You could for example use FQP30N06L60V LOGIC N-Channel MOSFET, which can handle up to 60Amps and dissipate 79Watts of power.  This will likely be far more than you need, but it is a stable and reliable MOSFET and is easily triggered by microcontroller signals being specifically designed for that use. 

Have a look at that or a similar logic level MOSFET and if you have questions, just ask.

WattsThat

You do not need or want a relay. Totally unnecessary or desired.

Driving a 12 volt LED is simple to do with just the mosfet mentioned in the post above. It will handle several amps without a heatsink. Connect as below, substituting 12v for 24v. Original image by member sterretje.

Vacuum tube guy in a solid state world

gghouck

Thanks guys, I have a couple of those Mosfets coming. There's a wealth of information you're giving, I do appreciate it. So one thing that confuses me is how the transistor dissipates 79 watts of power.  Does that mean that is the maximum power it can transfer? The lights are 55watt at 12volts and there is 2 of them wires parallel but will likely be operating at more like 14 volts with the engine running. That puts the wattage of each closer to 70 watts.  Am I on track here or missing something? One of the reasons for using the relay is because the lights will also be operated by a switch for continuous use, although I do believe I could do the same with little modifications (a diode and wire the switch to power the gate).  

steve_mcdonald

Hi Greg,
It's possible WattsThat was thinking you were driving LED lamps and his reasoning may be that the power requirement would not justify a relay.  Given you're driving 55 Watt lamps at 12v (the 14v is probably no load voltage?) 2 x 55 watt lamps give a power of 110Watts.  110W at 12v will draw 9.2Amps, and remember that's warm running current.  If you assume double that current at turn on, you are within the 32A maximum continuous S-D current limit and well within the 128A pulsed current, so the FET could suffice.  

The instantaneous draw at the point of contact switching (or turn-on) will be higher due to the cold resistance of the lamps being far lower than the warm resistance, so if you go with the relay, the contacts will suffer a contact point current surge which may be several times that and usually we'd specify at least double for the relay contacts.  You want them to last the distance.  If you choose not to include a relay, then I'd strongly recommend a heat sink on the MOSFET, and that calculations for that are pointed to in the datasheet in the Thermal Characteristics section.  

 "Does that mean that is the maximum power it can transfer? " The power dissipation of the MOSFET refers (essentially) to the heat generated (in Watts) at the junction during saturated current at the junction resistance (at 25 degrees C).  It's not so much the power transferred, but for simplicity, you can more or less assume that it's related to the maximum load power that can be supported.  There's a whole lot going on in the darkness inside that MOSFET, and that's an interesting study in itself, but not necessary to know all of it to make use of them.  It's also related to whether the Gate is saturated (fully turned on), which is why it's important that the microcontroller logic level can saturate the Gate, therefore why you need a logic level MOSFET.  


It would be interesting to know what you end up doing and how it works out.  Please let us know, and any questions, ask!


 

WattsThat

The easiest and best way to handle a switch that will turn the device on is to route that switch to an input on the microprocessor then perform an OR function in logic to turn on the output. You could use diodes to or the signals together at the cost of some gate drive voltage, about 0.3 volts with a Schottky diodes. That's kind of iffy at the high currents being discussed.

The power dissipated in a mosfet is given by I^2R where I is your load current and R equals the on resistance of the mosfet. The FQP30N06 is probably not capable of handling 110 watts driven with an Arduino output. The datasheet doesn't provide an actual output resistance at a gate drive of 5V so its not easy to directly calculate the wattage dissipated by the device.

You could probably drive the LEDs individually, dropping the load on each mosfet in half, which would be more manageable with a smaller heatsink. Another option is to find a different mosfet with lower on resistance which lower the dissipation in a linear fashion. Given the 12 volt environment, a logic level mosfet isn't absolutely needed since it could be driven with a higher voltage although it complicates driving the device a bit, requiring a transistor or another mosfet to drive with a higher gate voltage.

Also, LEDs have no inrush current.
Vacuum tube guy in a solid state world

gghouck

#6
Jan 13, 2021, 01:57 am Last Edit: Jan 13, 2021, 02:36 am by gghouck
Thanks. the lights are not LEDs, rather halogen lights. It is not possible to drive them individually due to the wiring, there simply is no room for more. Is it possible to drive two MOSFETS in parallel as opposed to a bigger one?

Edit: I'm looking at the IRLB8721PBF, seems capable. What do you guys think?

WattsThat

Yes, mosfets can be paralleled but getting things to load share properly is not a simple task and it would not be advisable.

Sorry about the LED assumption, not sure where that originated. Now that you state it's halogen, that's about as bad as it gets since the turn on inrush can be 7-10 times running current. So, forget mosfets for now. Back to the relay, maybe. Even the relay may not survive especially when banging out Morse code. DC has a way of pitting relay contacts very quickly, even at 12 volts.

Do you have a link to the relay? Part number?
Vacuum tube guy in a solid state world

gghouck

I don't have a part number but it's an automotive relay, marine grade, 40A. With any luck, this won't be used, only for emergencies. 

gghouck

Also, is there a way to reduce the initial inrush of current through the relay? I was thinking about maybe a 1 ohm resistor inline with the lights.
 

CrossRoads

IRLB8721 looks like a good part, until you read Note 3 on page 9:
(3) Pulse width ≤ 400μs; duty cycle ≤ 2%.

Compare that to AOD508, which has lower Rds and no pulse limits.
With Rds of .0044 ohm and 9.2A, it will have to dissipate Power = I^2 x R = 9.2A x 9.2A x 0.0044 ohm = 372mW.
Won't even need much heatsink.
http://aosmd.com/res/data_sheets/AOD508.pdf


It's an SMD part, so you'd probably want to use a  TO-252 adapter to make it easier to attach to the pins.




Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

gghouck

Thanks, I appreciate the help. It is clear I need to take some courses in electronics. 

gghouck

Ok so I received some FQP30N06L N-Channel  mosfets but am confused on how to implement them. Am I correct that the source goes to ground, the gate goes to the pin which is switched by the aurdino, and the drain goes to the ground of the circuit, opposite of the positive input. I am really confused on this. Thanks, Greg


WattsThat

The diode (D1) is required if the load is inductive.

Vacuum tube guy in a solid state world


Go Up