High power device and the Arduino... also, hi, I'm new here :) - Page 1
Forum section: electronics / beginners

author: Atheus
author_rank: Contributor
timestamp: March 19, 2017, 03:10:35 am
content: Hi all - I recently discovered Dave's vlog and soon afterwards this forum. I'm just getting "back" into electronics - I am a programmer (having to interface with hardware obviously) so my interest never really went away professionally, but it's something I used to do for fun when I was a kid, and I'd like to make projects for fun again. Also with my experience in related industries and the rise of IoT, who knows, I might even be able to come up with something marketable.My question:I have been thinking about making something using higher power than I can source through the Arduino. I Googled this (as you do) and found this linkhttp://forum.arduino.cc/index.php?topic=219731.0suggesting separate batteries and power supplies... surely this is not required... I have never had to plug a shop-bought device into the wall TWICE with two different grounds (different houses???) so there must be a way.Lets pretend I'm building something WELL beyond the capacity of the Arduino - lets say a Gauss gun or something (I'm not building a Gauss gun...) - which requires a huge surge of current and voltage which would fry any microcontroller. The link seems to concentrate on using the 5v pin (still drawing power from the Arduino) or different power supplies. I want neither.Why not instead of going:Power -> Arduino -> deviceWe go:50v -> device -> voltage drop to 9v -> Arduino-> switching -> high power side... and have the Arduino switch the high power side with a MOSFET or something. Stick a diode in there to prevent noise coming back off the high power side and in my head it should be okay...Am I right? Close? If not, why not? Any other suggestions for doing this?Thanks in advance for any help! Great forum and great vlog~Atheus/edit: or instead of dropping the voltage after the power supply, simply provide a high and low voltage from the same PSU and hook them up accordingly?

author: Ian.M
author_rank: Super Contributor
timestamp: March 19, 2017, 03:53:55 am
content: There is plenty of idiocy in 'Arduino-land' usually caused by lack of understanding of fundamental concepts of circuit design and implementation.e.g. relay boards with optoisolated control inputs. Use one of those and you are now up to three supplies! One for the Arduino, another for the relay drivers and finally a supply for the load circuit. Of course the relays themselves provide isolation so the optocouplers aren't doing anything useful and some boards even have the grounds both side of the optocouplers connected, making them entirely pointless - one might as well remove them and directly connect to the relay driver.The basic problem is ground bounce. If you are switching a high load current, you can get significant voltage transients induced in your ground wiring, and if that causes a voltage difference between the Arduino ground and the ground reference of the driver circuit for the high power switching device(s), you are in for a world of grief - at best unreliable operation and crashes, at worst Arduino and driver circuit destruction. You *ALWAYS* must consider the ground return path for the load current and consider what would happen if an extra voltage drop appeared in that path. Also its advisable to minimise the loop area of any high current load and supply wiring (typically by loosely twisting the two wires together, or on PCBs running the power and ground tracks over each other on opposite sides of the board) and provide local decoupling to reduce the transients. Its further complicated by the Arduino's USB connection, as that ties Arduino Gnd to PC chassis - usually grounded, and often to a different outlet than the rest of the circuit. Get your ground wiring badly wrong and you will not only blow up your Arduino but your PC as well.Another problem is back-EMF from inductive loads. When you switch off an inductive load the current through it tries to keep on flowing, and with nowhere to go, can develop very high voltage transients, only limited by the breakdown voltages of the insulation and the switching device. Unchecked back-EMF destroys switching devices, and as they break down they often take out their drivers and control logic. You *ALWAYS* need to clamp, snub or otherwise dissipate it - even a simple flex running to an incandescent bulb has some inductance and can give you trouble.Then there's over-current protection and heat dissipation issues. If you overload your switching device, it is likely to short, and will frequently also blow the driver and control logic.Output devices blowing is one time that optocouplers are actually useful with a common ground on both sides - they are the ultimate 'firestop' to a failed output device blowing stuff right back to the control logic.Your basic line-up of running the Arduino off a supply derived from your 50V rail is sensible but the details need some attention. MOSFET drivers have typical supply voltages in the 10V to 15V range (although some can go as high as 30V), and as an Arduino can accept Vin in this range its convenient to use the same supply for the driver and the Arduino. However getting down to 12V from 50V is *NOT* a job for a linear regulator. Even if you only need 100mA, that's 3.8W dissipation, so a switching regulator is vastly preferable. You'll want at least a 50% safety margin so one that can accept 75V input will be needed. If the regulator is a simple buck circuit, if it blows, the Arduino and MOSFET drivers get 50V on their 12V rail so it has to be reliable.

author: Cupcakus
author_rank: Contributor
timestamp: March 19, 2017, 07:33:36 am
content: Quote from: Ian.M on March 19, 2017, 03:53:55 amThese cheap relay boards on EBay are a great source of salvaged opto-couplers and relays, I've seen them sell for just a few dollars for the 16 relay version.

author: Seekonk
author_rank: Super Contributor
timestamp: March 19, 2017, 01:10:28 pm
content: I bought a bunch of those relay boards that accepted optp22 modules. They were only 2.75 each and communicated at 9600 baud just like the uno so I tied them into 0 & 1 and used standard serial routines. They were about the same as opto22 Magic boards.I have a solar water application that runs about 15A. I use a vanilla opto isolator chip for isolation and as a level shifter to operate the power FET. That allows me to get 50 feet away from the power being switched and possible ground loops. As you will see in the FET literature, even logic level FET like to see way over 10V to get that low on resistance. An opto and a 600 ohmish pull down resistor make a simple cheap driver.

author: tpowell1830
author_rank: Frequent Contributor
timestamp: March 19, 2017, 01:21:19 pm
content: Hi AtheusWelcome to the forum. You will get a lot of good answers and some good opinions here.

author: rstofer
author_rank: Super Contributor
timestamp: March 19, 2017, 03:37:50 pm
content: Unless you are using opto isolators (properly), you will ultimately have to connect your logic ground to your power ground in order to trigger a MOSFET.It's pretty hard to say much more without knowing a good deal about what you are trying to do. Your -> description doesn't really make much sense (to me).OTOH, uCs are used in high power applications all day long. Of course it can be done and done well. Personally, I would caution against high side switching. N channel devices used as a high side switch are a little problematic in that you need to get the gate voltage well above the upper rail voltage. Like 10V higher, give or take, and that isn't always easy. P channel devices are not always as capable as a similar N channel device although they are easier to trigger as a high side switch.I would also recommend using a real MOSFET Driver chip to switch the MOSFET on and off. You really need to dump AMPS into the gate to get it to switch in a short period of time. You want fast switching to keep the MOSFET out of the linear region any longer than necessary.I would think that opto isolators and a MOSFET Driver would be the way to go.

author: Atheus
author_rank: Contributor
timestamp: March 20, 2017, 03:05:24 am
content: Wow, thanks! Especially Ian.M, and to tpowell1830 for the warm welcome.Re: @rstofer "Your -> description doesn't really make much sense (to me)." - sorry! There's no actual project here (yet) - I am just learning and wondering how you might control (say) a 500mA motor from a login pin which can only draw 40mA. There are a million applications I'm sure. Also my description may well be a bunch of crap and I have misunderstood something fundamental... but that's why I'm here! Tell me if/why I'm wrong!I've only been getting "back" into this stuff VERY recently (working in software at an IoT company and spending a little time in the EE lab inspired me), and for example the soldering iron I found in my old bits box is nearly 20 years old and I'm only 34(yes I bought a shiny new one)Everyone PLEASE do correct me on anything I get wrong or if I say something dumb. Feel free to use maths and diagrams etc - I should understand it immediately or pick it up quickly.Re: @Ian.M "There is plenty of idiocy in 'Arduino-land' usually caused by lack of understanding of fundamental concepts of circuit design and implementation."Indeed. The thing is, the device allows you to run 'electronics' with C code, which isextremelyattractive to programmers. I could write (say) autonomous robot collision avoidance code without a problem, but until relatively recently I would have had to outsource the hardware. Now I can set high/low on pins and control a component sometimes without any linear circuitry at all and build the hardware myself. Obviously this is a massive over-simplification, but it's where programmers often start. Same as EEs trying to write code. Usually a complete code testing/maintenance disaster.Re: @Ian.M "The basic problem is ground bounce... "So you're a bit ahead of me in you knowledge of these things so bear with me... I read up on ground bounce...I read I need to connect the ground (emitter?) of the switching device to the same ground as the Arduino - @rstofer mentioned this - I assume it is correct?I understand that if some voltage comes back off the high voltage side to the same ground as the Arduino, current will flow into the Arduino with explosive effects. So... it seems to me, I need to connect the ground of the high power device directly to the ground pin of the DC input, butbeforethe Arduino power supply. Is this correct?I would also add the decoupling caps you mentioned, along with a large ground plane... and what about a diode?I know this is a stupid question, but... if I hook up a 50V supply to a component that can handle it, will there be 50V or ~0V on the ground line? If ~0V all I need to do is control noise/ripple/etc.People have mentioned relays as opposed to transistors/MOSFETS for switching and isolation. Would you recommend a relay? Pretend we're not working at high frequencies here... I'd be interested to know what would happen if we were though...Re: @rstofer "I would think that opto isolators and a MOSFET Driver would be the way to go." - excuse my ignorance, but what advantage is there to a MOSFET driver? I thought, like other transistors, you just have to apply a voltage to the gate and current will flow. Please correct me.I understand that the high power circuit needs to be isolated in some way, but need we go as far as 'opto' (presumably using lasers... I am unfamiliar with this component) to decouple? Can we not use a purely electronic device? Or just a diode so the current can only flow into the main ground not the Arduino ground? Please excuse my my lack of expertise if this is a load of crap...... Actually on that note, is there a book anyone can recommend? Maybe something for other scientists and engineers getting into EE... I don't need Ohm's law explained etcThanks again everyone!

author: Ian.M
author_rank: Super Contributor
timestamp: March 20, 2017, 04:30:28 am
content: The grounds of the Arduino (or other logic circuit) + the load circuit must *ONLY* meet at a single point, (if they meet at all - see 'isolation' below) and that single point is usually either the emitter or source of a low side switch (or the bottom end of a low value current sensing resistor between the emitter or source and ground), or if the load is controlled by a high side switch, the ground side of the load. If there are multiple loads their grounds need to come together in a single point*like a star.This isn't always possible, e.g you are driving a grounded load, or using a high power PSU with a grounded 0V rail and need PC connectivity over USB to the MCU, so have a ground loop via the load or PSU ground, the building wiring, the PC power lead and the PC PSU, chassis and motherboard. In some cases you may get away with short heavy copper braid ground straps tying the MCU board ground plane, and the PC chassis to the preferred ground point, but that only works if the ground straps have a much lower impedance than the unwanted ground loop and if there is an external source of ground potential difference driving a current round the loop, can cause serious board or wiring damage. Other approaches include isolating the USB (expensive) or the logic level serial signals between the USB UART and the MCU, or the MCU's outputs, and using differential buffer amp for all analog sensing from the high power side, or, for the digital signals, using differential line drivers and receivers that can tolerate a significant ground offset. If you are using an Arduino, you don't get a lot of choice as mostly the USB UART and the MCU are on the same PCB with no provision for making a good ground connection to it, so you are stuck with isolating the outputs and using differential buffers feeding the analog inputs.* A heavy copper ground plane on a PCB can usually be treated as if it was a single point for the purposes of grounding as long as, on the same PCB, you group high power circuits away from sensitive ones.To isolate signals there are a few methods - specialised isolator chips using high frequency magnetic or capacitive coupling, optoisolation, either as a single packageoptoisolatoror with discrete transmitters and receivers (via a light path that can be free space, a light pipe or clear insulation barrier or fiber optic cable), or signal or pulse transformers, which have their own limitations as they don't transmit DC levels I doubt you'll need fiber-optic cable unless you have part of your circuit at a very high potential relative to ground. e.g the 'hot' end of an EHT PSU or a Van der Graff generator.MOSFETs typically have a fairly large gate capacitance, and due to the Miller effect, if there is a significant voltage swing on their drain when they switch, the effective gate-drain capacitance is multiplied by that voltage swing. If you don't provide enough drive current they spend too long in the linear region getting hot, or if you dont provide enough gate drive voltage they may not switch on hard enough and the excessive Rds_on again resultis in them heating up. Put heat (due to load current) into a MOSFET faster than you can get rid of it, for more than a very short time and it tends to go bang. See the S.O.A (Safe Operating Area) graph typically found in power MOSFET datasheets. A MCU can typically only source or sink a couple of tens of mA, and usually only a few mA if you want the output to get anywhere near the rails, so is usually a poor choice for driving larger MOSFETs directly (unless you over-spec the MOSFET and switch it seldom enough that it has plenty of cooling off time between transitions). A MOSFET driver does two things - level translation and an output stage capable of very high pulsed currents to slam the MOSFET gate from full on to full off as fast as possible so it doesn't have time to heat up excessively. Its usually a single chip component, just add power, signals, *GOOD* decoupling and a MOSFET.For controlling a 500mA motor, the easiest option for simple on/off or PWMed speed control would be a low side BJT or MOSFET switch, with an anti-parallel diode across the motor to control the back-EMF. If you want to add reversing without using relays, you'd need an H-Bridge. Arduino H-Bridge shields are available but you need one rated for the motor's stall current, typically five or six times the running current and maybe as much as ten times the no-load current, and they usually make the grounding star point the Gnd pins of the Arduino headers, which may cause other problems. If you get a H-Bridge breakout board, they are typically available in higher voltage and current ratings than the shield and you get more control of the location of the star grounding point.

author: Richard Crowley
author_rank: Super Contributor
timestamp: March 20, 2017, 05:33:16 am
content: Quote from: Atheus on March 20, 2017, 03:05:24 amNobody here is suggesting that there is anything wrong with Arduino itself. Only that a great many of the discussions about how to USE Arduino in their forums are frequently short of technical understanding and very much resemble "the blind leading the blind".QuoteIf you look at what happens to much of the "last 30m" of power delivery wiring, you may be surprised at the amount of noise, bounce, droop, etc. happens when large loads are switched. Because microelectronics (like Arduino) operate on rather low voltages (especially compared even to the pertubations in mains delivery voltages), they are rather vulnerable to all sorts of noise and interference from the very circuits they are trying to monitor and control.QuoteYes that is ONE of MANY different techniques used to isolate sensitive micro-electronics from environmental hazards. There are many tricks and virtually all of them are dependent on the SPECIFIC SITUATION and the UNIQUE HAZARD at hand. We could discuss this topic in generalities for months and never arrive at anything useful to a specific circuit of yours. Much better to discuss the specific case and the specific remedies.QuoteMeasurements like voltage are RELATIVE, between point "A" and point "B". We very often take a shortcut and name some particular node of a circuit "Ground". It is generally accepted that all voltage measurements are relative to "ground" (unless stated otherwise). So, for the general case "ground" is 0 voltsBY DEFINITION.QuoteRelays are still frequently found in power switching circuits. Sometimes for economic reasons, sometimes for technical reasons, etc. But it is true here in the 21st century that it is quite common to see semiconductor devices (bipolar transistors, FETs, thyristors, etc.) used even in high-voltage and high-current circuits where we used to see mechanical relays (or "contactors"). And especially in circuits that were made possible by high-power semiconductors where relays would have never been practical. For example Variable Frequency Drive for large industrial motors, etc.QuoteYes, when it comes down to it, you are simply switching voltage/current into the gate/base. However there are a great many different situations that require different solutions for that basic function. That is why it is impractical to discuss this issue in the abstract.QuoteNo, "optical" does NOT mean "lasers". It typically means LEDs and photo-sensitive transistors (or thyristors) packaged together into a nice little plastic component. These things are quite inexpensive and very widely used in products from "dirt-cheap" (BrEnglish: "cheap as chips") to the most expensive gadgets on the planet. Opto-isolated components could very well be the optimal solution to your amorphous dreams.QuoteThe recently-updated, 3rd edition of "The Art of Electronics" is widely regarded as an encyclopedia of theoretical and practical electronics. It is rather spendy and for that reason there are many counterfeits for sale. Widely recommended, but also widely advised to buy carefully.Ref:http://artofelectronics.net/the-book/counterfeit-editions/https://www.eevblog.com/2016/02/03/eevblog-847-mailbag/https://www.eevblog.com/forum/chat/possible-3rd-edition-counterfeit-of-art-of-electronics/

author: Atheus
author_rank: Contributor
timestamp: March 20, 2017, 05:53:41 am
content: Alright @Ian.M I'm gonna have to read up a bit to understand everything you said. I'll reply again when I can reply intelligently... but just for now...Lets assume I'mnothooking the MCU up to the PC via USB while driving the high load. I can just flash the chip from the PC, disconnect it, and then when it's powered on it will run the program. As well as USB there's also a 2.1mm DC jack and power pins in case you didn't know. I can test with a low power load with USB debugging (but the same switching) or use a simulator or something before going to the real load. I wouldn't risk my machines my putting anything high voltage anywhere near them!Just one basic thing - re: "The grounds of the Arduino (or other logic circuit) + the load circuit must *ONLY* meet at a single point, (if they meet at all - see 'isolation' below)"Okay, so as I understand it, with good decoupling etc I can put all the grounds into a single plane even with different voltage sides going into it? Those voltages should be "used up" by each side and end up at 0V at the ground regardless of the voltage going into them... right? If the components can handle the voltage there should 0V at the ground plane from all separate grounds disregarding component failure and noise and back EMF etc for a moment... right?But the ground of the load doesnothave to touch the ground on the Arduino you say? It can be completely isolated, and the control circuit can be completely separate from the high voltage? Would I just put a diode preventing current flowing from the ground plane into the Arduino to achieve this?Am I on the right track by having a voltage come in from a bench PSU to a jack (perhaps some smoothing there), and then to two separate linear voltage regulators (or buck/boost circuits) plus isolators for the two sides protected by their own decoupling, providing the needed voltages, thermal considerations taken into account. So the grounds meet between the voltage regulators and the jack? Somehow the low side triggers the high side via a relay (or MOSFET and driver), and so except for the breakdown of semiconductors putting voltage in the wrong direction, it should be okay?I've gone on longer than I meant to, but I'll go away and do some reading and come back again - I'm sure I do not fully understand everything you said. If I have something vastly wrong though please do tell me - just a nudge to the topic will do and I'll do my own research.Thank you for all your help!~Atheus/edit: @Richard Crowley - thanks for your clear and precise answers. I'll come back to you too after I've done some reading, and perhaps come up with a practical problem to solve, since there seems to no one way to do this but many depending on the application.Re: "Measurements like voltage are RELATIVE, between point "A" and point "B". We very often take a shortcut and name some particular node of a circuit "Ground". It is generally accepted that all voltage measurements are relative to "ground" (unless stated otherwise). So, for the general case "ground" is 0 volts BY DEFINITION."I understand that voltage is potential difference and is relative... I guess I mean, is there any chance of a resistive component (not a semiconductor)notusing all the voltage supplied to it? Without failing and shorting that is. If I have 12V coming into a jack, then apply 20V to a load and 5V to a controller chip through separate voltage regulators or boost/buck converters, and if I place the ground between the jack and the two voltage supplies, will I get a good ground?I guess another way of asking is; does a resistive component always use all the voltage supplied to it even if that means blowing up? Meaning no voltage 'escapes' to the ground? Again disregarding component failure, noise and back EMF for now. I guess I know the answer to that is yes... the component will use all the voltage - only the current will change and the voltage will always be 0V at ground... I'm just having a hard time putting it all together in my head. Perhaps I shouldn't be doing this at 6AM with a beer in my hand. I'll be back~Atheus

author: Richard Crowley
author_rank: Super Contributor
timestamp: March 20, 2017, 06:00:48 am
content: Quote from: Atheus on March 20, 2017, 05:53:41 amThat's not really the issue. The Arduino (or any micro-electronics circuit) is quite vulnerable all on its own, whether it is connected via USB (or anything else) to some other gear. There are some cases where fiber-optic "waveguide" ("wiring") is used for isolation from extremely large hazards. For example in AC->DC and DC->AC converters used for power distribution where they are switching megawatts or even gigawatts.QuoteYou could spend years discussing all possible aspects of this problem. OTOH, if you want to decide what your project involves, you will very likely receive crisp and specific recommendations of solutions based on the SPECIFIC conditions of your project. Generic discussion of possible situations seems pretty pointless to me.

author: Atheus
author_rank: Contributor
timestamp: March 20, 2017, 06:35:06 am
content: @Richard Crowley; Alright I'll think of a specific high(ish) power application for this question. I'm really only developing IoT devices with tiny voltages but I want to understand this for the sake of understanding... you know what I mean? Knowing about lower and lower levels of a stack helps one understand the higher layers I find. Same as knowing assembly and memory addressing helps with writing high level C/C++ code.I'm kinda disappointed there is no simple answer to this but I understand that with such a generalised beginner question there are many answers - like if you asked me how to get a web server to display data on a client's screen... well... what kind of data? How much of it? At what speed? Exactly how is the client connecting to the server? Etc etc etc...Time for some homework methinks.~Atheus

author: Ian.M
author_rank: Super Contributor
timestamp: March 20, 2017, 07:51:59 am
content: A picture is worth a thousand words.This is how you might tackle it if you were wiring up separate breakout boards. It would be a lot easier on a custom PCB as the critical high current section round the regulator, driver and MOSFET could all go on a ground plane.

author: Richard Crowley
author_rank: Super Contributor
timestamp: March 20, 2017, 02:24:42 pm
content: Quote from: Atheus on March 20, 2017, 06:35:06 amIf you want a single answer, IME you could say that an opto-isolator would be the single most likely solution to most situations.@Ian.M provided an excellent illustration of "star ground" (or "star node" in a more general case). Depending on the mechanical details, distances, dimensions, load current, budget, materials, construction techniques, etc. you may be able to implement this solution directly on a PC board. Or you may have some other unusual situation where a single star ground would be impractical for a particular situation. The optical isolator breaks the entire system up into separate circuits where you can handle power, decoupling and grounding separately as each section requires.

author: Seekonk
author_rank: Super Contributor
timestamp: March 20, 2017, 02:51:28 pm
content: You get a lot of complex answers because you haven't stated what you want to do. High power means nothing other than with even short pieces of wire high currents can induce a voltage. That can introduce an error in an A/D voltage because of different ground potentials. At higher frequencies that voltage can be magnetically induce. Every transition on/off creates some heat. Have 50,000 of them and that is significant and requires special drivers. At 480Hz that can pretty much be ignored unless you are doing something really stupid. Note that you can easily change the frequency of the UNO. An opto isolator only is likely fine for what you are doing. I an a firm believer that you can't really tell people anything. Buy a couple FET and burn them up, really. That will be the best money you ever spent and you will learn at what point certain things become significant. A lot of advice you have been given is true but will never apply to what you will build. Driving a FET at high power is not that difficult. A real FET driver will likely get you into real trouble.