Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Arduino - Photocell + Transistor + DC Motor

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
899 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Nov 21, 2010

Nub here. Everything I was reading about controlling dc motors with an arduino was saying that you need a motor driver (which is apparently a chip you buy to allow the arduino to interface w/ the motors).

I knew I could straight up go from the 5v supply on the arduino straight to the motor and have it run, but how to control it without buying a driver? The digital pins, through which I could send control signals, do not provide enough current.

Since I had a bunch of components that I purchased from RadioShack (having no clue what it was I was purchasing), and having done nothing but read about electronics for THREE WHOLE DAYS (heh), I thought I'd try using a transistor as a switch. The transistor has 3 pins: base, collector and emitter. Hooked the base up to a digital pin for turning the transistor on and off. Hooked collector up to the 5v supply. Hooked emitter up to the motor.

Simple arduino code to try turning the motor on for 2 seconds, off for 2 seconds...and it worked. Woot! I HAVE NO IDEA WHAT I'M DOING LOL!

So...even though I'd read nothing about this, I just wondered what would happen if I sent an analog signal to the transistor base instead of the digital on/off signal. From what I understood about transistors, I thought they were either passing voltage or they weren't (a signal controlled switch), so didn't expect it to change the motor's behaviour.

But turns out that I could control the motor's speed by adjusting the analogWrite value (0-255), but found that values under 30 meant the motor wouldn't do anything.

So...since I had also, in my ignorance, purchased some photocells, I try mucking around with one. First, just getting it to spit out the values from an analogRead to the Serial Monitor while I waved stuff over the top of the photocell. ( This page was useful: http://www.ladyada.net/learn/sensors/cds.html )

For the finale, I had the photocell values determine the motor's speed. And thus, history was made.

Category:

Science & Technology

Tags:

License:

Standard YouTube License

  • likes, 2 dislikes

Link to this comment:

Share to:

Uploader Comments (mellomutt)

  • What kind of transistor did you use?

  • @rollsroyce1400 it was a TIP3055 NPN silicon transistor. Got it from RadioShack. I'm still learning about this stuff and this transistor was the only one I had, but it appears to work.

see all

All Comments (3)

Sign In or Sign Up now to post a comment!
  • Lucky you have a Arduino Mega

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more