My goal is to power this electromagnet (the 1000N 24V flavor) with a dedicated 24V power supply, and then to use the Arduino Uno to modulate the magnet's strength. From what I've read, the most efficient way to do this is by using the PWM output from the Arduino to control the gate of a power MOSFET. My proposed circuit is as follows:
My issue is that, because this will be the first non-trivial circuit I've designed, I don't necessarily have the experience to see if there are any glaring issues with it. I can walk through my logic here, but I could really use a second (sharper) pair of eyes to see if I've gone astray before I order all of the components from DigiKey.
My logic:
The specs provided for the magnet are sparse, and I cannot measure the magnet ahead of time because I'm ordering my bench power supply and multimeter in the same order as the circuit components. Amazon says that the magnet has a 24V input voltage and 10W power consumption. A quick calculation suggests that it will draw 417mA of current as a result. I picked a really beefy freewheeling schottky diode (SB550-E3/54) because I'm not very familiar with inductive kickback and wanted to err on the side of caution. I selected my power MOSFET to be the AO4484 after filtering DigiKey for something with a low Rds(ON) (<10mOhm) and a low gate charge (27nC). I didn't go for a logic-level MOSFET because I thought it would be a good idea to protect my Arduino from potential 24V mistakes by using an optocoupler. That also means that the 24V magnet power supply will be supplying the voltage for the MOSFET gate. I picked the VO617A-9X017T optocoupler because it was cheap but I'm still not sure how to compare it to other optocouplers in a meaningful way. I did try to read the spec sheet, though, and included R1 as a current-limiting resistor to supply 30mA of current at 5V from the PWM pin, which is about half of the optocoupler's listed 60mA max current. R2 was chosen to set the current to the gate of the MOSFET around 10mA. R3 acts as a pull-down resistor for the MOSFET gate, and was set equal to R2 to create a voltage divider that supplies the gate with 12V when the optocoupler is on (the MOSFET has a min. Rds(ON) at 10V and a max Vgs of 20V). Zener Diode D2 is meant to provide over-voltage protection for the MOSFET gate.
Please help me find any terrible oversights and miscalculations in my plan before I place my parts order! Thank you in advance!
Edit: I've realized that I should give some context regarding my level of knowledge. I'm essentially a complete beginner when it comes to electrical engineering, but I'm working through the Arduino Starter Kit (K000007) projects and I'm a couple hundred pages into Practical Electronics for Inventors (4e). I'll do my best to learn from any feedback I receive in this thread as well.
I would use a logic level N channel MOSFET switching the low side of the load. One serial resistor, 180 Ohm, between D3 and the gate, one 10k resistor from D3 to GND.
Great post, you followed the forum guidelines perfectly. It is obvious you have done some circuit design before, this is very good. The MOSFET is in the process of being obsoleted but not a problem unless you are going to build a lot of them over the next few years. I have seen seasoned engineers not do as good as you did give yourself a pat on the back.
Thanks for the swift reply! I hadn't even heard of a MOSFET before this project, so can I grill you on the difference functionally between a logic level MOSFET and one like the AO4484 when a high voltage is available to open the gate? In this case, I could select a higher resistance value for R2 to reduce the voltage at the gate pin and swap in a logic level MOSFET, but would there be any gain in safety or performance? Also, I tried to place my MOSFET on the low side of the load in the diagram, but if it's currently on the high side, please let me know hahaha. I didn't quite follow your advice about D3 because (unless the diode in the optocoupler counts), I think I've only got two diodes. That said, I'll take another look at the diagram and see if I can apply your advice. Thank you!
Thanks for the quick feedback! I will do some reading on the appropriate current to drive the optocoupler and increase R1 accordingly. I actually am super new so I only have a very tenuous grasp on how much headroom to give components based on their max power or current ratings. I also get the impression that placing resistors and diodes in the vertical orientation might be an electrical engineering convention that I overlooked. In the laboratory where I work, the radiologists all get headaches when new students submit anatomical images to them in the wrong (usually upside-down) orientation, so I definitely get the principle of it!
Thank you for the kind words. I'm actually just doing this as a favor for my sister, who wants to use this circuit in an interactive art piece. It's a bespoke circuit that will hopefully never need to be reproduced, so scalability and maintainability are fortunately not an issue. I really do appreciate you taking the time to check that for me, though, since I can see that being a big deal in commercial applications. Thanks again, and happy New Years!
Switching loads on their low side needs controller GND to be connected to GND of load power source. Note the small number of components needed, 1 transistor and 2 resistors.
I don't likely evaluating Your word description, only schematics.
Thank you for pointing that out. I think I had the idea in my head that I needed a Schottky diode based on something I read in a forum when I was first starting the project. I absolutely do not remember the source or if it was reputable, which is probably telling. Based on a cursory google search, you might be right about the diode so I'm ordering a plain old 1A diode to test out.
In terms of the magnet rating, that's also really valuable advice. My plan is to just hook the magnet up directly to the power supply at 24V and measure the current with an ammeter. That's probably safe, right? I have very little trust in the magnet's specs per the Amazon shop page - especially because they don't provide any actual technical datasheet.
Oh my gosh D3 is the digital pin 3 that I used on the Arduino, not a third diode. I've already failed at reading my own drawing! Sorry for injecting a bunch of confusion into the conversation.
Everything that you've said makes perfect sense now. Thanks for breaking it down like that for me. I take it that isolating the Arduino with an optocoupler is not needed, then? I was worried that if my MOSFET burnt out and shorted all the pins together, I could damage my Arduino, but I'm not sure whether that is a realistic concern.
Before I thought to use an optocoupler, I think I had a circuit similar to what you described diagrammed out, so I will post that one for review if you think isolating the Arduino is a bad (or just not useful) idea.
Just one thing to add what has here mentioned already. With R1 = 127R you will (over-) load the GPIO of your UNO with a current, which is actually not needed. Don't know if you use other GPIOs of the UNO, but there is also a maximum current for the ATmega328p in total; don't exceed this value.
Check the datasheet of the optocoupler as it provides what current you need through the diode to get some current throught the transistor (section CURRENT TRANSFER RATIO). I guess 10mA is enough, and well within the limits of the UNO's ATmega328p for a single GPIO.
I.e. adjust the diode's current to what you have on through the transistor, which you have already (properly) selected by R2 and R3.
Note: the 60mA you are referring to is listed in the section ABSOLUTE MAXIMUM RATINGS. You should never take those values to make a design; rather than to verify your design that you stay always below the listed values under all operating conditions.
All components, connectios, soldering have their failure rate. Adding extra circuitry for safety, like You point at, increases the failure rate for the build. Keeping it simple usually pays off. Following the datasheet rating and using good design practise, You will not face those rather rare failures.
You're a lifesaver. I didn't really know how to interpret the datasheet of the optocoupler and I had a hard time finding online resources describing what the different technical specs meant. I went back and tried again after reading your comment, though, and found this guide which happens to walk through the datasheet for the exact optocoupler I was considering. The technical datasheet lists the CTR as 200-400% at 5mA which implies that I'd only need about 5mA of forward current to allow my intended 10mA of collector-emitter current to flow. Based on the optocoupler's forward voltage of 1.35 and the assumption that 5V is supplied from the Arduino, the resistance of R1 should be around 730 Ohm, so I could try a 715 Ohm resistor. This is, indeed, much higher than the 127 Ohm I have in the diagram now.
This design philosophy makes way more sense than just pushing everything half way to its maximum rating. I suppose this is where really understanding the technical datasheet for your components comes in handy. Thanks for pointing me in the right direction - especially when it comes to the CTR. That was immensely helpful.
This seems very wise. I suppose that, because I'm still so new, I have the desire to plan for and solve every eventuality before it occurs. The complexity of the circuit really exploded when I tried to include the optocoupler, though, and I actually did make a mistake with R1 that could have broken the whole circuit. When I go to incorporate this circuit in a larger project where reliability matters, I think I will try the simpler circuit that you have described. What do you think of this revised schematic?
Extra tip, something I introduced during my professional time to speed up the turning off of inductive loads: Add a zener diode to the D1 diode! In the 48 volt system we used 1W 15 volt I think. Cathode towards cathod. That shortened the emergency braking distance by 30% on heavy fork lift trucks! Springs applied the brake and the inductive coil released the brake when being activated. The faster deactivation happend the quicker the braking started!
Oops! Too much New Year's champagne on my part. I even saw the voltage divider and thought "Cool. Most of the voltage is still across the gate." No idea why it didn't occur to me to just not connect R1 and R2 in series.
In terms of the diode, I got some feedback that a Schottky diode is actually worth using for PWM, so I swapped one back in instead of a regular diode. Your advice to add a Zener diode is something that I definitely want to put some time into understanding, but I'm not quite there yet just because I still have so much to learn about diodes in general. I think I found a detailed LTSpice simulation of the phenomenon on this forum post so I'll keep working at it. In the meantime, I think I've fixed my voltage divider mistake!
Your previous schematics would surely have working but the work for R2 is to discharge the the little cap on the digital output pin.
To be honest I've not considered the effect of adding a zener to a PWM controlled load. My old application was either on or off.
I've used LTSpice for simulating some biological networks before (neurons can be modeled as cables if you're willing to make some assumptions), so maybe I'll run some simulations with a Zener diode and PWM for this kind of circuit and post my results here when I have them. I definitely don't know enough to predict what would happen based on theories and equations, but I guess that's the value of experiential learning.
Seriously, though. Thank you for taking the time to hold my hand through this thread. It's been super valuable as a beginner to be able to talk through my first real project.