element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Simple circuiting question, using Arduino
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 30 replies
  • Answers 2 answers
  • Subscribers 420 subscribers
  • Views 3148 views
  • Users 0 members are here
Related

Simple circuiting question, using Arduino

e14 Contributor
e14 Contributor over 13 years ago

I want to control a 24v DC circuit with a my arduino, what would be the proper component and roughly how would I use it. Basically when I set a pin to high, I want it to switch the 24V on, and turn it off when set to low. From what I can gather, I need a MOSFET, but I have minimal knowledge on what to look for in one. Would someone be able to assist me?

 

(p.s. This is my first discussion, sorry if I am doing this incorrectly)

  • Sign in to reply
  • Cancel

Top Replies

  • johnbeetem
    johnbeetem over 13 years ago in reply to ntewinkel +2
    Nico teWinkel wrote: You should probably at least have a resistor between the Arduino pin and the mosfet. [I've never designed with Arduino, so these are comments that apply to most microcontrollers.]…
  • ntewinkel
    ntewinkel over 13 years ago +1 suggested
    Hi Mason, You should probably at least have a resistor between the Arduino pin and the mosfet. Oomlout has a circuit example using a smaller transistor: http://www.oomlout.com/oom.php/products/ardx/circ…
  • ntewinkel
    ntewinkel over 13 years ago +1
    ps, this Instructable might also help: http://www.instructables.com/id/Use-Arduino-with-TIP120-transistor-to-control-moto/
Parents
  • e14 Contributor
    0 e14 Contributor over 13 years ago

    Alright, thanks for all the help so far guys! I stopped at radioshack on my way home from work today and picked up two NPN transistors (TO-220) and started experimenting. Ive gotten myself confused. I connected a digital pin from the arduino to the base pin of the transitor, and then ran the emitter pin through an LED to ground. Without and voltage source on the collector pin, the LED lights up. My original plan was to use 5v from the arduino on the collector. Why is my LED lighting up?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • billabott
    0 billabott over 13 years ago in reply to e14 Contributor

    Mason, this tutorial should help you to understand: http://www.electronics-tutorials.ws/transistor/tran_1.html and http://www.electronics-tutorials.ws/transistor/tran_2.html

     

    Your LED is on because both diode junctions, the Base-Emitter and Anode-Cathode, are forward biased which allows electrons to flow.

     

    The NPN transistor's output signal, to control a LED or a Motor, should be taken off of the Collector pin to avoid the exact event that you discovered.  A motor would allow too much current through the base and potentially burn up the transistor, don't you think?

    Remember this about Transistor Currents: typically IBE <  0.05 * ICE.   And that implies the Gain is about 20; lots of transistors have a Gain >= 50.

     

    P.S.  TO-220 is the package style of many widely divergent devices and does not say anything about its performance characteristics.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • e14 Contributor
    0 e14 Contributor over 13 years ago in reply to billabott

    Ah, my mistake, here is the datasheet for the transitors that I bought. While I am currently using them with an LED for testing, they should be plenty sufficient to handle the 24v for the final application.

     

    Edit: After switching my LED to the collector, I still seem to have the same thing happen. The LED gets some power, causing it to turn on, although pretty faintly. If I add the 5v to the emitter, it then turns on at full brightness.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • billabott
    0 billabott over 13 years ago in reply to e14 Contributor

    Unbelievable!  Is one leg of the LED just hanging in the air?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • e14 Contributor
    0 e14 Contributor over 13 years ago in reply to billabott

    Haha, no. Im sorry, I wish I knew more about what I was doing so I could explain it better.

     

    Currently I have the digital pin of the Arduino, going to the base of the transistor. Then the led is attachted to the collector, through a resistor, to ground. Without any additional voltage added to the emitter, the LED still faitnly lights up when the Arduino pin goes to HIGH. Is this a normal occurance?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • billabott
    0 billabott over 13 years ago in reply to e14 Contributor

    Well, try to understand this.  The device is an N-P-N.  It is sort of symetrical.  But the construction details vary in volumes, contact surface areas, and concentration and type of doping in the 3 parts.  What ever is connected to the collector would only be connected to V+ and never back to ground.  You simply have the Wrong n-p diode (2/3 of the transistor) forward biased and it will conduct but not very well in the case of this particular device.

     

    I insist that you research the safety considerations of working with 24 Volts DC and the danger of moving motor shafts of high torque 24 Volt motors.  I think maybe you should start with something much smaller and safer for your own sake.

     

    By the way, do you have any idea what an ESC is?  It is an electronic speed control.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • e14 Contributor
    0 e14 Contributor over 13 years ago in reply to billabott

    Im actually not using a motor, its a electric water valve from home depot.

    http://www.homedepot.com/p/Orbit-Yard-Watering-Valve-27987/203019976#.UdDyLvlvOn0

     

    From the research I've done, it takes 24v+ to open and 24v- to close. I was hoping it would be realtively easy to time it with an Arduino. As a first practical project, it seemed like a good starting point, due to the simplicity of the device.

     

    I guess my understanding of a transitor is still flawed. From some reason I cannot wrap my head around it.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • groaker
    0 groaker over 13 years ago in reply to e14 Contributor

    http://www.orbitonline.com/lib/media/27752-24%20rH%20(7)1.pdf

     

    The above is to a link to the orbit controller for the valve. There is not much information, but the controller seems to run on batteries. I don't know if that is the clock, or the whole thing. From what you say, the relay seems to be latching (bistable.) I don't know if this is any help, but I thought I would throw it in here anyway.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • johnbeetem
    0 johnbeetem over 13 years ago in reply to e14 Contributor

    Mason Adkins wrote:

     

    Im actually not using a motor, its a electric water valve from home depot.

    http://www.homedepot.com/p/Orbit-Yard-Watering-Valve-27987/203019976#.UdDyLvlvOn0

     

    From the research I've done, it takes 24v+ to open and 24v- to close. I was hoping it would be realtively easy to time it with an Arduino. As a first practical project, it seemed like a good starting point, due to the simplicity of the device.

     

    I guess my understanding of a transitor is still flawed. From some reason I cannot wrap my head around it.

    From what you describe, you need to run current one way through the relay to open and the other way to close.  This is like driving a DC motor where you want to run it both forward and reverse.  Even though your valves is not a motor, you're driving it the same way and have to consider motor issues like flyback diodes.  Speakers are like motors too -- anything with an electromagnet has motor issues.

     

    If this is the case, the circuit to drive it is called an H bridge.  It's fairly complicated internally, so you probably want to use an H bridge controller chip such as the ST L298.  I've never used that chip (or any other H bridge chip) myself and there may be others better suited to your application.

     

    Here are a couple of recent element14 discussions talking about H bridges:

     

    http://www.element14.com/community/message/65356#65356/l/the-magpi-magazine--aimed-at-learners--printed-edition-kickstarter

     

    http://www.element14.com/community/message/72951#72951/l/help-with-wiring-piface-to-an-l298-h-bridge

     

    You may want to get a low-current 24V supply and play with the relay off-line to see how it behaves.  If you don't have flyback diodes, expect to see sparks which could damage your supply.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • e14 Contributor
    0 e14 Contributor over 13 years ago in reply to johnbeetem

    John,

    Thanks a lot for the info, this seems like a better system. Would you be able to skim this and confirm is what you are suggesting?

    http://www.youtube.com/watch?v=1Q0ZwpycbzY

     

    If so, would I be able to safely switch the 6v input he uses, for my 24v source?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • johnbeetem
    0 johnbeetem over 13 years ago in reply to e14 Contributor

    Mason Adkins wrote:

     

    John,

    Thanks a lot for the info, this seems like a better system. Would you be able to skim this and confirm is what you are suggesting?

    http://www.youtube.com/watch?v=1Q0ZwpycbzY

     

    If so, would I be able to safely switch the 6v input he uses, for my 24v source?

    Sure, that looks good.  According to the ST data sheet, the L298 can switch up to 46V, so 24V leaves plenty of margin.  I noticed that the video did not have flyback diodes on the outputs.  I guess with such a small motor they weren't needed, but the data sheet does recommend them and shows where they go.  The problem with motors, relays, and any inductive load is that once you get a current going through an inductor it doesn't want to stop.  So if you switch it off, the current keeps flowing as the magnetic field collapses and if the current can't go anywhere it charges whatever stray capacitance is on the node creating a high voltage spike.  This is similar to how spark plugs work.  The diodes provide a current path to prevent the spikes, which can destroy transistors.

     

    You might be able to get a module that already has the diodes built in, or there may be better chips available.

     

    As I said earlier, use LEDs and suitable current limiting resistors to verify operation before hooking up to the real world device.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • e14 Contributor
    0 e14 Contributor over 13 years ago in reply to johnbeetem

    Awesome, thanks again.

     

    Everyone here is so helpfull, great community. I will be back when I have more questions!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • e14 Contributor
    0 e14 Contributor over 13 years ago in reply to johnbeetem

    Awesome, thanks again.

     

    Everyone here is so helpfull, great community. I will be back when I have more questions!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube