Control a Solenoid with an Arduino (Tutorial)

Ғылым және технология

My complete guide to using your Arduino to control a solenoid! Building a custom pinball machine sent me down the rabbit hole of learning how to control solenoids with a micro controller. It turns out there are a few gotchas to watch out for.
FINAL SCHEMATIC:
www.dropbox.com/s/wffsfemuwia...
PARTS USED:
- Solenoid: JF-0826B (12V/2A) - amzn.to/3e9T8fy
- Solenoid: F0464A (24V/2A)
- Arduino Uno: amzn.to/2RAV7BW
- Screw Terminals: amzn.to/3x3gDQ4
- Logic Level MOSFET: FQP30N06L or IRLZ44NPBF
- Flyback Diode: 1N4007
See schematic for resistor values
As an Amazon Associate I earn from qualifying purchases.
ERRATA
Schematic has been adjusted compared to the video to address the following:
Circuit 2 shows a 10K resistor between the push button and MOSFET gate (not to be confused with the 10K pulldown resistor from gate to ground). Yet the third circuit does not show a resistor on the gate (placed between the Arduino pin and the gate). On further research, a resistor in the ~150ohm range appears ideal between Arduino pin and the gate.
Reasoning: when a MOSFET is switched on, the gate acts as a capacitor and allows a large momentary inrush of current In theory this could damage the power source. As with everything electronics, there is more to this story, but that should get you going.
DISCLAIMER:
For educational purposes only and not meant to replace proper training. Working with electricity and tools can be dangerous. Use the knowledge in this video at your own risk.
If you see mistakes please leave comments (preferably with a source) so I can make corrections if needed.
#solenoid #arduino #electronics

Пікірлер: 387

  • @Mr69er1000
    @Mr69er10002 жыл бұрын

    You might not be an electrical engineer but you helped me in my EE senior design :) Thanks a lot for the thorough walkthrough and multiple revisions, as well as having links to the parts used!

  • @MattInglot

    @MattInglot

    2 жыл бұрын

    That makes me really happy to hear! Good work getting through your project! I'm glad the video helped.

  • @bradleylovej
    @bradleylovej Жыл бұрын

    This is a really good video. Very clearly explained, in a nice, even manner. At first I didn't think I wanted to watch a 20 minute video, but once it started, I didn't think twice about it

  • @MattInglot

    @MattInglot

    Жыл бұрын

    Thanks!

  • @razTAH-p6h
    @razTAH-p6h Жыл бұрын

    This is what I've been looking for! Best video on KZread for using solenoids with Arduino. Thanks a lot!!

  • @gonzalezrubiocarlosandresj8130
    @gonzalezrubiocarlosandresj8130 Жыл бұрын

    You helped me in my BME senior design. Thanks for the thorough walkthrough and multiple revisions and tips. Excellent content, greetings from México!

  • @MattInglot

    @MattInglot

    Жыл бұрын

    That's really wonderful to hear! Nice work!

  • @wheelseo938
    @wheelseo9382 жыл бұрын

    It was a pleasure to watch this video and to listen to your clear explanations. Thank you!

  • @softshore
    @softshore5 жыл бұрын

    Wow, I always see someone using a relay for this and honestly never thought of using a MOSFET. It was a great video, you deserve more subscribers.

  • @MattInglot

    @MattInglot

    5 жыл бұрын

    Thanks so much I really appreciate it! More vids are coming soon too.

  • @233kosta

    @233kosta

    4 жыл бұрын

    When I bought my little pack of mosfets, I worked out that a relay that could handle the same current (70A) would probably cost a good bit more than the 10 I bought put together. Relays, of course, tend to have higher voltage ratings and I hear they're not too fond of PWM switching roles... 😁

  • @jorgemercent2995
    @jorgemercent29953 жыл бұрын

    Thank you very much Matt. Appreciate you going through everything step by step.

  • @MattInglot

    @MattInglot

    3 жыл бұрын

    Thank you :)

  • @shvideo1
    @shvideo12 жыл бұрын

    Very educational and practical video considering that solenoids are also used in locks. Thank you for the detailed explanation and the schematic. This is a great electronics project.

  • @MattInglot

    @MattInglot

    2 жыл бұрын

    Thank you so much!

  • @RobinsonTechnologies
    @RobinsonTechnologies2 жыл бұрын

    Appreciate you showing the simpler circuit (before the mosfet was added), most people skip that kind of stuff but it's very useful for understanding things!

  • @MattInglot

    @MattInglot

    2 жыл бұрын

    Glad it helped!

  • @anandjoshi8554

    @anandjoshi8554

    Жыл бұрын

    @@MattInglot i am using three power supply 5, 12 and 24 vdc, should i connect all 0 ve /grd together, to be given to the diffrent powered dc outputs ?

  • @anandjoshi8554

    @anandjoshi8554

    Жыл бұрын

    @@MattInglot can i use Adriuno in place of costly PLC to manage a DIY project comprising of 4 dc outputs and 3 ac outputs (0.2 - 9 amp via ssr) and 7 dc inputs....using relay module ? (my plc ladder has 58 rungs in total )

  • @MattInglot

    @MattInglot

    Жыл бұрын

    @@anandjoshi8554 Yes absolutely. If using multiple supplies in the same circuit, tie the grounds together.

  • @MattInglot

    @MattInglot

    Жыл бұрын

    @@anandjoshi8554 Yep. I'm not experienced with PLCs but Arduino can certainly control all this stuff. Just keep in mind that PLCs are very different than Arduino, again not experienced with them but my understanding is they are built to withstand harsh environments and be super reliable and all that.

  • @sastrydasigi7010
    @sastrydasigi70105 жыл бұрын

    Hi Matt, it's a fascinating project... and you are an amazing teacher!

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Thank you!

  • @oliviaadel765
    @oliviaadel7652 жыл бұрын

    My GOSH! your presentation skills are Awesome.. Please don't ever stop what you're doing

  • @MattInglot

    @MattInglot

    2 жыл бұрын

    Thank you so much!

  • @oliverward6344
    @oliverward63444 жыл бұрын

    Hi!, just thought I'd say what a good video it is! you explain the circuit clearly and simply, not like some people that just rush through it without properly explaining. :)

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Thank you kindly! It feels risky putting up a 20 minute explanation to something that others explain in 10 so this is reassuring to hear.

  • @SebVEVO
    @SebVEVO7 ай бұрын

    Thx, great tutorial that highlights important aspects that I might have missed otherwise.

  • @David-fq6ly
    @David-fq6ly3 ай бұрын

    Thanks, this was really helpful!! Also probably the best intro on any KZread video I've seen!

  • @MattInglot

    @MattInglot

    3 ай бұрын

    Thank you!

  • @MatthewCarlsen
    @MatthewCarlsen4 жыл бұрын

    Hey Matt great video!! I found this video through search and I’m looking to build a project using a sollinoid. I saw that you have a fairly new channel so I thought I’d help you out with a comment, like, and a new subscriber! Great job man!

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Thanks so much that's really awesome of you. What is your project?

  • @istvanagoston7137
    @istvanagoston7137 Жыл бұрын

    Finally, my issue is solved with the solenoid, all thanks to you! You got a new subscriber and lots of respect

  • @MattInglot

    @MattInglot

    Жыл бұрын

    Nicely done!

  • @t.n.1056
    @t.n.1056Ай бұрын

    I have to be honest man: this video is one of the best videos for describing a project for arduino! I really really have to say: Thank you man!

  • @seanocansey2956
    @seanocansey29565 жыл бұрын

    Optocouplers are your best friend if going from digital electronics to power electronics, I'd look them 👍🏾🙂 Edit: they basically completely isolate the input signals from the output. It does that by converting electrical signals to light, then back to electrical signals. This means no voltage ot current spikes will damage low power electronics Note: With opto-couplers, you *don't* want to connect grounds or power sources to each other, otherwise you'll defeat the purpose of the chip.

  • @shitheadjohnson2797

    @shitheadjohnson2797

    Жыл бұрын

    optocouples dont take much amps, because the optic part of them burns out. but they are cool.

  • @andrewhowlett4792
    @andrewhowlett479213 күн бұрын

    Hi Matt, thanks for this video. This helped me a lot with my newest project.

  • @express375
    @express3753 жыл бұрын

    The most complete and easy to get explination I've seen,thanks

  • @MattInglot

    @MattInglot

    3 жыл бұрын

    Thanks!

  • @wanna312
    @wanna3123 ай бұрын

    Awesome easy to follow tutorial. And great humor at the very beginning😂😂

  • @karamazov7193
    @karamazov71933 жыл бұрын

    Great job Matt, clear explanations, did not felt like a 20 min video.

  • @MattInglot

    @MattInglot

    3 жыл бұрын

    Thanks that's really appreciated!

  • @dominick3579
    @dominick35794 жыл бұрын

    This really helped me understand how apply the use of a transistor!

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Awesome, I'm so glad to hear :D

  • @jullianhoff849
    @jullianhoff8494 жыл бұрын

    Your explanations are so clear. Thank you.

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Thanks so much, glad it helped!

  • @silverspoon987
    @silverspoon987 Жыл бұрын

    You're a hero. Got my valve working now. Thank you

  • @xyloidify
    @xyloidify5 жыл бұрын

    I liked the video, thank you for sharing your research. Subscribed.

  • @MattInglot

    @MattInglot

    5 жыл бұрын

    Thank you!

  • @joshpatterson2773
    @joshpatterson27734 жыл бұрын

    This video was insanely helpful. Thanks so much!

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Very glad to hear!

  • @davidpp9999
    @davidpp99994 жыл бұрын

    Great explanation, really liked the video

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Thanks so much!

  • @FirthFabrications
    @FirthFabrications3 жыл бұрын

    This is exactly the video I needed for my project. Thanks!! 🙏

  • @MattInglot

    @MattInglot

    3 жыл бұрын

    Awesome! What are you building?

  • @FirthFabrications

    @FirthFabrications

    3 жыл бұрын

    @@MattInglot On my channel I recently built a flip top tool cart. I am trying to automate the flipping of the cart. I am going to use solenoids as the locking mechanism.

  • @MattInglot

    @MattInglot

    3 жыл бұрын

    @@FirthFabrications Cool! That sounds like a great use for one.

  • @edfl4913
    @edfl4913 Жыл бұрын

    I got the schematic. THANK YOU!!!

  • @rogueart7706
    @rogueart77062 жыл бұрын

    To overcome the limited duty cycle of a solenoid just double the voltage capacity of the solenoid. In other words, on a 12 volt supply just use a 24 volt solenoid. As a builder of solenoid engines this video is great. Thanks a bunch.

  • @MattInglot

    @MattInglot

    2 жыл бұрын

    Thanks and great tip!

  • @mhansl
    @mhansl4 жыл бұрын

    Very good explanation and demo of the circuit. Should mention that the MOSFET is a type of transistor.

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Yes good point! Thank you!

  • @haywardhaunter2620
    @haywardhaunter26202 жыл бұрын

    Excellent presentation. Be careful using a solderless breadboard for this: Many are rated to 0.5 Amps, though there are some high quality ones rated to 2 Amps. As Sean Ocansey said in the comments, the next step is to use an optoisolator. Since you won't have to connect the grounds together, your sensitive Arduino electronics will be better protected from the spikey and noisy electromechanical circuit. Many of the solenoids in a pinball machine are switched on only briefly, but flippers are trickier. Since the player may hold the flipper up for an arbitrary amount of time, there's a risk of exceeding the duty cycle of the solenoid. So many (all?) pinball machines initially power the flipper at its full voltage when the player first presses the button, but then switches to a lower voltage if the player holds the button in. The full voltage gives the flipper the power to bat the ball, and the lower voltage is enough to keep the flipper up. At the lower voltage, the solenoid will generate less heat, so it can be kept on without exceeding the duty cycle.

  • @MattInglot

    @MattInglot

    2 жыл бұрын

    Lots of great points thanks!

  • @nolesdennhardt8986
    @nolesdennhardt89863 ай бұрын

    Awesome video! Thanks for the details. I am currently trying to learn how to wire and code something similar, except I want to reduce the current at end of stroke using the PWM outputs on my control board. Ill look around your channel! I can hopefully find something because it's a head scratcher for me using a 2 pin solenoid. Basically just hoping to hold the solenoid (and flipper bat) in its extended position without burning out the coil. Thanks again!

  • @mdd0204
    @mdd02044 жыл бұрын

    Great explanation !

  • @seanocansey2956
    @seanocansey29565 жыл бұрын

    Good vid btw, a bit of constructive criticism, I'd try to draw diagrams or Schematics to help explain what you're doing 👍🏾

  • @MattInglot

    @MattInglot

    5 жыл бұрын

    Thanks Sean. Yes that's a good idea, I hope to do this at some point.

  • @elliot1784

    @elliot1784

    4 жыл бұрын

    @@MattInglot If you provide the schematics i'll subscribe to your channel :D lol thanka for the video tho great stuff!

  • @MattInglot

    @MattInglot

    3 жыл бұрын

    Wow this video took off more than I expected. Schematic is now in description. If I missed any detail from the video in it someone let me know ;) It's been a while!

  • @twomeyconsulting
    @twomeyconsulting4 жыл бұрын

    Extremely helpful, thank you!!

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Thank you I am glad it helped :D

  • @awjaaa
    @awjaaa Жыл бұрын

    Excellent video, man.

  • @MattInglot

    @MattInglot

    Жыл бұрын

    Thank you!

  • @No1sonuk
    @No1sonuk4 жыл бұрын

    The 10K from Gate to ground pulls the Gate down after the drive signal is released. if you use a resistor on the drive side, you get a potential divider. If that resistor is 10K, the Gate gets only half the drive voltage. Using 100 ohms puts the level much higher, making it turn on better. If the gate signal is being driven by a logic output, such as the Arduino, you may not _need_ either of those resistors, but it's a good idea to have them for "failsafe".

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    That's a great point.

  • @joshuapatterson5095
    @joshuapatterson50954 жыл бұрын

    Great tutorial mate.

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Thanks so much Joshua!

  • @chuckpatten7855
    @chuckpatten78555 жыл бұрын

    One concept that you might like to know about is opto isolation. This is where you don't want to commingle your power supplies which can keep you from blowing up your controller due to large switching currents. Use an optoisolator. Your micro turns on a LED which then turns on a light sensitive transistor in the separate circuit.

  • @MattInglot

    @MattInglot

    5 жыл бұрын

    100% That's a good approach too.

  • @chuckpatten7855

    @chuckpatten7855

    4 жыл бұрын

    @dylans voice it depends upon what you are thinking of in terms of switching currents . If you mean external circuits that are not connected to the circuit and power supply then bypassing the power lines and shielding the board within a metal enclosure will probably work. If the anticipated noise is due to induced ground currents then the way to proceed is to insure that there are no non isolated connections to the power to the external controls and that the ground for the controller is only connected to the power supply directly.

  • @chuckpatten7855

    @chuckpatten7855

    4 жыл бұрын

    @dylans voice plenty fast for this application. Look at the data sheet for the one you choose for performance data.

  • @edfl4913
    @edfl4913 Жыл бұрын

    Love the video!!!

  • @diaverde09
    @diaverde094 жыл бұрын

    Very helpful information. Thank you.

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Thank you!

  • @benjidabull
    @benjidabull3 жыл бұрын

    you deserve more subs my man

  • @MattInglot

    @MattInglot

    3 жыл бұрын

    Thanks I appreciate it :)

  • @AslamYusof
    @AslamYusof4 жыл бұрын

    thank you, Mat. very helpful. subscribed

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Thank you! :)

  • @JohnDoew-hz8qt
    @JohnDoew-hz8qt7 ай бұрын

    Excellent and clear spoken diagrams explanations, without anoying music, easy to understand, many thanks for posting `! PLease explain how to retain the solenoid for 3 seconds ? Now its acting more like pulse latching

  • @Traderhood
    @Traderhood5 жыл бұрын

    Excellent!!

  • @_crazytechz
    @_crazytechz3 жыл бұрын

    Awesome mate , Great video and clear explanation I am new subscriber Your support is highly valued thanks

  • @noahvanrossum1075
    @noahvanrossum10753 жыл бұрын

    Thanks for the clear explanation! Would it be possible to connect the Arduino as well as the solenoid to the same power supply (in parallel), such as a simple battery holder? Because that way the voltage comes straight from the source itself, instead of going through the Arduino first, while still connecting both grounds.

  • @MattInglot

    @MattInglot

    3 жыл бұрын

    I don't see why not. Give it a shot and if you run into issues go down the troubleshooting rabbit hole until you figure it out. One thing I'd wonder about is voltage drop on the battery when firing the solenoid, and needing to throw some capacitors in to counteract that. I may play around with this one day with my scope hooked up, just haven't had a chance to do it. If I do it I'll make a video. But for sure play around, have fun, see what you learn.

  • @NLGeebee
    @NLGeebee3 жыл бұрын

    The one thing you need to explain about Voltages is that is is basically a -potential difference-. So 12V can be the difference between 0 and 12, but also the difference between 100 and 112. Your Arduino will be fried by 100V, so to make sure that your negative side of your 12V potential difference = 0, and not some random value, you ground everything together. Hence the name common ground.

  • @Bianchi77
    @Bianchi772 жыл бұрын

    Nice info, thanks :)

  • @user-fb9os7hy2y
    @user-fb9os7hy2y Жыл бұрын

    Excellent,very helpful for this noob..thank you

  • @SuperJatoba
    @SuperJatoba2 жыл бұрын

    muito obrigado,estou construindo uma micro puncionadeira cnc,este video me ajudou muito,obrigado por esta aula

  • @MicaseHD
    @MicaseHD2 жыл бұрын

    I want to make A mini jackhammer out of a push pull solenoid. I don't know how to make it work like a jackhammer?? like 'Push and pull' is one cycle like a jackhammer. I have been trying to find out how for like 4 days now. is there a little pcb board that can do this or control it?

  • @lebronsdad9554
    @lebronsdad95543 жыл бұрын

    Great, informative video! I plan on doing something similar with a solenoid controlled air valve. Since it wasn't shown on screen, what did you end up using for your 12V power supply? A 12V wall plug or just a series of batteries?

  • @MattInglot

    @MattInglot

    3 жыл бұрын

    I'm powering it off the wall plug. You can use batteries of course.

  • @Lee-At-Green-Pheonix-Rc
    @Lee-At-Green-Pheonix-Rc3 жыл бұрын

    I'm looking at these to activate a pull pin on a rc 1/10 winch can I just hook up the positive to a switch turn on stays pulled in until switch is turned off then springs back then opersite way wind winch in 🤔

  • @nithinkumardatti5846
    @nithinkumardatti58462 жыл бұрын

    Thank you so much for the video. Can we control pneumatic solenoid only with arduino and relay

  • @redsteam1
    @redsteam14 жыл бұрын

    Love all your pinball videos! How'd it turn out?

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    It's been a challenge! I have gone down soo many rabbit holes with this thing. I have a lot of plans and half-finished pieces and then a lot that's not even started. This project has lead me down a lot of side projects like learning to design PCBs, and now building the Low Rider 3d printed CNC (so I can easily cut playfield prototypes). Pinball machine will exist, but it's clearly a marathon and not a race. More vids are coming. I also just launched a maker podcast at artofthebuild.fm so that's taken up a fair bit of time as well!

  • @haideralikhan5947
    @haideralikhan59474 жыл бұрын

    Amazing job

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Thank you!

  • @online12plus
    @online12plus4 жыл бұрын

    "stop hitting yourself Arduino"

  • @joshuakarki5894

    @joshuakarki5894

    Жыл бұрын

    “stop hitting yourself Arduino”

  • @realdenzity2144
    @realdenzity21443 жыл бұрын

    Your channel is underrated :( you make great videos and only have a small amount of subscribers

  • @MattInglot

    @MattInglot

    3 жыл бұрын

    Thanks kindly! I think it's my fault for being so slow with videos but yes please subscribe and more content will come :)

  • @realdenzity2144

    @realdenzity2144

    3 жыл бұрын

    @@MattInglot will do! I have a suggestion for you though - you should make project tutorials and go really in depth with them. I’ll be starting to make some in the future when I can have my workbench spot finally, but until then, I gotta wait cause I can’t use any of my tools. People want to see things that they can make and copy. Also you can try to remake popular products!

  • @MattInglot

    @MattInglot

    3 жыл бұрын

    @@realdenzity2144 Video on my dog collar light project is coming out soon. That's not too far from what you describe.

  • @willyangabrigo1174
    @willyangabrigo11743 жыл бұрын

    What solenoid shoild i use, planing to make a gear shifting mechanism for my motorcycle

  • @jeanetiennette5742
    @jeanetiennette5742 Жыл бұрын

    Hello Matt, your video is awesome. Thank you for sharing. One thing, with this set up, do you think we can actually control the speed (force) of the solenoid?

  • @MattInglot

    @MattInglot

    Жыл бұрын

    Thanks Jean. You absolutely can, that's actually one of the benefits of this setup (as opposed to using a relay). Look up PWM - Pulse Width Modulation. This is what modern pinball machines do to allow the operator to adjust the strength of the flippers for example.

  • @attilanemeth8215
    @attilanemeth82154 жыл бұрын

    Begginer here. Will i need these mosfet and diode and stuff if i controll a relay module with the arduino and the relay just lets of prevents the electricity into the solenoid?

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    You don't need a mosfet because the relay will act as the switch instead of the mosfet. And if you are using a relay module then it takes care of some of the details of using relays correctly (like a protection across the relay since it's also an inductor). I would definitely still put a diode on the solenoid (make sure the polarity is reversed like discussed in the video, else you will short out your circuit!) to protect anything the solenoid is hooked up on the same circuit with including your power supply.

  • @TangodownNZ
    @TangodownNZ Жыл бұрын

    Please. What diode should I use for a 24 volt 2 amp solenoid? Thank you

  • @lskanon863
    @lskanon8633 жыл бұрын

    Thank you!

  • @ericmwangi4484
    @ericmwangi44843 жыл бұрын

    hi.. i want to control 3 solenoid valves at the same time and connect the same to the water level indicator please help

  • @danmeuse496
    @danmeuse4962 жыл бұрын

    hi, i bought some IRFP260Ns before watching this vid, and im having trouble getting the program to work. Im starting to worry that it might not be logic level capable, but i dont know how to find out for sure

  • @feliramasari7218
    @feliramasari72185 жыл бұрын

    Thank you

  • @malikx00
    @malikx0011 күн бұрын

    Hi, mine wasn't working until i removed the resistor from 1st pin of mosfet to ground. Thanks for your help.

  • @5amJones69
    @5amJones6928 күн бұрын

    This is great. Do you have any video's on how to vary the velocity of the solenoid?

  • @MattInglot

    @MattInglot

    25 күн бұрын

    You can use PWM to change the strength of the magnet which would in turn affect the velocity of the plunger, and maybe more importantly, how much force it hits things with (in the case of an application like a pinball machine flipper). Don't expect any fine control over this though! If you want that, you should really be looking at a stepper motor instead. Solenoids are great when you need that little bit of very sudden (and strong) movement. But you frequently see people trying to use them in places where a stepper is the better solution (and vice versa). Why controlling velocity of a solenoid is a funny thing: The acceleration changes with how much of the plunger is within the magnetic coil vs outside of it, because then more of the plunger has a magnet acting on it, and you get exponentially more force. Acceleration determines the change in velocity. So if the acceleration gets faster and faster as more of the plunger enter the magnetic coil, the velocity also gets faster and faster as the plunger enter. Put in simpler terms, when the solenoid activates, the plunger is initially moving very slowly (relatively speaking) and by the time it plunges all the way, it's moving extremely fast. It's not a linear speed. You can see force charts for some solenoids in their datasheet. Don't think you can see acceleration or velocity normally, but it's going to be a similar idea. All the action happens towards the end of the plunge.

  • @JMAlist
    @JMAlist4 жыл бұрын

    Super helpful video! Quick question regarding Solenoids. What determines how hard they push and pull? is it Voltage rating or Amp rating?

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Good question: it's not quite that simple. The strength of the coil (electromagnet) is determined partly by the current (amps) it draws, but also the number of turns of wire, how long the coil is, how close the plunger is to the coil, etc. You can google for calculators that show all this stuff. So 2 solenoids rated for the same voltage and current may have very different performance and be intended for very different uses, and the difference lies in those other variables. The situation is complicated further by the fact the force increases as you get more of the plunger inside the coil, so on datasheet you will find it's actually a graph of force vs extension of the plunger. As for relationship between voltage and current, if you look at a supplier like Digikey you will find the same solenoid model comes in 2 or 3 varieties like 2A @ 12V, 1A @ 24V, 0.5A @ 48V. All have the same force, and since P = VI, they both use the same amount of power. However since they are wound different as a result, since current is less. So *generally speaking*, as solenoid strength goes up, so does the power it draws (meaning voltage or current or both will be higher). BUT because solenoids are built with different specs in mind (including duty cycle, longevity, different plungers, etc) you can have two solenoids with identical voltage and current ratings with very different performance characteristics. If you Google around there's a tonne of info on this stuff, and yes it does get complicated and that's why I love datasheets :D

  • @Dg-zj6jo
    @Dg-zj6jo2 жыл бұрын

    Hi there I need 12v small one that pushes when I turn power off

  • @jakewatermelon8576
    @jakewatermelon85764 жыл бұрын

    Great video, thank you for this. I do have a question though, would you be able to replace the button with a lever? I need the solenoid to be held down, without manually holding the button down.

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Hey Jake you can use any switch you want in whatever shape you want. There are also mechanical button switches out there that toggle, so you press it and it stays on until you press it again. Or if you plan to use this with the Arduino like the last example, then you have full freedom to decide how long the solenoid stays on. The only catch is that if you are going this route, you want a solenoid rated for continuous duty. Intermittent and pulse solenoids are not meant to have current go through them for very long at a time. You haven't specified your intended application, but you may also wish to look into latching solenoids and into servos in case one of these parts suits your project better.

  • @jakewatermelon8576

    @jakewatermelon8576

    4 жыл бұрын

    @@MattInglot Thank you, I appreciate your response

  • @teodordicu361
    @teodordicu3612 жыл бұрын

    Hello! I have a question.. I got my hands on a IRF520 module, can it do the work for me if I add a diode?

  • @Malbu226
    @Malbu2262 жыл бұрын

    Quick question if I wanted to run a solenoid that would ring a bell like a fire alarm how would I do that? Also being able to change the Hz frequency up and down to adjust the bell hits slower or faster. A variable power supply would be used so the voltage can be increased to make the bell hits harder and louder.

  • @MattInglot

    @MattInglot

    2 жыл бұрын

    What a great question. You got me so curious about this that I looked up how those old school fire alarm bells work and you're not far off with your idea. I managed to find this article: www.aplustopper.com/working-of-an-electric-bell/ It looks like these types of bells already use electromagnets to function (remember, that's really all a solenoid is...), and there are different ways of making that mechanism work. What I love about the one in that article is that it naturally creates the ringing by interrupting the circuit when it the hammer hits the bell, which allows it to retract back, which closes the circuit and activates the electromagnet, which brings the hammer back to the bell, and so on. You could very easily swing a hammer with a solenoid in a similar way. Just have the hammer pivot on something, so that when the solenoid pulls down the hammer swings and hits the bell. You could then vary the frequency with how often you pull down the solenoid (eg. fire it once a second, twice a second, etc). You are correct that you can control the strength of the hit by varying the voltage, however you don't need a variable power supply. If you're using an Arduino like in my example, just make sure you connect the solenoid to a PWM pin, then use Arduino PWM functionality to simulate the voltage change (eg. 50% PWM would effectively give you half the voltage). Note that you won't necessarily have a linear correlation between PWM frequency and volume so if you're building a volume knob or something you will have to experiment with how to map the PWM frequency to the desired volume. Keep in mind that the purpose built fire bell mechanisms like the one I linked have a very small amount of travel, which allows them to ring at a (relatively) high frequency. If you buy an off the shelf solenoid, like the ones on Amazon, those things take a (relatively) long time to plunge back up after plunging down so that will limit the frequency. That should really be it. Be sure to watch the video because that Arduino circuit is exactly what you need, and the rest is just building the mechanical piece. Good luck!

  • @maheshjawahar
    @maheshjawahar4 жыл бұрын

    Hey Matt, that was really helpful! I have a better understanding of the basics now ! Thank you! Also , can we control the force generated by the solenoid by varying the voltage through the arduino? Of course we need to get rid of the MOSFET for that . But can we use something else ?

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Absolutely. You should be able to do this just with PWM. I would suggest starting by just using the PWM functionality that's already built into the Arduino. No need to replace the mosfet, it should do its job just fine. Basically with PWM instead of varying the voltage, you are rapidly turning it on/off, which averages out to a lower effective voltage (same way you would dim an LED). For example if the coil is on only 50% of the time, it will exert less force. There are all sorts of ways that this can be useful, such as calibrating whatever machine is using this, ensuring that you are not exceeding the duty cycle of the solenoid, etc. You could go very deep down this rabbit hole, as the power a solenoid needs to hold the plunger is less than the power it needs to pull it. Or more specifically, as the plunger is entering the solenoid, more and more force is exerted on the plunger because more and more of it is within the coil. Most solenoids will have a datasheet showing how the force they apply to the plunger increases as more of the plunger is retracted into the coil. In fact if your goal is to actuate the plunger, and then hold it at a lower voltage, here's an article I came across to do that without PWM that will do just that: www.electronicdesign.com/technologies/analog/article/21798400/whats-all-this-solenoid-driver-stuff-anyhow I never tried that circuit myself so I can't vouch for it, but it was an interesting read. As a side side note: I've also found that I can get away with applying more voltage to a solenoid than it's rated for, as long as the pulse is sufficiently short (just long enough to pull the plunger in). Of course as soon as you go outside the datasheet there are no guarantees, but in practice it's made those cheap ebay solenoids a LOT more effective for me.

  • @maheshjawahar

    @maheshjawahar

    4 жыл бұрын

    @@MattInglot wow !! That's so much information ! Thank you so much ! I'll go through the article ! This made my day !!

  • @julienh.5057
    @julienh.5057 Жыл бұрын

    Thanks for sharing! Humbly asking: how comes you fit a 3A fuse and a solenoid that will draw 2A on a breadboard that is probably not rated for those values? (At least you didnt mention the specs).

  • @MattInglot

    @MattInglot

    Жыл бұрын

    Thanks. You want the fuse to blow as a protection measure if the load on the circuit is higher than expected, which most likely means something has shorted out and will draw all the current the power supply can put out (until the supply's own fuse blows). So if we assume that solenoid was indeed 2A, you want something higher. I eyeballed 3A because it gives the margin of error, but should still blow if the circuit has a serious fault (again almost certainly a short because something got plugged in wrong or loose). The goal is protect the power supply and possibly prevent a fire if you're using a supply that can put out way more current than you need (think those DIY ATX ones without current limiting). That said, fuses are complicated: kzread.info/dash/bejne/iXtlk9SPk7C1nrw.html As for the breadboard: it was there to demo only, yes I should have pointed it out. Basically you might not get full power from your solenoid if you use a breadboard because of the high resistance it has.

  • @mapacave
    @mapacave2 жыл бұрын

    what intermittent snacks do you eat to be this awesome :)

  • @74potions
    @74potions3 жыл бұрын

    Hi Matt, I hope your pinball project went well! I'm about to follow this project as part of my University final year project but can't find out what the components you have used are. What's the name of the blue piece that takes the power supply? And how have you exposed 2 wires from the power supply also? I have a 12v power lead with the regular power jack which without changes cannot be used to power the breadboard. The solenoid I am using is also 12v.

  • @MattInglot

    @MattInglot

    3 жыл бұрын

    If you Google "screw terminal block" you should be able to find them. Or if your power supply already has a different connector (sounds like a barrel jack most likely), then you could get the female barrel jack connector for your breadboard and use that. That will actually be a more reliable connection if you're trying to build something more permanent.

  • @chrisferraro5462
    @chrisferraro54622 жыл бұрын

    Hi Matt, great video! Quick question -- What is the voltage across breadboard 26e (or simply row 26) and row 21 when no voltage is supplied to the gate on the Mosfet (output pin 8 removed)? I have more or less replicated what you have but am finding that when 0V is supplied to the Gate, the voltage on the load is still around 2V… when I supply 3V to the Gate, the voltage on the load is 12V as expected. Trying to understand why there is always 2V even when the Arduino is not supplying any output. Was expecting the voltage to be 0 or close to it. Thanks!

  • @MattInglot

    @MattInglot

    2 жыл бұрын

    Hey Chris, it's been a while since I've played with this circuit but taking a quick look at my schematic again (which you can download in the video description by the way, may help to make sure everything is wired up right), I'm pretty sure it's because the load isn't part of a complete circuit when the Gate is pulled down to 0V. So you're getting some potential differences but they should be meaningless. If you try to connect your meter in series with the load and measure current you can verify that nothing is happening. All that said, if you're using two power supplies like I did in my project, make sure the GNDs of the supplies are tied together so that they agree on what 0V is. Or you will get all sorts of interesting measurements and very possibly damage the Arduino. Good luck!

  • @gonorthoffgrid1786
    @gonorthoffgrid17864 жыл бұрын

    So im using a ardino to fire a solinoid 15 ms on 30ms off repetivly at the comand of a button Qestion is is it benificial to use a diode in my solinoid circuit off the mos fet and is it still desirable to ground out the mosfet gate.

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Yes. You'll probably get away without the grounded gate if you have the Arduino hooked up to it, but I don't see a reason not to ground it. If you leave the diode out, you will potentially fry your Arduino.

  • @thomasryan4697
    @thomasryan46974 жыл бұрын

    How does one determine the size of the resistors and the type of.diode to use,. Can this design incorporate a break beam sensor

  • @No1sonuk

    @No1sonuk

    4 жыл бұрын

    The resistor numbers aren't particularly critical in this case. About 10K from Gate to ground pulls the Gate down after the drive signal is released, and the 100 ohm from signal to Gate is just a little protection. If the gate signal is being driven by a logic output, you may not need either of those resistors.

  • @jarchdm
    @jarchdm2 жыл бұрын

    thanks i'm just making a replacement circuit for my safe and this is exactly what i was looking for thumbs up and you got a new subscriber.

  • @MattInglot

    @MattInglot

    2 жыл бұрын

    Glad it helped!

  • @dhananjayjoshi1040
    @dhananjayjoshi10404 жыл бұрын

    Its really good. I have doubt regarding this instead of giving supply to solenoid can we attach magnet to the solenoid and generate AC output ?

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    If you move a magnet through a coil of wire, you will induce current in that coil (the magnet must be moving). So yes, if you were to replace the plunger with a magnet and move it back and forth, you should be able to measure some current. Tonnes of sources online if you want to read about that further, such as www.electronics-tutorials.ws/electromagnetism/electromagnetic-induction.html In fact, when you cut power to the solenoid, the magnetic field collapses, and that does induce current, which is what the diode is there to protect against. It gives it somewhere to go other than your Arduino or power supply.

  • @dhananjayjoshi1040

    @dhananjayjoshi1040

    4 жыл бұрын

    @@MattInglot Thank you so much sir !!

  • @crj411
    @crj4113 жыл бұрын

    Great video! Love pinball machines and stuff like that. I've got a question about controlling an automotive solenoid remotely. Let me know if you have a min to answer a question

  • @MattInglot

    @MattInglot

    3 жыл бұрын

    Thanks. You're always welcome to ask, whether I'm the right person to answer or not we will see.

  • @tswdev
    @tswdev4 жыл бұрын

    Hi. I am building a controller for a airsoft gun that uses high pressure air controlled by a solenoid valve. I can get the arduino pro micro to control the valve but sometimes after i fire the arduino restarts. I am using the same 7.4v lipo to power the arduino and the solenoid. I suspect there might be a current drop during firing that starves the arduino but i dont have enough experience to know for sure neither how to solve it. Have you done this before? Have any ideas?

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Never done this before, but battery not being able to handle the current sounds plausible. Check the specs. With lipos they have a rating for how quickly they can discharge. You also say that the Arduino resets *after* the solenoid has already fired. Did you remember to put the flyback diode on the solenoid? If that doesn't help, honestly I would Google or post on a place like the electronics stackexchange making sure you include your circuit diagram, and the specs of everything you are using. There's not really enough info here to troubleshoot further.

  • @theobject7326
    @theobject73262 жыл бұрын

    Great!

  • @jasonliu2310
    @jasonliu2310 Жыл бұрын

    Hey Matt! Super solid video but I was wondering why you ended up switching the MOSFET in your final iteration from the first one. Would your circuit still work with the original MOSFET?

  • @MattInglot

    @MattInglot

    Жыл бұрын

    Hey Jason I do explain that in the video. The issue is if you want to use the MOSFET with an Arduino, you need to be able to switch the gate with the 5V output of the MOSFET. So I switched in a "logic level" mosfet that is capable of being driven with a lower voltage.

  • @petaca39
    @petaca392 жыл бұрын

    good video I ask you a question is it possible to control an electromagnet through an arduino but using pulses instead of the classic turn off and turn on as if it were a led

  • @MattInglot

    @MattInglot

    2 жыл бұрын

    Thanks. Yes you can build the exact circuit I show and just make sure to hook up the mosfet gate to a PWM enabled pin on the Arduino. Then you can use PWM to control the strength of the electromagnet.

  • @iinterceptor
    @iinterceptor4 жыл бұрын

    that helped a lot... i am also on a pinball project... the issue where i am from is its difficult to get high power solenoids... have you tried using high speed servos instead?

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    I hear you on the solenoids being a pain to source - I think it's largely because pinball has relatively niche and unusual requirements vs the way solenoids are normally used. I haven't tried servos specifically. I did try car lock actuators which *sort of* worked, and you can find a video somewhere on YT of someone having done this, but I never got satisfactory force and kind of expected they would fail quickly since no one expects car door locks to be actuated many times a minute for potentially hours at a time. Rather than speculating on something I haven't tried, I'll suggest you try it in the name of science and let us know what happens! Would be fun to know and even if it fails there's always something to learn. Alternatively you can get more creative with finding the solenoids. For example you could use actual pinball mechanisms - you can buy those parts new or strip down an existing machine that's in bad shape/cheap.

  • @4seekers719

    @4seekers719

    4 жыл бұрын

    Matt Inglot thanks Matt for your suggestions.. I'm right now in Dubai and pinball isn't popular here at all.. Sourcing has become almost impossible due to the curfew... Lemme try with the servos in the name of science 🤪.. Will keep you posted

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    @@4seekers719 Look forward to hearing about your results!

  • @BaranKaynak0
    @BaranKaynak04 жыл бұрын

    What about voltage drop on selenoid power source? How can we avoid low voltage for other parts sharing the same power source?

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Hey Baran I overlooked this comment. One answer is to do what I did in the video and use two different power supplies (with their grounds connected), specifically to avoid various issues with inductive loads. That's a common technique for DIY pinball machines for example. Otherwise the short answer is "capacitors", long answer is post your schematic and relevant details, preferably on an EE forum. Unfortunately filtering power is not something I've spent enough time on to feel confident that I'm giving you good advice.

  • @Sara-dp1rq
    @Sara-dp1rq3 жыл бұрын

    Good evening, i whatched the video and i found it very usefull. I recently bought a solenoid valve for my arduino project. I connect it with a diode and a mosfet (IRF520). The power supply is 5V, coming out from arduino. The mosfet is working (led on of the mosfet) but the solenoid is freezed. You have an idea of the reason? Thank you very much

  • @MattInglot

    @MattInglot

    3 жыл бұрын

    If everything is hooked up correctly and you can measure 5V on the Arduino pin when it's on, , but you can't measure any voltage to the solenoid, I would double check the datasheet of your mosfet and make sure it's logic level (ie can be turned on by 5V or less). Your problem sounds a lot like that might be what's wrong.

  • @233kosta
    @233kosta4 жыл бұрын

    You might find it more convenient to use a compiler directive for your pin definition, i.e. [#DEFINE solenoid 8]

  • @questort
    @questort Жыл бұрын

    What component would you use if you want the latch to travel a much longer distance?

  • @MattInglot

    @MattInglot

    Жыл бұрын

    Assuming you don't need the near-instant actuation, a stepper motor would do a great job. Or even a regular motor with the right gearing. See how smart locks work on doors.

  • @Kalle1854
    @Kalle18544 жыл бұрын

    Can you tell me what type of solenoid you used for the flippers? How powerful do they have to be? What ball size are you using?

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    I'm using the Pontiac Coil F0464A for the flippers, and a 3/4 steel ball from BC Precision Balls (CH1053). Note that I'm building a roughly 65% scale machine so these components are sized accordingly and won't work in a full-size machine. If you want to build a full-size machine, then you can buy parts specifically meant for pinball machines from the various suppliers that provide these, and build on top of a platform like P3-Roc. If you are building a smaller machine like me, be very careful selecting the ball. Pinballs need a lot of weight to be able to properly hit target and feel like pinball. Those 3/4" balls were the smallest I found that still had a proportional weight to them. Smaller balls just didn't have any heft to them.

  • @KaiLuckey
    @KaiLuckey4 жыл бұрын

    If I forgo the fuse (I don't have one) and use an npn transistor instead of the mosfet, will this circuit still work?

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    Good questions. The fuse is there to protect the other components in the circuit in the case of something shorting out (and possibly your power supply if it doesn't have its own protection). I wouldn't leave it unsupervised without a fuse, but if you're watching over it then it's really up to you. If you don't have a mosfet handy (you can get cheap versions of these things off ebay or aliexpress if you're just tinkering), then my next choice would be a relay since they typically are built to handle lots of current and a component you are also likely to have lying around (and just lookup how to use them). Regarding the suitability of your NPN transistor, it depends on the transistor and how much current the solenoid you are using draws, those would be the critical pieces of information. This can all be found and verified by checking the datasheets for your components. For example if I guess you have the 2n222a that's a staple in so many electronics books, I can google 2n222a datasheet I will find www.jameco.com/Jameco/Products/ProdDS/787536.pdf And there I will see that they are intending this transistor for applications that require up to 500ma, and we are given no indications of how much they can handle for brief periods of time. That's unlikely to be a great choice, but knowing these parameters, and that NPN transistors are cheaper than gummy bears, you could experiment with a lower power solenoid and see what happens. If you go this through route then you will need to make sure you learn how to use BJTs because they operate differently. A good article on this stuff: www.ermicro.com/blog/?p=423

  • @adityakulkarni4154
    @adityakulkarni41544 жыл бұрын

    Sir , by using magnetic plunger , current will generate in coil by cutting magnetic flux in coil so, is it possible to charge 3.7 V Li-Po battery by using bridge circuit and voltage regulator (7805) ?

  • @MattInglot

    @MattInglot

    4 жыл бұрын

    I've never tried to build such a circuit so I can't really speak to the specifics, but if you move that magnet inside the coil rapidly enough, you will generate some amount of current. Check out how the different mechanical flashlights work, it's all this same general principle: en.wikipedia.org/wiki/Mechanically_powered_flashlight Also be careful with Li-Po batteries.

  • @Imthesaviour
    @Imthesaviour2 жыл бұрын

    How to reduce solenoid load current using pwm?

  • @kaleigheichel415
    @kaleigheichel4155 жыл бұрын

    Awesome! Thanks for the step by step. Also, do you have labelled circuit diagrams?

  • @MattInglot

    @MattInglot

    5 жыл бұрын

    Working on it :)

  • @edfl4913

    @edfl4913

    Жыл бұрын

    @@MattInglot Can you send me the labelled circuit diagram? Thanks! And really great work here with the project and the teaching skills!!

  • @MattInglot

    @MattInglot

    Жыл бұрын

    @@edfl4913 It's there in the video description.

Келесі