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
  • 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 Weird Problem
  • 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 Not Answered
  • Replies 16 replies
  • Subscribers 402 subscribers
  • Views 1168 views
  • Users 0 members are here
  • tutorial
  • help
  • hardware
  • robots
  • prototyping
  • engineering
  • electrical
  • arduino
Related

Weird Problem

dirtdiver
dirtdiver over 13 years ago

I cant find the problem here!

I have a motor hoocked up like shown in the tutorial motors and transistirs, I have a code turnin a PWM pin  high and low  (them i tried with 0 and 255, if there is even a difference)

 

 

 

void setup() {               

 

 

  pinMode(5, OUTPUT);    

}

 

 

void loop() {

  digitalWrite(5, HIGH);  

  delay(1000);             

  digitalWrite(5, LOW);   

  delay(1000);             

}

 

I have 5 volts-0 Volts changing within a second, but when i connect the motor it stays at 0 volts

I hoocked up an LED and it works fine

The motor is not baked, i tried it by connecting it directly to 5 volts and it rotates.

The transistor i used is rated for 1A collector current.

Any ideas where the problem might be?

  • Sign in to reply
  • Cancel

Top Replies

  • YT2095
    YT2095 over 13 years ago in reply to Anonymous-58970 +2
    my circuit works perfectly with the 4k7, I`v just drawn it out for you here: it`s not perfect and may need magnifying a little? but it works great (I have a board with 8 of these on that have been working…
  • YT2095
    YT2095 over 13 years ago +1
    exactly as Pablo said, and you MUST use a resistor from the Arduino pin to the Base, otherwise you have a direct current path from your arduino pin to a power rail, and this can easily destroy that port…
  • mcb1
    mcb1 over 12 years ago in reply to YT2095 +1
    For YT2095 Your circuit works with a 4k7 because the relays don't require as much current as the motor. The 2N2222A 2N2222A has a gain of about 100. That means that if the Base to Emitter current is 1mA…
Parents
  • ntewinkel
    0 ntewinkel over 13 years ago

    Here's the Oomlout tutorial, which provides a pretty clear schematic too. Assuming you're using a different tutorial, this might help by giving another angle on it.

    http://www.oomlout.com/oom.php/products/ardx/circ-03

     

    Cheers,

    -Nico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • YT2095
    0 YT2095 over 13 years ago in reply to ntewinkel

    quite funny really, I was using the 2N2222A2N2222A yesterday to drive 12v relays with a 5v signal from a TTL And gate image

    I used a 4k7 to feed the base and the base also had a 20k pull-down resistor (so nothing bad happens if I pull the AND chip).

    I`m thinking that IF the transistor is ok, could the Back EMF protection diode be forward biased?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • YT2095
    0 YT2095 over 13 years ago in reply to ntewinkel

    quite funny really, I was using the 2N2222A2N2222A yesterday to drive 12v relays with a 5v signal from a TTL And gate image

    I used a 4k7 to feed the base and the base also had a 20k pull-down resistor (so nothing bad happens if I pull the AND chip).

    I`m thinking that IF the transistor is ok, could the Back EMF protection diode be forward biased?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • Anonymous-58970
    0 Anonymous-58970 over 13 years ago in reply to YT2095

    4k7 ?

     

    YT2095 u have a schem of that project ?

     

    Message was edited by: Pablo Garcia

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • YT2095
    0 YT2095 over 13 years ago in reply to Anonymous-58970

    No, I haven`t drawn one yet, but I can do if you like, I`ll probably post it in my Blog when I do a write-up for my latest Robot build, it`s very rare that I actually write any of my circuits down to be honest.

    also 4k7 is just the same as 4.7k (4700 ohms), I just write it that way out of habit image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Anonymous-58970
    0 Anonymous-58970 over 13 years ago in reply to YT2095

    it kinda through me off a bit like wtf lol but yea a 4.7k idk i havnt seen any schem other then 1k so if ur having a similer problem try using a 1k seen lot of schem's with 1k if u have the time make a schem in cad soft eagle helps when ur not to sure it allows u to see where u wired it in i fried a L298HN it helps when u build it or draw it making ur own datasheet

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • YT2095
    0 YT2095 over 13 years ago in reply to Anonymous-58970

    my circuit works perfectly with the 4k7, I`v just drawn it out for you here:

    image

    it`s not perfect and may need magnifying a little? but it works great (I have a board with 8 of these on that have been working well for nearly a decade), so this same CCT will also be suitable for the Original post, just swap out the Relay coil for your motor, and the AND gate should be the arduino pin.

    I`m using 12v on mine as that`s what the relays needed, but 5V will work too image

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Anonymous-58970
    0 Anonymous-58970 over 13 years ago in reply to YT2095

    hermm try it with out the 20k or u tried it ?

     

    if not then play with a 1k as well the 1k  and put that 20k just playing with safe resistors till it get it

     

    Message was edited by: Pablo Garcia

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • YT2095
    0 YT2095 over 13 years ago in reply to Anonymous-58970

    the circuit above is already built and working in my Robot, I need the 20k pull-down in case I ever have to pull the 74LS0874LS08 chip with power on.

    it`s not a small robot, and so I need plenty of fail-safes to prevent it going crazy in the house and wrecking stuff, my 3 year old son can ride on it! image

    so for every stage, the Default state has to be OFF.

    here`s a sneak preview of the board: image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Anonymous-58970
    0 Anonymous-58970 over 13 years ago in reply to YT2095

    like i seid im still new to arduino here what it say on the volt meter ? on the other 1 u made i have a buggie transistor it was a 2N2222A2N2222A it was noticeable in the volt meter guess was a bad batch of transistors it works but the current was fluxuating very bad that so far i know with 2N2222A2N2222A

     

     

     

    Im leaning as i go i use to repair well get part for my brother to repair car radios and amps they even got me a experament back in 1986 i had memorized all componets part in a radio and amps but it been a whil sense i repaired a radio im trying to rememoriz all resistor transistors resistor and so on and leaning arduinos at the same time

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Anonymous-58970
    0 Anonymous-58970 over 13 years ago in reply to YT2095

    that a interesting setup alot diff from my friend setup he toke a kids razor Gokart controller and hocked up a arduino robot the robot has a hitch to hock up a trailer the robot pull and parks the trailer boat becus his brother has 1 arm he built it for him to help him park the trailer

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Anonymous-58970
    0 Anonymous-58970 over 12 years ago in reply to YT2095

    whoa pc been dead for a while im back have u figured out the problem ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mcb1
    0 mcb1 over 12 years ago in reply to YT2095

    For YT2095

    Your circuit works with a 4k7 because the relays don't require as much current as the motor.

     

    The 2N2222A2N2222A has a gain of about 100. That means that if the Base to Emitter current is 1mA, the Collector to Emitter current will be 100mA.

     

     

    For your 4k7 base resistor I=E/R therefor I = 5/4700 = 1.06mA. With a gain of 100 that gives you 106mA (in theory)

     

     

    The note for the motor tutorial, says they need 600mA, and therefore this base resistor is too high in value.

     

    A 1k resistor will give I=E/R = 5/1000 = 5mA and with a gain of 100 gives 500mA thereabouts.

    You could drop the value even further to 470 ohms, which is 10mA (well within the Arduino pin safe limits) and gives 1000mA available.

     

    One thing that hasn't been asked, is how much current does the motor draw on 5v. Remember this tutorial is for a small low powered motor and the 5v is coming from the Arduino board, which depending on the manufacturer, can be anything from 250mA to 1.5A.

     

    If you are powering the board and motor from the USB, it might give only 100mA, depending on the computer type.

     

    One further thing to check is download the datasheet that matches YOUR transistor.

    Some manufacturers change the base pin location between models. The Oomlout sheet spells this out clearly

     

    Motor Not Spinning?
    Motor Not Spinning?
    If you sourced your own transistor, double check with the data sheet that the pinout is compatible with a P2N2222AG
    (many are reversed).

     

     

    Mark

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
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 © 2025 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.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube