Get your Geek on and control your grow room with Arduino!

ChiefRunningPhist

Well-Known Member
Relays are great and offer physical isolation due to their mechanical operation, but if you don't need isolation, just need a switch, then MOSFETs are real nice and easy components to work with, they are smaller and cheaper than relays and can switch at very fast speeds, like 1MHz+, or on & off at 1 million times a second.
51D4ah9yZoL._SX342_.jpg
They can be rated up to 600V and higher, though mostly are 200V or less for power MOSFETs (bigger beefier switches), and 60V or less for LL MOSFETs (LL = logic level). They require much less power to operate (LL = 5V or less but microamps, or millionths of an amp, power FETs typically need 10V - 18V to work but again at only millionths of an amp, so total power is very low). This allows for you to PWM or control loads that require more power than the esp can produce at each of its GPIO pins.

A GPIO might be able to power an LED or 2, but much more and you're not going to have enough power. So you'd wire your load or LEDs in series with a bigger PS, like a battery ect, and then also wire the MOSFET in series. This way when the MOSFET is on, the cct flows current through the load/LED, but when the MOSFET is off the cct is broken and can't complete so the load/LEDs aren't energized and off. By varying how many times you turn the MOSFET on in a second, as well as how long you turn it on per switching cycle (1 on/off event) you can very how much current is flowed on average. Increasing your PWM duty cycle to be ON for longer than its OFF will make more current flow, and by reducing duty cycle so that your MOSFET is OFF for longer than its ON will reduce current flow, or dim. The quicker you switch, or the more on/off events per second, then the less noticeable the switching is. If you turned an led on for half a second, and then off for half a second, you'd see a strobe rather than a smoothly dimmed light, but if you switched many times in a second you'll see less strobe and more of a smoothly dimmed light. PWM is not just for lights but for anything requiring a dimming transition, like motors ect. You can trigger MOSFETs with your arduino without a shield and your MOSFETs can then be the gatekeeper for your other devices getting power or not or dimming them via PWM ect.

Just like relays, MOSFETs come in all sizes and electrical parameters, so you'll want to shop for FETs that can handle the voltage and current of your cct. N channel MOSFETs are placed after your cct, or close to ground or negative, and P channel MOSFETs are placed before your cct or close to positive. There's all sorts of FETs, some that are initially on (depletion) some that require voltage to turn on (enhancement). P channel MOSFETs have greater resistance when they are switched on and allowing current to flow, so they are less used over their cousin the N - channel MOSFET which has very low resistance when it's on and allowing current to flow.

Armed with a bit of code and utilizing MOSFETs or other switches, you can turn on/off several devices that require more power than the esp can produce. You can dim as well with the PWM function. Imo pretty much all the grow room stuff can be controlled by on/off or PWM (fan speed ect).

Here's a quick schem/graphic showing a MOSFET in series with a seperate power source and a single LED. The MC or microcontroller (esp), and the peripheral cct both share the same ground. The MC GPIO pin is attached to the gate of the MOSFET and in this particular example once a small voltage is sent to the gate the MOSFET turns on and allows current to flow from the batteries, then through the LED, then through the MOSFET, and then to the negative side of the batteries, or GND (ground).
0115201323.jpg

EDIT:
Its a good idea to use some resistance, ie a resistor, in series with LEDs in case your cct isn't current regulated. So in this example I'd want to add a resistor somewhere in the loop because its a voltage source. Voltage source means the voltage is the fixed variable while as much current can flow as the cct will allow, a Current source means current is the fixed variable and voltage will adjust automatically to whatever is needed to flow the fixed current of the current source.
 
Last edited:

spek9

Well-Known Member
Northern Alberta outside a little town called BumF**K! lol Hate it here.
I figured. We're the only two provinces that are getting hammered. I live on the Shuswap in BC now, but up until late last year, I lived way up near Alaska (only moved because I was forced out due to forest fires). That was far outside of BumF**k as well. Sparsely populated, several KM between neighbours. Was starting a self-sufficient lifestyle until the damned fires. It's -45C up that way today (a balmy, t-shirt wearing -16C only where I am now :) ).
 

ChiefRunningPhist

Well-Known Member
Most transformers are isolated. Sometimes theres a capacitor connecting both coils but in general the way the transformer works actually creates isolation naturally. If the 2 coils were connected with a jumper or weren't isolated from each other, then you'd have no step up or step down possible because the current flowing through 1 coil would be the same as the current flowing through the other coil. The voltage would be almost the same and the only difference would come from the voltage drop in the resistance of the coils which would be very small. There wouldn't be 2 coils anymore, just 1 coil with a jumper connecting both halves.

A variac is big because it has to operate mechanically and you can get better precision working with mechanical devices when you increase the size. The variac has 2 coils, but also has an arm that slides along the second coil to change the voltage being output. Its hard to explain in words, but transformers' voltage is in relation to the number of turns per coil.

Vout = Vin (turns on coil 2)/(turns in coil 1)

So if you had 120VAC mains, and you had a transformer with 2 coils, the first coil (primary) had 20 turns around the core, the second coil (secondary) had 10 turns or wraps around the core, then your voltage out will be 60VAC. You will have stepped down the voltage.

A variac has 2 coils, both have a set number of turns that doesn't change, but when you rotate the dial, a lever/wiper arm slides along the wires making up the second coil, such that you're essentially changing the number of turns on the second coil, which then produces a different voltage from the input. Most transformer coils are insulated with plastic or some coating (like with magnetic wire, it looks like bare wire but its actually insulated), but with a variac you're actually using bare wire for 1 of the coils so that when your lever/wiper arm slides over the wraps it shorts the current to the lever/arm rather than going through the entire coil.
voltpac_catalog.p.8-001.crop1a3C.big.crop1.jpg
trasformatori-elettrici-29-638.jpg
variac-auto-transformer-500x500.jpg
Whether you're using an isolated transformer or not, you're still at risk for shock. Imo using a transformer for isolation is not about safety but more about culture. If you've a cct that uses a transformer you can be electrocuted just as easily. If your fingers create a less resistive path for current to flow then current will flow through you regardless if your cct has a transformer or not. Without isolation, you'd sill have to insert yourself in series with the cct to electrocute yourself, this is no different for a cct with a transformer.
Inserting yourself in series can be made difficult (or rather, even more difficult than it already is lol) by insulating parts of your board with electrical tape or hot glue (saw here, good idea), or using conduit boxes or project boxes to insulate the whole board from yourself.
 
Last edited:

OldMedUser

Well-Known Member
I figured. We're the only two provinces that are getting hammered. I live on the Shuswap in BC now, but up until late last year, I lived way up near Alaska (only moved because I was forced out due to forest fires). That was far outside of BumF**k as well. Sparsely populated, several KM between neighbours. Was starting a self-sufficient lifestyle until the damned fires. It's -45C up that way today (a balmy, t-shirt wearing -16C only where I am now :) ).
I almost moved to Stewart, BC in '92 but didn't get the job at the gold mine doing environmental monitoring. I would have loved living up there. Got Hyderized at the Glacier Inn in Hyder, AK when I went up for the final interview Thanksgiving of that year. Got some great fishing in outside Terrace on a small river at a campground the guy at the airport drew me a map of. Got it around here somewhere in case I ever went back.

Let's not hijack this thread now. ;)
 

OldMedUser

Well-Known Member
A variac has 2 coils, both have a set number of turns that doesn't change, but when you rotate the dial, a lever/wiper arm slides along the wires making up the second coil, such that you're essentially changing the number of turns on the second coil, which then produces a different voltage from the input. Most transformer coils are insulated with plastic or some coating (like with magnetic wire, it looks like bare wire but its actually insulated), but with a variac you're actually using bare wire for 1 of the coils so that when your lever/wiper arm slides over the wraps it shorts the current to the lever/arm rather than going through the entire coil.
I figured they worked something like that. Handy units and I use mine mainly to overheat a small crock pot to decarb the pot in the coconut or other oil that I'm making my medicine in. Now for the soldering iron and sometimes to control a fan's speed. I can go to 140% line power and I go to 120% when making my cocobudder. Haven't burned out a crock pot yet and have used it on a full sized one as well.

It's going to be some time before I can design a circuit if ever but I'll plod along once all my stuff is here.

Good info @ChiefRunningPhist but way over my head for the most part. Googled MOSFETs and wikipedia had way more infor than I needed. lol

:peace:
 

ChiefRunningPhist

Well-Known Member
I figured they worked something like that. Handy units and I use mine mainly to overheat a small crock pot to decarb the pot in the coconut or other oil that I'm making my medicine in. Now for the soldering iron and sometimes to control a fan's speed. I can go to 140% line power and I go to 120% when making my cocobudder. Haven't burned out a crock pot yet and have used it on a full sized one as well.

It's going to be some time before I can design a circuit if ever but I'll plod along once all my stuff is here.

Good info @ChiefRunningPhist but way over my head for the most part. Googled MOSFETs and wikipedia had way more infor than I needed. lol

:peace:
Lol ya, all these components get super detailed. I build a basic schematic and then once I know the functional parts I need, I break it down into the exact functional part needed. That's a sweet way to do your crock pot btw! Never thought of increasing the line V to increase the temp, haha very nice. :bigjoint:

Relays have at least 4 pins, 2 that the load current flows through, and 2 that the signal current flows through. MOSFETs, also have 2 pins for the load current to flow through, but only 1 pin needed for the signal current (some current, but MOSFETs are thought of as switches controlled by voltage, and transistors are thought of as switches controlled by current), and very small amount of current is needed. MOSFETs care about which way they're flipped, ie theres a positive side and negative side of the switch, but that's pretty much the jyst. A small signal to the gate pin turns on the MOSFET, just like a small signal to the relay turns on the relay. I'm not pushing anyone to switch their relays to MOSFETs (though when I read my comments it kinda sounds like that lol), I'm just trying to show an additional way to switch things. Each component has its place.

I've puked up a little bit on this tread lol and it's probably not all going to be widely remembered but just for ppl kinda getting into it. I'm not an expert by any means and just passing some of my info that I thought was valuable or pertained to the topic.
 

OldMedUser

Well-Known Member
I've puked up a little bit on this tread lol and it's probably not all going to be widely remembered but just for ppl kinda getting into it. I'm not an expert by any means and just passing some of my info that I thought was valuable or pertained to the topic.
Don't worry about that. Gives nOObs like me direction about where to hunt down further info pertinent to what I'm trying to do.

Sure wish there were stores like the old Radio Shack we had in Richmond, BC where I grew up. Walls and flip over racks of every kind of part or component that you needed often in singles for a couple pennies each. Now you got to buy whole sets like the 2600 resistors and 500 capacitor sets I got now. Only $10 - $20 each but when you only need a few it's a lot that's going to go to waste eventually.

At least I have lots of older analog type junk around I can scrounge parts off of. :)

:peace:
 

ChiefRunningPhist

Well-Known Member
Don't worry about that. Gives nOObs like me direction about where to hunt down further info pertinent to what I'm trying to do.

Sure wish there were stores like the old Radio Shack we had in Richmond, BC where I grew up. Walls and flip over racks of every kind of part or component that you needed often in singles for a couple pennies each. Now you got to buy whole sets like the 2600 resistors and 500 capacitor sets I got now. Only $10 - $20 each but when you only need a few it's a lot that's going to go to waste eventually.

At least I have lots of older analog type junk around I can scrounge parts off of. :)

:peace:
Haha ya I liked going to radio shack too, always had cool RC cars and stuff growing up. And you'll be surprised how fast you go through those resistors. I like the big China TH assortments for breadboarding but Id buy the smd or final components from mouser or digi-key. Then a tacklebox or small plastic storage container can keep them organized (as possible lol).
 

Attachments

spek9

Well-Known Member
Now you got to buy whole sets like the 2600 resistors and 500 capacitor sets I got now.
Do yourself a favour. Get or make a component tester. When you're dealing with hundreds or thousands of parts, they inevitably get mixed up. A tester like that is a wonderful tool to have in the toolbox. If not for identification, it's invaluable as a validation tool (am I *sure* this is a 1.5k resistor?). Much easier and quicker for testing, as it's all dynamic... no need to set up and change your multi-meter and fudge around. Just plug the part in, and be informed immediately as to what it is, and the specifications.

For my diodes, ceramic capacitors, resistors and other small things, I use hockey card books with the plastic pages with nine pouches per page. Each value of the component goes into a pouch, with a label.

My larger components (capacitors, transistors, leds etc) go into small containers with 9-12 compartments. The larger the items (servos, motors, steppers) go into yet larger flat compartmentalized containers (all stackable).

I have numerous of these types of bins full of a ridiculous amount of electronic trinkets, components, ICs, sensors etc.

It has taken me several years to get to a point where everything is organized in a sane fashion, and where I can literally walk into my lab (my home office backs as my electronics lab) and find exactly what I want without thinking about it.
 

OldMedUser

Well-Known Member
Do yourself a favour. Get or make a component tester. When you're dealing with hundreds or thousands of parts, they inevitably get mixed up. A tester like that is a wonderful tool to have in the toolbox. If not for identification, it's invaluable as a validation tool (am I *sure* this is a 1.5k resistor?). Much easier and quicker for testing, as it's all dynamic... no need to set up and change your multi-meter and fudge around. Just plug the part in, and be informed immediately as to what it is, and the specifications.

For my diodes, ceramic capacitors, resistors and other small things, I use hockey card books with the plastic pages with nine pouches per page. Each value of the component goes into a pouch, with a label.

My larger components (capacitors, transistors, leds etc) go into small containers with 9-12 compartments. The larger the items (servos, motors, steppers) go into yet larger flat compartmentalized containers (all stackable).

I have numerous of these types of bins full of a ridiculous amount of electronic trinkets, components, ICs, sensors etc.

It has taken me several years to get to a point where everything is organized in a sane fashion, and where I can literally walk into my lab (my home office backs as my electronics lab) and find exactly what I want without thinking about it.
I got myself a pretty good multimeter recently that does all that stuff the tester does except not so easily I bet. I'm probably good for now and if I do get into it deeper then I can one. This one I just got does diodes, capacitors, transistors. reads voltages thru the wall for tracing wires. Non Contact Voltage. Infrared and a temp probe that's good to 750C. I just used it last week to monitor the temp inside a double wrapped oz of I decarbed to make RSO with.

Decarb01.JPG
 

OldMedUser

Well-Known Member
Just checked on Amazon and found the same tester. Comes in an acrylic case so they want more money for it. I don't feel like getting PayPal to use Ebay so put it on my Wish list at amazon.

 

Timezone

Well-Known Member
Just checked on Amazon and found the same tester. Comes in an acrylic case so they want more money for it. I don't feel like getting PayPal to use Ebay so put it on my Wish list at amazon.
You need one for each hand. ;) The only thing you put together is the case, easy kit.


I recently bought this digital oscilloscope kit and found the case was the only thing that required assembly, another easy kit.


I got these probes to use with it. One for each hand!

Now if I can figure out how to use it... and start saving up for a good dual channel oscilloscope in the future.
 
Last edited:

ChiefRunningPhist

Well-Known Member
You need one for each hand. ;) The only thing you put together is the case, easy kit.


I recently bought this digital oscilloscope kit and found the case was the only thing that required assembly, another easy kit.


I got these probes to use with it. One for each hand!

Now if I can figure out how to use it... and start saving up for a good dual channel oscilloscope in the future.
Lol I got 1 too, can't go wrong at ~$20, you're right a dual channel is the way to go. You can build a multichannel O scope with an arduino and your computer, I use to do it that way. Really doesn't take much at all.


I might pick one of these up. Only $55 and they look pretty decent from the description. It uses your computer or android phone to output signal, and it's dual channel...
 
Last edited:

Timezone

Well-Known Member
I use VNC Viewer to run my Pi from my pc desktop. Had to do some quick research on how to take a screenshot of the PI and then transfer it from the Pi to the pc. Results:

screenshot.png
A command line, a part of a Python program, and the Node-RED Dashboard. There are 19 settings that have to be set in the first column from the left. In the second column are three 24 hour graphs. Note how my heater kicks in and out over 24 hours. Below that is the efco, exhaust fan/CO2, power consumption panel. It shows there is currently nothing running on that outlet box. ;) Third column has current temp/humi/co2 readings. The fourth and fifth columns display the seven soil moisture sensors' readings, five showing high readings as they're hanging in air, and two disconnected. The last column, Status, shows what's on or off. It looks like a column of switches but they're not, just indicators. There is no manual override for any of the controlled devices at this time. Just those 19 settings.

In line 22 of the Python code, notice that the default setting for co2 is 300 (ppm). This is normally much higher when co2 is in use and is set in the Settings column. It's about average for my zone, 300 ppm.

In the shell below the code, you'll notice a status report being generated. This report along with the messages could be sent to one's phone... Later
 

OldMedUser

Well-Known Member
I think I'll hold off on the scope for now. Is this really needed and for what?

We're supposed to maybe get up to 70cm of snow tonight so I'm running to town today for my goodies, transistors are supposed to be in now, and stock up on water and tobacco! Hope the Arduino is in too!

:peace:
 

spek9

Well-Known Member
Is this really needed and for what?
Primarily, I use my oscilloscope when I'm writing drivers and communication software for various ICs and devices. It allows me to verify that I'm clocking in data according to a device's datasheet specifications (I2C, SPI etc), that I'm manipulating a select pin surrounding the transferring of data (SPI) properly, monitoring and verifying signal timing, monitoring interrupt edge changes and watching for signal interference.

They're not required when first starting out in electronics. Once you get in deep enough and gain experience, you'll just naturally learn when one is needed (or will be of significant benefit).
 
Top