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 Toy car trouble
  • 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
  • Replies 14 replies
  • Subscribers 403 subscribers
  • Views 1832 views
  • Users 0 members are here
Related

Toy car trouble

Former Member
Former Member over 13 years ago
Hi guys. I am trying to make a car that drives on its own and avoids dark areas. As of right now, all I am trying to do is make it so that my car can be controlled by the Arduino. I am having trouble doing this with a transistor. Let me walk you through the picture, it is hard to follow otherwise. (Heres a link to the picture, I could not get it to upload to this post.   https://docs.google.com/document/d/1-2Lmc2NAMGC351_IcKcm4nRqQ-cmjmCi68UnDPqj6K4/edit

Ok, first off, the red cord running from the 9V battery gives the entire rail running parallel to the red line power. From there, a small green wire connects power to the left side of the transistor. The middle prong of the transistor runs to the arduino pin 13 (though from the bad camera angle it looks like it runs to ground). A cord connects the right side of the transistor to underneath the car and to all the motors (which can be seen in the second picture below the first one) and then resurfaces on the left side where it connects to the ground rail. The ground rail runs to the ground of the battery and a 1k resistor connects the ground rail to the ground of the arduino. (I think this might be where I am going wrong)

Then, the arduino is running this code

void setup() {               

  // initialize the digital pin as an output.

  // Pin 13 has an LED connected on most Arduino boards:

  pinMode(13, OUTPUT);    

}

 

void loop() {

  digitalWrite(13, HIGH);  

  delay(1000);         

  digitalWrite(13, LOW);  

  delay(1000);            

}

 

So in theroy, the arduino should turn the motors on for 1 second and then off for 1 second continually. But I am getting nothing. If I connect the middle prong of the transistor straight to the power rail, the motors turn on. So I figured maybe the arduino wasnt giving it power, but I hooked up my multimeter inbetween pin13 and the middle prong of the transistor and it does give off 5 volts. I thought maybe 5 volts was not enough, so I hooked up 3 1.5v batteries to test it, and with only 4.5v provided from the batteries, it was enough to make it work.

 

I have no idea what else to test. If you guys have any ideas, please let me know!

  • Sign in to reply
  • Cancel

Top Replies

  • Former Member
    Former Member over 13 years ago in reply to dirtdiver +1
    Finally! I managed to get it to work. I switched transistors out (which I had already done one before) and it worked. I think the reason it did not work last time is because I had the wires hooked up backwards…
Parents
  • dirtdiver
    dirtdiver over 13 years ago

    I had the same problem.

    Another way  to have a motor running from the arduino is with the L293D  - its easy to use , its cheap and it works!

    + you can reverse the motor( it has an H-bridge inside it)

    and with one L29 you can control two motors

    I can give you a simple code and a schematic if you want me to

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 13 years ago in reply to dirtdiver

    I appreciate the suggestion for the L293D, but more than making a car, I am just trying to get the parts to work so I can get used to working with them. Though I will deffinitely look into that for future projects!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • dirtdiver
    dirtdiver over 13 years ago in reply to Former Member

    its helpful couse you control the speed, rotation direction, and on-off state of the motor with 3 digital pins.And you can use the arduino's 5v supply to run the motors

    as for the reversing you can use a DPDT relay for automatic wire-switching system

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 13 years ago in reply to dirtdiver

    Finally! I managed to get it to work. I switched transistors out (which I had already done one before) and it worked. I think the reason it did not work last time is because I had the wires hooked up backwards. Haha 7 hours just to figure out I had the wires backwards XD I feel like an idiot. Thanks to all you guys for your help! I REALLY appreciate it!

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • dirtdiver
    dirtdiver over 13 years ago in reply to Former Member

    Seems like you found the problem by yourself image but im glad to be of service

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • ntewinkel
    ntewinkel over 13 years ago in reply to Former Member

    Sometimes learning can be painful! I've learned a lot of things the hard way like that, but hey the more pain you go through, the more likely you'll remember it when you need it in the future!

    Glad you got it working image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • ntewinkel
    ntewinkel over 13 years ago in reply to Former Member

    Sometimes learning can be painful! I've learned a lot of things the hard way like that, but hey the more pain you go through, the more likely you'll remember it when you need it in the future!

    Glad you got it working image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • Former Member
    Former Member over 13 years ago in reply to ntewinkel

    Hey guys, I ran into some more trouble. The setup is the same except I exchanged the transistor I was using with a MOSFET (The other one couldnt handle the voltage I was trying to use). Any how, I just exchange with the MOSFET but it only half works. No matter what power source I hook up, only 2.5V through the motors. I am using an IRF510PBFIRF510PBF N channel MOSFET so it shouldnt be limiting the voltage to 2.5. And if I connect the wire from the gate directly to the + rail, it works perfectly. But when it is pluged into the Arduino, I only get 2.5V. Any ideas on what the reason could be?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • 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