Newbie Question

I am very new to this all, I am starting it as a summer project to
keep me away from boredom. I have read many posts but none seem to
cover exactly what I need. I have a PIC 16F84 that I have been messing
around with. I have also been able to make L.E.D.s light up and such
from my parallel port on my laptop. My question: I want to control
small DC motors, but I don't want to be powering it from my LPT port,
I instead want to send something to the PIC and have it turn on
another circuit to drive the motor, how should I go about
accomplishing this? I am very very new so please be gentle with your
answers, and thank you for your help.
Reply to
James
Loading thread data ...
Well, my first advice to you would be to get your PIC to turn on LEDs. DC motors add a layer of complexity that you do not need.
Once you have proven to yourself that you can interface to LEDs, which are relitively simple to debug, then move on to controlling DC motors with transistors, relays or H-bridges.
A Google search on the terms: DC motor PIC robot , reveals some useful links.
formatting link

Reply to
Blueeyedpop
For controlling the motor, you're going to want an H-Bridge. This is a circuit which allows low amounts of current to switch high amounts of current, specifically designed for a motor to drive it in two directions.
I'm actually just researching this right now. It seems to me that for small DC motors (1-2A) the best idea is just to buy an H-Bridge IC. I've seen them at acroname.com for like $5 each, but they're only about $1 for larger suppliers like
formatting link
Using a chip saves you the trouble of buying all the discrete components and soldering them together..plus the chip has clamp diodes to keep the motor from blowing up your pic.
OTOH, in my lab this past semester we controlled a 12V DC motor using only a single transistor and flyback diode. Of course it only ran in one direction, and the transistor got so hot it could burn you, but it worked.
As another poster suggested, do some more experimentation with the pic before using the motors. Turn on some LEDs, make them blink. Interface to a momentary switch, do debouncing on it. Motors should be the 3rd or 4th project, IMO.
You'll need to use PWM to effectively use the motor.
Reply to
Mark Haase
Look at some of the Microchip website for application notes, for keywords like PWM (pulse width modulation) and H-bridge. Be careful, some PICs have PWM hardware, but the '84 does not. You can use PWM to vary the brightness of your LEDs, so you may not need an H-bridge and motor straight off.
Have fun!
PeterS.
Reply to
Spam Magnet
James,
I'm about a month or two ahead of you on the learning curve. I would suggest that you get the book "Programming Robot Controllers" by Myke Predko. It costs around $25, but it is worth it. The book is all about programming the PIC 16F84 and its replacement the 16F627.
The first project in the book is making the programmer for the PIC (for under $20). Next is building an RS232 serial interface to allow communication with your PC. Next is turning on and off LCD's and then controlling their brightness using pulse width modulation (which is something you will need to do to vary the speed of motors. He also covers controlling motors and interfacing many types of sensors.
The programs are written in a manner that allows you to easily integrate the different pieces in a "cook book" fashion. A CD comes with the book that contains files for all of the code, plans for the programmer, and the free software needed to program the PIC.
If you decide to get the book, here are a few things I learned that I think would be helpful:
1. If you don't know the C programming language, go to
formatting link
and download their free C tutorial; it is about the best there is and FED's C is close to PIC-C Lite which is the free compiler included in Myke's book. I did that to learn C and it worked good for me.
2. Go to the Microchip site and to the PIC-C site and download the latest versions of the programs included in the book. This is very important if you are using a computer with XP on it. I spent a month trying to get my first code to work. I then installed the new versions of PIC-C Lite and MPLAB and everything worked fine.
3. If you are going to make the El-Cheepo controller from the book, go to Myke's webpage and get the updated schematics. I didn't build one, but I have seen it mentioned in several places that the updated version works better.
4. Don't panic if a lot of the stuff in the book before the first coding project doesn't make sense to you the first time you read it, just keep reading through it and do the first few projects and then go back and reread it. It is a lot clearer the second time.
Good Luck!
Paul Pawelski
Reply to
catman

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.