Control a Solenoid with an Arduino (Tutorial)

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 พ.ค. 2024
  • 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
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 369

  • @bradleylovej
    @bradleylovej ปีที่แล้ว +6

    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

  • @gonzalezrubiocarlosandresj8130
    @gonzalezrubiocarlosandresj8130 ปีที่แล้ว +3

    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
    @wheelseo938 2 ปีที่แล้ว

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

  • @Mr69er1000
    @Mr69er1000 2 ปีที่แล้ว +19

    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 ปีที่แล้ว +5

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

  • @raziel5746
    @raziel5746 10 หลายเดือนก่อน +1

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

  • @jorgemercent2995
    @jorgemercent2995 3 ปีที่แล้ว +4

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

  • @SebVEVO
    @SebVEVO 4 หลายเดือนก่อน

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

  • @shvideo1
    @shvideo1 2 ปีที่แล้ว +2

    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
    @RobinsonTechnologies 2 ปีที่แล้ว +12

    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 ปีที่แล้ว +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.

  • @softshore
    @softshore 4 ปีที่แล้ว +3

    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  4 ปีที่แล้ว +1

      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... 😁

  • @oliviaadel765
    @oliviaadel765 2 ปีที่แล้ว +1

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

    • @MattInglot
      @MattInglot  2 ปีที่แล้ว

      Thank you so much!

  • @sastrydasigi7010
    @sastrydasigi7010 4 ปีที่แล้ว +5

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

  • @dominick3579
    @dominick3579 4 ปีที่แล้ว +1

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

    • @MattInglot
      @MattInglot  4 ปีที่แล้ว

      Awesome, I'm so glad to hear :D

  • @oliverward6344
    @oliverward6344 4 ปีที่แล้ว +2

    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.

  • @wanna312
    @wanna312 14 วันที่ผ่านมา

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

  • @karamazov7193
    @karamazov7193 3 ปีที่แล้ว +1

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

    • @MattInglot
      @MattInglot  3 ปีที่แล้ว

      Thanks that's really appreciated!

  • @express375
    @express375 3 ปีที่แล้ว +1

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

  • @istvanagoston7137
    @istvanagoston7137 10 หลายเดือนก่อน +1

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

    • @MattInglot
      @MattInglot  10 หลายเดือนก่อน

      Nicely done!

  • @edfl4913
    @edfl4913 ปีที่แล้ว

    I got the schematic. THANK YOU!!!

  • @joshpatterson2773
    @joshpatterson2773 4 ปีที่แล้ว +1

    This video was insanely helpful. Thanks so much!

    • @MattInglot
      @MattInglot  4 ปีที่แล้ว

      Very glad to hear!

  • @silverspoon987
    @silverspoon987 ปีที่แล้ว +1

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

  • @jullianhoff849
    @jullianhoff849 3 ปีที่แล้ว +1

    Your explanations are so clear. Thank you.

    • @MattInglot
      @MattInglot  3 ปีที่แล้ว

      Thanks so much, glad it helped!

  • @seanocansey2956
    @seanocansey2956 5 ปีที่แล้ว +31

    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.

  • @mdd0204
    @mdd0204 4 ปีที่แล้ว +1

    Great explanation !

  • @MatthewCarlsen
    @MatthewCarlsen 4 ปีที่แล้ว +8

    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?

  • @David-fq6ly
    @David-fq6ly หลายเดือนก่อน +1

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

    • @MattInglot
      @MattInglot  หลายเดือนก่อน

      Thank you!

  • @xyloidify
    @xyloidify 5 ปีที่แล้ว +6

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

  • @FirthFabrications
    @FirthFabrications 3 ปีที่แล้ว +2

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

    • @MattInglot
      @MattInglot  3 ปีที่แล้ว +1

      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 ปีที่แล้ว +1

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

  • @davidpp9999
    @davidpp9999 4 ปีที่แล้ว +3

    Great explanation, really liked the video

    • @MattInglot
      @MattInglot  4 ปีที่แล้ว +1

      Thanks so much!

  • @nolesdennhardt8986
    @nolesdennhardt8986 หลายเดือนก่อน

    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!

  • @Traderhood
    @Traderhood 5 ปีที่แล้ว +2

    Excellent!!

  • @twomeyconsulting
    @twomeyconsulting 4 ปีที่แล้ว +1

    Extremely helpful, thank you!!

    • @MattInglot
      @MattInglot  4 ปีที่แล้ว +1

      Thank you I am glad it helped :D

  • @mhansl
    @mhansl 4 ปีที่แล้ว +1

    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
    @haywardhaunter2620 2 ปีที่แล้ว +7

    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 ปีที่แล้ว +1

      Lots of great points thanks!

  • @edfl4913
    @edfl4913 ปีที่แล้ว

    Love the video!!!

  • @diaverde09
    @diaverde09 4 ปีที่แล้ว +1

    Very helpful information. Thank you.

  • @rogueart7706
    @rogueart7706 2 ปีที่แล้ว +2

    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 ปีที่แล้ว +1

      Thanks and great tip!

  • @joshuapatterson5095
    @joshuapatterson5095 4 ปีที่แล้ว +1

    Great tutorial mate.

    • @MattInglot
      @MattInglot  4 ปีที่แล้ว

      Thanks so much Joshua!

  • @chuckpatten7855
    @chuckpatten7855 5 ปีที่แล้ว +3

    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 ปีที่แล้ว +1

      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 3 ปีที่แล้ว

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

  • @JohnDoew-hz8qt
    @JohnDoew-hz8qt 5 หลายเดือนก่อน

    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

  • @AslamYusof
    @AslamYusof 4 ปีที่แล้ว +1

    thank you, Mat. very helpful. subscribed

  • @awjaaa
    @awjaaa ปีที่แล้ว +1

    Excellent video, man.

  • @Bianchi77
    @Bianchi77 ปีที่แล้ว +1

    Nice info, thanks :)

  • @No1sonuk
    @No1sonuk 4 ปีที่แล้ว +2

    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.

  • @user-fb9os7hy2y
    @user-fb9os7hy2y 11 หลายเดือนก่อน

    Excellent,very helpful for this noob..thank you

  • @lebronsdad9554
    @lebronsdad9554 3 ปีที่แล้ว

    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.

  • @lskanon863
    @lskanon863 3 ปีที่แล้ว +1

    Thank you!

  • @SuperJatoba
    @SuperJatoba 2 ปีที่แล้ว

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

  • @benjidabull
    @benjidabull 3 ปีที่แล้ว +3

    you deserve more subs my man

    • @MattInglot
      @MattInglot  3 ปีที่แล้ว

      Thanks I appreciate it :)

  • @_crazytechz
    @_crazytechz 3 ปีที่แล้ว +1

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

  • @haideralikhan5947
    @haideralikhan5947 4 ปีที่แล้ว +1

    Amazing job

  • @feliramasari7218
    @feliramasari7218 5 ปีที่แล้ว +3

    Thank you

  • @jeanetiennette5742
    @jeanetiennette5742 ปีที่แล้ว +1

    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.

  • @nithinkumardatti5846
    @nithinkumardatti5846 2 ปีที่แล้ว

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

  • @NLGeebee
    @NLGeebee 3 ปีที่แล้ว +1

    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.

  • @noahvanrossum1075
    @noahvanrossum1075 3 ปีที่แล้ว +2

    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 ปีที่แล้ว +2

      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.

  • @seanocansey2956
    @seanocansey2956 5 ปีที่แล้ว +47

    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 ปีที่แล้ว +5

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

    • @elliot1784
      @elliot1784 3 ปีที่แล้ว +1

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

    • @MattInglot
      @MattInglot  3 ปีที่แล้ว +5

      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!

  • @maheshjawahar
    @maheshjawahar 3 ปีที่แล้ว

    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  3 ปีที่แล้ว

      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 3 ปีที่แล้ว

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

  • @JMAlist
    @JMAlist 4 ปีที่แล้ว

    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

  • @jakewatermelon8576
    @jakewatermelon8576 4 ปีที่แล้ว

    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 ปีที่แล้ว +1

      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

  • @willyangabrigo1174
    @willyangabrigo1174 3 ปีที่แล้ว

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

  • @redsteam1
    @redsteam1 4 ปีที่แล้ว +1

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

    • @MattInglot
      @MattInglot  4 ปีที่แล้ว +2

      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!

  • @dhananjayjoshi1040
    @dhananjayjoshi1040 4 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      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 ปีที่แล้ว +1

      @@MattInglot Thank you so much sir !!

  • @jasonliu2310
    @jasonliu2310 11 หลายเดือนก่อน

    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  11 หลายเดือนก่อน

      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.

  • @iinterceptor
    @iinterceptor 4 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      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!

  • @theobject7326
    @theobject7326 2 ปีที่แล้ว +1

    Great!

  • @danmeuse496
    @danmeuse496 2 ปีที่แล้ว

    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

  • @74potions
    @74potions 3 ปีที่แล้ว

    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 ปีที่แล้ว +1

      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.

  • @Lee-At-Green-Pheonix-Rc
    @Lee-At-Green-Pheonix-Rc 3 ปีที่แล้ว

    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 🤔

  • @MicaseHD
    @MicaseHD ปีที่แล้ว +1

    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?

  • @chrisferraro5462
    @chrisferraro5462 2 ปีที่แล้ว

    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!

  • @petaca39
    @petaca39 2 ปีที่แล้ว +1

    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.

  • @TangodownNZ
    @TangodownNZ 11 หลายเดือนก่อน

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

  • @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  ปีที่แล้ว +1

      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: th-cam.com/video/WG11rVcMOnY/w-d-xo.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.

  • @bananasplit4037
    @bananasplit4037 8 หลายเดือนก่อน

    How can I use the circuit paired with the Arduino with a NC microswitch as a trigger, where pressing the switch runs the code to the solenoid

    • @bananasplit4037
      @bananasplit4037 8 หลายเดือนก่อน

      NO( normally open

    • @MattInglot
      @MattInglot  8 หลายเดือนก่อน

      ​@@bananasplit4037 You should be able to find tutorials very easily on how to detect switch presses on Arduino, along with sample code. Then all you need is logic in your code that checks if the switch is pressed, then triggers the solenoid.

  • @superliegebeest544
    @superliegebeest544 2 ปีที่แล้ว

    Great video. I dont know anything aboud adruinos but can the nano control 4of these and a ultrasonic sensor?

    • @MattInglot
      @MattInglot  2 ปีที่แล้ว

      You need an IO pin for each thing you wish to control. Additionally not each pin is created equal, for example only some pins on the Nano have PWM which you might want for controlling the solenoid.
      So to answer any such question you start by finding a "pinout" diagram for your target controller, such as this one for the nano: www.circuitstoday.com/wp-content/uploads/2018/02/Arduino-Nano-Pin-Description-952x1024.jpg
      Then you confirm whether there are enough pins that have the capabilities that you need (hint: in your case it's very much yes)

  • @ericmwangi4484
    @ericmwangi4484 2 ปีที่แล้ว

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

  • @Ghostman539
    @Ghostman539 ปีที่แล้ว +1

    Great video. Thank you. I’m a complete newbie to arduino, but I’m working on a project that would require the solenoid to be activated by a remote control, is that something that is possible? Thank you.

    • @MattInglot
      @MattInglot  ปีที่แล้ว +1

      Absolutely! You can control a solenoid with an Arduino, and you can send signals to an Arduino via remote control, therefore you can control a solenoid via remote control. May options for this. I believe the various Arduino kits come with an IR remote. Personally I think the nrf24l01 modules are a better option, but they are a little more advanced to get working correctly. Good luck.

    • @Ghostman539
      @Ghostman539 ปีที่แล้ว

      @@MattInglot Thanks Matt, that’s great. I’ll look into that.

  • @Sloot786
    @Sloot786 9 หลายเดือนก่อน

    How did you decide what resistors to use? Was it decided arbitrarily?

  • @teodordicu361
    @teodordicu361 2 ปีที่แล้ว

    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?

  • @Dg-zj6jo
    @Dg-zj6jo 2 ปีที่แล้ว

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

  • @crj411
    @crj411 3 ปีที่แล้ว +1

    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.

  • @attilanemeth8215
    @attilanemeth8215 4 ปีที่แล้ว +1

    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.

  • @realdenzity2144
    @realdenzity2144 2 ปีที่แล้ว +2

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

    • @MattInglot
      @MattInglot  2 ปีที่แล้ว +1

      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 2 ปีที่แล้ว

      @@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  2 ปีที่แล้ว

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

  • @bryanj266
    @bryanj266 2 ปีที่แล้ว +1

    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!

  • @tomandhannah7381
    @tomandhannah7381 ปีที่แล้ว

    Hey man, I also don't know much about circuits and am planning on making my own pinball machine, I'm going to use a 320w 48v power supply.
    You said you was using a power supply too, I was wondering if you would be able to show that so I can see the full connections as I'm confused to where the wires that go off screen go too and where to power supply is connected too to power the solenoid,
    Many thanks!

    • @MattInglot
      @MattInglot  ปีที่แล้ว

      If you don't know much about electronics and are building a pinball machine then the good and bad news is that you will end up learning a lot about electronics ;)
      Here are a couple good resources that include wiring up power supplies, I think these will be a lot more helpful a lot faster than me typing up the same info in a TH-cam comment:
      mjrnet.org/pinscape/BuildGuideV2/BuildGuide.php?sid=powerSupplies
      pinballmakers.com/wiki/index.php?title=Construction#Power_Supplies
      Note that Pinball wiring and electronics can be dangerous (risk of shock from mains power, risk of fire from failing electronics). You may wish to get the proper training to work on some of this stuff, or partner up with someone who knows how to do it safely.
      Good luck.

  • @jarchdm
    @jarchdm 2 ปีที่แล้ว +1

    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.

  • @muhammadabraar8396
    @muhammadabraar8396 ปีที่แล้ว

    Hello sir, I am curious about how you obtain the power supply 12V. Did you use transformer to step down the voltage? Thank you 😊

    • @MattInglot
      @MattInglot  ปีที่แล้ว +1

      Just a 12V power adapter. Those black bricks that you can buy off Amazon for example. I did not build my own if that's what your asking.

  • @Kalle1854
    @Kalle1854 4 ปีที่แล้ว

    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.

  • @kevin2706
    @kevin2706 2 ปีที่แล้ว +1

    great videos you should make more btw what is your profession?

    • @MattInglot
      @MattInglot  2 ปีที่แล้ว

      Just posted a new one :) Clearly my profession isn't YTer since these things take me months to post new content. I run an agency and my original background is software development.

  • @SlimTortoise
    @SlimTortoise 2 ปีที่แล้ว +1

    I was always told that common practise was to add a fuse on the positive side, But it would work on the negative . In fact fuses on both side would be ok too. Can you tell me why you use the negative?
    On a vehicle I use a standard Relay as a switch, They are rated up to 30 Amps 12 volts. yet only need less than 1/2 amp to operate.

    • @MattInglot
      @MattInglot  2 ปีที่แล้ว +1

      I hate to say it but it's what was convenient at the time with the layout on the breadboard/it was an afterthought. That's all. If I had to do it again I would put it on the positive side, as this would be clearer, especially on schematics. And in some cases which you choose matters (see automative wiring). Also note that this circuit is DC. In AC there is no +/- and you very much want to put the fuse on the hot side to ensure parts of the circuit before the fuse aren't live (disclaimer: don't mess with mains voltage).

    • @SlimTortoise
      @SlimTortoise 2 ปีที่แล้ว

      @@MattInglot Thanks for the reply, Good job by the way. Just fitting a new solenoid to my RV fridge (it opens the gas valve until the main valve senses the flame, It's an aftermarket item (They don't sell the original anymore) so I'm fitting a relay and diode to bring it up to standard. Thanks for your help and Hi from France :-)

    • @MattInglot
      @MattInglot  2 ปีที่แล้ว

      @@SlimTortoise awesome to hear :)

  • @thomasryan4697
    @thomasryan4697 4 ปีที่แล้ว +1

    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 ปีที่แล้ว +3

      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.

  • @Sara-dp1rq
    @Sara-dp1rq 3 ปีที่แล้ว

    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
    @233kosta 4 ปีที่แล้ว +1

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

  • @venugopalswamy5121
    @venugopalswamy5121 2 ปีที่แล้ว +1

    Can we make a solenoid which can lift around 5kg with the same pull push solenoid but with stroke length of 150mm

    • @MattInglot
      @MattInglot  2 ปีที่แล้ว

      Of course you can. Whether it's practical or not is a different question. It's going to need to be a pretty big and powerful solenoid, especially if you're hooking the weight directly to the plunger because you've got no mechanical advantage. I have no idea what your application is, but there's a good chance you would be better served by something else like a servo motor which will be a fraction of the cost and size to lift 5kg (at the disadvantage of taking a lot longer to lift the load).

  • @tswdev
    @tswdev 4 ปีที่แล้ว

    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.

  • @Imthesaviour
    @Imthesaviour 2 ปีที่แล้ว

    How to reduce solenoid load current using pwm?

  • @smottiebug7518
    @smottiebug7518 8 หลายเดือนก่อน

    so couldn't you just use a 12v LED( light emitting Diode) instead of the rectifying diode?
    Since all that it is doing is stopping the voltage from back feeding.
    If thats possible to use an LED. Then I assume just use it like normal that when you push the button the LED will turn on, while also stopping the reverse flow of electricity?

    • @MattInglot
      @MattInglot  8 หลายเดือนก่อน

      As an experiment to see if you can catch it lighting up when power is stopped? Sure, give it a try and let us know what happens.
      As a practical thing? It's not something you'd want to do. Regular diodes are cheaper and actually meant for this purpose.
      Stuff that could be a problem with using LEDs:
      - LEDs have very low current limits. You could burn it out either immediately or over time.
      - LEDs have fairly low reverse voltage, so that could be a problem very quickly, and if you hit that threshold then you'll probably burn out the LED instantenously.
      - You mention a 12V LED, so that implies several LEDs in series to get 12V. I have NO idea how that affects the scenario and would love to find out. Alas I think it means nothing good :D
      Give it a try and let us know!

  • @edfl4913
    @edfl4913 ปีที่แล้ว

    Last comment; what program on the PC did you use to program the Arduino? Thanks!

    • @MattInglot
      @MattInglot  ปีที่แล้ว

      Check out arduino.cc for all the tools for that.

  • @FERNANDOMATIASDOSSANTOSDONASCI
    @FERNANDOMATIASDOSSANTOSDONASCI ปีที่แล้ว

    Hi. Would it be possible to use a TBJ instead of MOSFET as switch in this case?

    • @MattInglot
      @MattInglot  ปีที่แล้ว

      Assuming you meant to write BJT. Yes you could, assuming you are using a BJT that is rated for your load and you build an appropriate circuit. You should google the differences between BJTs and MOSFETs though. You may come to the conclusion that you'd rather use the mosfet in this scenario