element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
Motors and Drives
  • Technologies
  • More
Motors and Drives
Forum 3V Motor Control using Arduino
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Motors and Drives to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 10 replies
  • Answers 5 answers
  • Subscribers 74 subscribers
  • Views 3273 views
  • Users 0 members are here
  • transistor
  • arduino motor
  • ldr
Related

3V Motor Control using Arduino

ross2609
ross2609 over 7 years ago

I'm not too familiar with Arduino's but I'm very interested to get involved with them as I would like to build my own projects!

 

The circuit that I have built is shown below:

image

 

I am trying to control 3V DC motor using the PWM pins on the Arduino. I'm using an LDR in a voltage divider to provide an analog input into the A0 pin. The code I'm using is provided below:

 

int sensorPin = A0;   // select the input pin for the voltage read from sensor

int motorPin = 9;     // select the pin for the motor

int sensorValue = 0;  // variable to store the value coming from the sensor

int val = 0;

 

void setup() {

  //set the pin mode for the motor to be an output

  pinMode(motorPin, OUTPUT);

  Serial.begin(9600);

}

 

void loop() {

  // read the value from the sensor:

  sensorValue = analogRead(sensorPin);

 

  //Print the value read on A0 into the serial monitor.

  Serial.print(sensorValue);

  Serial.print(' ');

  delay(1000);

 

  //sensorPin ranges between 0 -> 1023 so val ranges between 0 -> 255.

  val = sensorPin/4;

 

  //Motor speed changes relative to the value read at A0.

  analogWrite(motorPin, val);

}

 

THE PROBLEM:

I can't see what is wrong with the circuit but the output voltage from the PWM pin 9 always seems to be roughly 0.05V and the VCC voltage 3.3V is all being dropped across VCE. Therefore I have concluded that there is no current flowing through the transistor.

 

I am not sure how to solve this problem.

 

Thanks for any help!

  • Sign in to reply
  • Cancel

Top Replies

  • shabaz
    shabaz over 7 years ago +7 verified
    Hi Ross, I've not looked in detail (unfortunately I don't know Arduino so well either), so there could be more issues, but one thing that needs to change is the line: val = sensorPin/4; to: val = sensorValue…
  • jw0752
    jw0752 over 7 years ago +6 suggested
    Hi Ross, I meant to compliment you on the excellent presentation that you made for your question. Good diagrams and background information make responding much easier and more on the point. John
  • mcb1
    mcb1 over 7 years ago +6 suggested
    I agree with jw0752 . It's nice to see ALL the information. Personally I'd drop the series resistor from 660 to 470ohm, or even down to 220. Your calculation for the full collector current shows you need…
Parents
  • jw0752
    0 jw0752 over 7 years ago

    Hi Ross,

    Let's break it into a couple of pieces. Test the transistor driver by taking the lead of Rb that is currently connected to the Arduino and move it between the collector of the transistor which should turn on the motor and the emitter which should turn off the motor. You have not indicated the part number of the transistor, nor whether you have used an NPN of a PNP. In this application the transistor should be an NPN. To test the Arduino you can connect an LED from the base end of Rb to the ground rail. Make sure the transistor's base isn't connected for this test. Once we have narrowed down where things aren't working we can revisit the other possible problems.

    John

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Reply
  • jw0752
    0 jw0752 over 7 years ago

    Hi Ross,

    Let's break it into a couple of pieces. Test the transistor driver by taking the lead of Rb that is currently connected to the Arduino and move it between the collector of the transistor which should turn on the motor and the emitter which should turn off the motor. You have not indicated the part number of the transistor, nor whether you have used an NPN of a PNP. In this application the transistor should be an NPN. To test the Arduino you can connect an LED from the base end of Rb to the ground rail. Make sure the transistor's base isn't connected for this test. Once we have narrowed down where things aren't working we can revisit the other possible problems.

    John

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Children
  • ross2609
    0 ross2609 over 7 years ago in reply to jw0752

    Hi John, thanks for the reply!

     

    I’ll certainly bare this in mind when it comes to testing the transistor, I appreciate the effort you’ve put into your reply it’s very helpful!

     

    Thank you for the compliment haha I feel it is much easier when diagrams are used instead of me just trying to explain my situation hahaha!

     

    Thanks again!

    • Cancel
    • Vote Up +4 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