EveryCircuit
Contact
Reviews
Home
pieman711
modified 3 years ago

Vivarium controller

7
33
267
03:10:48
Schematics to control the led lights and fans for a vivarium using the gpio from a raspberry pi. The two lamps would be the fans (1.6 watt at 12v from a PC case) the MOSFET would be IRLZ34NPBF. Does it matter what resistance the pull down resistors are? How would you calculate what would be appropriate? Would this set up work with the pwm output from the pi to control the brightness of the led?
published 8 years ago
rich11292000
8 years ago
You want the resistors in the 100kohm range or pulldowns (no math from me though). Pwm will work on both mosfets.
2ctiby
8 years ago
Regarding the Nmosfet pull-down resistor only: When you turn on a Nmosfet fully with an appropriate gate V, all well and good. Disconnecting the gate supply does not normally switch it off though, the gate needs instead to be actively pulled down towards zero V to discharge the gate capacitor and so turn it off. So the lower the pull-down resistor ohms the better to obtain fast pull-off...and such a fast pull-off is important for high frequency switching. The main problem with a low ohm pull-down resistor is that other current will be directed through it as waste. So keep the pull-down resistor value high unless you really need it to be low for fast (high frequency) switching. A 'normal' pull-down resistor is between 5k and 20k ohms...the higher the better for economy and purposely desired delay, but for high frequency switching you may need to lower the ohms considerably....The choice is yours...see what works best in your circuit. (Note...with gate ac or some pulses, the nmosfet may be pulled down automatically, so this resistor is not always required...depending on how fast the Nmosfet is needed to turn off). The datasheet for your transistor states between 2 an 4 V for the gate thr, so I would stick to a VTO of 3V to be realistic. I see that you have played with the other mosfet settings (good)...but they may need adjusting...can't deal with everything here at one go!....hope you enjoy the messing around like I do.
pieman711
8 years ago
Thanks for the really helpfil replies. I spent a while fiddling with the parameters (and a lot of googling) to try and get them to be accurate. Ill have another fiddle with different level resistors
2ctiby
8 years ago
On reflection, I see that you are using 3.3V for the gate voltage, so I would advise 2V for your gate thr (not 3v)....that is because the drain current action nearly all happens in the first volt increase after gate thr (so setting thr at 2v gives you a clear volt to utilise here). Having said that, your datasheet transistor can throw about 25A through from drain to source in that first volt, but your EC mosfet transconductance setting greatly restricts that real ability....hence the need to alter your transconductance setting ....but this may be too much to absorb in one go, so let's take it as you get to things gradually...just alter that VSO to 2v for now and see what goes.
pieman711
8 years ago
I am going to be using a 12v power supply to drive the fans and led lights. The logic power will come from the pi gates that I'm fairly sure is 3.3v. I want a circuit that should hopefully keep the pi safe from the 12v. Do yiu think the MOSFET I described above is appropriate and I've put it in wrong for the parameters above, or will i need to look for a MOSFET that behaves as you describe?
2ctiby
8 years ago
Your mosfet can handle a lot more than you are going to throw at it from what you describe. I don't use a pie, but you could check its voltage for gate use on the mosfet. ...... your mosfet can handle ±20v gate so I can't envisage any problem there if you wire things correctly. Your EC setting for the transconductance is wrong...Notice how much current is passing through the left LED (624mA) compared with the 666mA current which you have given it in its setting. Your setting is not letting enough current flow from drain to source during the one volt increase from the gate threshold starting volt amount (from 2 to 3 v)....Transconductance is the amount of current for that one volt basically, ie Amps per Volt measured in siemens, uppercase S on the datasheet. (It is the inverse of ohms and used to be called mohs....I/V   instead of ohms which is V/I).  Notice also the volts between the LED and earth...  36.1mV Now alter the transconductance in the mosfet settings to its maximum and see how the current there increases and how the volt drop across the mosfet reduces greatly, thus saving power loss there with bad heat. The transconductance equivalent is called KP in EC settings. Doing this will not effect your real mosfet which will let a large current quickly through, but understanding these things and getting them to work on EC will help you to know what to expect and why a mosfet may overheat if you introduce a resistor which causes a large volt drop across the mosfet. As a side issue...remember that a fan is different to a lamp....use a current limiting resistor where appropriate, and flyback diode where necessary to prevent back EMF from any inductor....thinking about care with your pie here.....I am no expert in these things....I just hope this info is correct and can be of use to you.
2ctiby
8 years ago
See on youtube 'power Mosfet magic' by Dorian McIntyre for a visual aspect. If your mosfet doesn't work or if it gets hot then it may be that 3.3v is too low for its gate.
pieman711
8 years ago
Thanks, that's all really helpful and given me lots to think about and play with. I have put a diode in parallel with the "motors" (and reversed) to act as a shield from emf. Would it work as shown?
2ctiby
8 years ago
It all looks basically good apart from implementing the possible alterations mentioned....I would raise that gate pull-down resistor as a first real alteration and remember to use other resistors where necessary (I tend to use LEDs as default 2v with resistor rather than altering the LED voltage...just as a reminder when looking at the EC schematic)....A little courage needed to risk your pie, but you could try any other 3 to 9v gate before connecting that just to check if the mosfet circuit is working.....let us know how things go.
2ctiby
8 years ago
Here is a simple youtube pwm setup using an arduino rather than a pi, you may get some general tips from it. 'Arduino motor interfacing using Mosfet and PWM' by Dorian McIntire.
faceblast
8 years ago
drive the gate off the supply with a drive transistor. 3.3V is not enough for a power fet; they need a wallop of power to switch on fully. never drive anything directly from a microcontroller, they don't have the nuts.
pieman711
8 years ago
Ok, thanks again for all the input. If I play with the settings and save the layout it shouldn't delete these comments should it...
pieman711
8 years ago
Had a little play and saved it without loosing all these comments (phew). I've been scouring the internet looking for a FET with a low gate threshold but still uses a through hole mount (anything else is below workable for my soldering skills). Could I rework it to have a transistor or optocoupler from the 3.3v that activates the fet on a 12v rail. Would that leave the pi vulnerable from the 12v rail? Would the fet even be necessary?
faceblast
8 years ago
yeah transistor is easiest for driving. look at my circuit list for plenty of examples
2ctiby
8 years ago
Nmosfet 1 to 2.5 Vgs (th) FQP30N06L (logic level mosfet) Your schematic works well now, but I would increase that 1k resistor at the lamps....that low value may divert most of the current back to earth rather than supplying enough with a higher V at the gate. You could also try a small 1k resistor at the 3.3v source which then would act as a divider point between these two for the gate as well as giving a little peace of mind for protection to your pi there. As a side issue, the length setting of the mosfet allows more flow when turned anti-clockwise to a lower value. With more intricate schematics involving higher frequencies you may need to alter each of the settings to find a good working balance for EC rather than just turning the dials to full.
pieman711
8 years ago
Thanks for having another look. I meant to mention earlier that i altered the led voltage as the lighting I am using is a complete unti of series of LEDs and resistors. It says it is rated at 8w and 12v.
pieman711
8 years ago
Ok. I'm going to take the step out of theory and into the lab. I'm thinking of getting the following parts... 2xs FQP30N06L MOSFET transistors. 2xs 20kohm resistors. 1xs 1n4007s diode. Plus the two small dc fans, strip of LEDs and the all important pi. Does that sound ok?
2ctiby
8 years ago
I'm not qualified to give directions for responsibility, so you are on your own...we have to take the plunge at some stage with our designs....good luck...if it doesn't work then you may just need to try altering those earlier mentioned resistors. The fans current and power might be the main thing to consider rather than the mosfet/pi operation as a side issue which has not been mentioned yet....shouldn't be a problem though if they are 12v and your 12v dc supply is adequate.
rich11292000
8 years ago
Hey will the led emit the light spectrum that you need for your environment?
2ctiby
8 years ago
@rich11292000 interesting point as a side issue. @pieman711 I would put the series 1k resistor mentioned earlier at the gate source as a protection for your pie as a first shot (preferably as a pot that you can decrease if it is too high with a no go, or if excess heat at the mosfet is noticed).
pieman711
8 years ago
Sorry, I forgot about the series resistor. Would that be between the pi logic out put and the gate? For both the leds and the fans (the lamps on the simulation) circuit? @rich11292000 yeah its an led light fitting from an aquarium that should be good for my set up. Its for carnivorous plants rather than any animals/reptiles so less of a problem if it all goes wrong
2ctiby
8 years ago
I would put each 1k where your switches are at the moment at the 3.3v pi output to mosfet gates, but if the mosfets will not activate then they may need to be reduced or removed...hence pots are more convenient. A compromise if at first they don't work, would be to lower the resistance and do likewise with the pull-down resistance....just a bit of playing around really before the most drastic measure of no resistor at all from your pi 3.3v output to gate....I would be careful about lowering the pull-down resistor much below 5k though, because that is heading towards shorting and it won't help supply the mosfet.. Another side issue : How powerful are your fans, can your 12v handle them without running a battery down and is there a suitable fuse.
pieman711
8 years ago
The fans are small dc pc fans (about 2inches square) they're 1.6 watt 12 v fans. To start with I was going to try and use some batteries but once it was fully working I was hoping to run it from a 12v 1a dc power supply.
2ctiby
8 years ago
Motors such as fans are inductive, unlike straightforward LEDs...These fans are small though, so you may not need schottky diodes and capacitors (although a 100nF cap may not come amiss in parallel with your diode). If you only want PWM for the LEDs, then your fans will need to run from a different non-PWM pin, which you are already planning on?...Any thoughts on heat sinks for the mosfets?
pieman711
8 years ago
Yeah they will be running from different pins. What does the capacitor add to the circuit? I understand the need for the reversed diode to safely discharge voltage spikes. Haven't thought about heat sinking yet. I've got some parts on order so will let you. know if they're heating up. Is it a simple case of attaching a flat bit of metal to the flange of the MOSFET and making sure they don't touch?
2ctiby
8 years ago
A small capacitor accross the motor will reduce the electric noise, so I am told, but I'm not an authority. Likewise any chunk of metal attached to the mosfet should divert heat, but keep it all isolated from other parts....Probably best to just have a go now rather than worry about over complicating a simple circuit....all good experience and learning....keep the fun without worrying too much.
pieman711
8 years ago
Will do. Thanks for all of your help! Now just need to wait for my parts to arrive!
2ctiby
8 years ago
For interest...I have run a similar setup using an arduino with 5V PWM as shown to a IRF540N non-logic mosfet gate (its datasheet says Vth 2 to 4 ...so even if mine is a 4, the Transconductance of 16A makes it fine at gate approx 5V, considering my low current cp 16A)...That should make more sense if you read here:   http://everycircuit.com/circuit/6359306484318208     just be careful of heat and use thick enough wires and not a breadboard if you decide to flow more than half an amp or so somewhere. I only used the LED part because I don't have a motor lying around, but the LEDs dim nicely with a simple pot input....a motor should act similar....be sure to connect the negative side of your fan motors to the mosfet drain....and ensure that your diode is connected the right way round.
2ctiby
8 years ago
I have done some calculations for your described setup with those mosfets...I think that the power dissipation is well low so that you should not need any heat sinks....not sure whether a solderless breadboard can handle the LED batch plus fans current though....it is a bit near the mark perhaps....some boards are better than others..... are you thinking in terms of solderless breadboard?...perhaps someone can advise here on breadboard wattage use?
pieman711
8 years ago
Ive got all of the components and a bread board to play with now. annoyingly I've got an essay to write so may not have much time spare this weekend. If i get. A chance I'll try it with the fans first. If that goes well I may cautiously try the led strip on the bread board. Will need to have a play with the pi programming too. Hopefully have something to feed back shortlyish
pieman711
8 years ago
I've finally gotten all those annoying things out the way and have been able to play with the set up. I've just tried it with the led strip and it works perfectly. The MOSFET doesn't get hot and all seems to behaving as intended. Will try the fans tomorrow
2ctiby
8 years ago
That's good news....look forward to the next installment....just be careful to get that diode the correct way round, else the mosfet could blow in a second.
pieman711
8 years ago
Yeah I started with the LED because it sounded safer. I've had a play with PWM to fade the LEDs and seems to work well without heating the MOSFET at all.

EveryCircuit is an easy to use, highly interactive circuit simulator and schematic capture tool. Real-time circuit simulation, interactivity, and dynamic visualization make it a must have application for professionals and academia. EveryCircuit user community has collaboratively created the largest searchable library of circuit designs. EveryCircuit app runs online in popular browsers and on mobile phones and tablets, enabling you to capture design ideas and learn electronics on the go.

Copyright © 2023 by MuseMaze, Inc.     Terms of use     Privacy policy