PIC16F627 - controlling motors

Status
Not open for further replies.

drage

New Member
Hi there,

Recently purchased a velleman pic programmer for n00bs from Maplins.

Managed to work out how to make an LED come on after pushing a button.

Now I am wondering:
How much voltage does the PIC put out when a pin/leg goes "high"?

And how would i go about making a motor come on, as they draw a constant current that is far more than an LED?

I purchased a mini 5Volt relay (pcb mountable), which i was thinking i could have switch the motor on or off?

Any advice welcomed, also what are your thoughts on these DC motor controllers (out of the box, or kit form)?

Cheers,
Paul
 
drage said:
Hi there,

Recently purchased a velleman pic programmer for n00bs from Maplins.

Managed to work out how to make an LED come on after pushing a button.

Now I am wondering:
How much voltage does the PIC put out when a pin/leg goes "high"?

Roughly 5V, it's a CMOS logic HIGH.

And how would i go about making a motor come on, as they draw a constant current that is far more than an LED?

Motors don't take a constant current, far from it!.

I purchased a mini 5Volt relay (pcb mountable), which i was thinking i could have switch the motor on or off?

Yes, use a transistor to switch the relay, details in the 'hardware extras' section of my tutorials.
 
The "High" voltage is Vdd-0.7V, the current available from any one port pin is 25mA. These are basic figures as used in most of the PIC controllers, and can be obtained by reading the datasheet, along with all sorts of other useful information.

The relay type has to be capable of a pull-in voltage slightly less than Vdd-0.7V and draw less than or equal to 25mA in order to be used directly from the port pin. Even though the port pins have protection diodes in them, I would still recommend that you put a protection diode across the relay coil to dissipate any back emf that is generated.

The arrow points to Vdd like this port pin o-->|--o Vdd
The relay coil being wired across or in parallel with the diode.

A better way to do it is with a cheap transistor and a couple of resistors, that way you don't need to worry about how much current the port pin has to offer, instead the transistor will be providing the "switching function"

Use say a BC337, put the emitter to Vss(Gnd) put a resistor around 10k from Vss to the base of the transistor, and another resistor around 4k7 from the base junction with the other resistor to the port pin. The relay gets wired between the collector and the Vdd, assuming it's a 5V relay of course. Also you still need the protection diode, but this time wire it between the collector of the transistor to Vdd, arrow still points to Vdd.

If you put two transistor output stages together, and drive two change over relays, you can arrange the wiring in such a way that you can not only start/stop the motor, but also change it's direction.
 
ah hah!

thanks mate both responses very useful! going to have a play and see what i can do, cheers
 
Just use a logic MOS-FET and conect the gate trought a 4K7 resistor.
God.....i'm using this answer so often :lol.....I'm a MOS-FET fan :lol
 
..yeah if i knew what one of them was that would be great.. wanders off to google (again!), cheers
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…