Circuit & Component Check

D

Danny T

Guest
Hi all,

Following on from the "Calculating Resistors Required" thread, which
went off on a tanget (cos I'd no idea what I was doing!), could you see
if all looks ok with the following (inc. resistor values etc.).

I've posted the specs for motor/led/etc. I think might be useful at the
bottom.

Thanks :)


VCC
+ 6V
'--------------------o------------------------------o-----------o----
| | | | |
.-. .-.Resistor .---. | |
| | | |10K | | | Diode 1x .'. .'.
10K | | | | | | 1N4148 | | | |
'-' '-' | | | (5.3V?) | | | |
| '--------. '---' | | | |
| | | | Diode 4x | | Diode 4x| |
| o | | | PIC 1N4148 | | 1N4148| |
| |=| | | VDD __ VSS (3.2V?) | | (3.2V?) | |
| o | | '----o| |o---. '-' '--.
| | Switch | '----o| |o---)---------. | |
| | '---------o| |o---)---------). | |
o----)------------------o|__|o---)---- || _-_ _-_
| | | | || |___| |___|
o | | | .-. || - -
|=|| MCLR connected | |160R || | Motor Motor
o | | to VDD | | | || | |
| | | '-' || | |
|Switch | | || | |
| | | | ')-----)----. |
| | | ,---. | | | |
| | | | X | | ||-+ | ||-+
| | | '---' | ||-> | ||->
| | | LED '--||-+ '-----||-+
| | | | N-Type | N-Type |
| | | | MOSFET | MOSFET |
| | | | | |
-o----o---------------------------o----o-----------o--------------
===
GND
(created by AACircuit v1.28.4 beta 13/12/04 www.tech-chat.de)


There's two switch inputs, and 3 outputs - 1 LED, 2 Motors.

MOTORS: 3V DC
No load current 0.13A max.
Rated load current 0.45A max.

LED:
I F (max) 15mA
V F (max) 2.8V

PIC:
Input 3.0 - 5.5V

I took the diodes as dropping about 0.7V, and calculated the LED
resistor as ((6 - 0.7 (voltage to PIC)) - (2.8 (LED voltage))/(15 (LED
current)) * 1000 = 166. The 10K resistors were suggested in the other
thread, to tie the inputs to 5V or 0V. However, it just dawned on me
that I've got 6V, and not 5V! I guess I can stick a diode or two in there?

Also, can the diodes be "shared"? Eg., connect both motors to the same
diodes. And even remove one of them, and connect it to the output of the
diode in place for the PIC? eg.:


VCC
+
| 6V
'---------| 4.4V 3.7V
V Diode Diode Diode
- ->|--->|---.
| 5.3V | |
o--------------' V Diode
| -
| |
|5.3V o------.
| __ | |3V
'--------o| |o- 3V | |
-o| |o- | |
-o| |o- _-_ _-_
-o|__|o- |___| |___|
- -
| |
(created by AACircuit v1.28.4 beta 13/12/04 www.tech-chat.de)

--
Danny
 
Danny T wrote:
Hi all,

Following on from the "Calculating Resistors Required" thread, which
went off on a tanget (cos I'd no idea what I was doing!), could you
see if all looks ok with the following (inc. resistor values etc.).

I've posted the specs for motor/led/etc. I think might be useful at
the bottom.
[snip: good diagram]

1. As you said: the top of the 10k resistors should go to the PIC Vdd rail
and not to 6V.
2. You need a 100nF decoupling capacitor between Vdd and Vss mounted as
close to the PIC as possible. This smooths out noise and glitches on the
supply; it stops the PIC from crashing when you switch the motors on!
3. You can share power-supply dropper didoes between the motors, but use a
seperate diode for the PIC to reduce noise on the PIC supply rail.
4. You need back e.m.f. protection diodes across the motors. Inductors
(motor, relay ...) generate a large back e.m.f. when you switch them off.
This diode should be connected across the motor with the cathode pointing
upwards. The diode short-circuits the back e.m.f. to protect other
components.

Otherwise, that looks like it should fly!
 
Andrew Holme wrote:

2. You need a 100nF decoupling capacitor between Vdd and Vss mounted as
close to the PIC as possible. This smooths out noise and glitches on the
supply; it stops the PIC from crashing when you switch the motors on!
Righto. Just Googled about this, I understand now :)

3. You can share power-supply dropper didoes between the motors, but use a
seperate diode for the PIC to reduce noise on the PIC supply rail.
Right. So am I right in believing 2x3V motors in parallel still only
require 3V supply, but probably double the current?


4. You need back e.m.f. protection diodes across the motors. Inductors
(motor, relay ...) generate a large back e.m.f. when you switch them off.
This diode should be connected across the motor with the cathode pointing
upwards. The diode short-circuits the back e.m.f. to protect other
components.
Right, I think I understand that (when stopped, the motor is still
spinning, and will cause a spike of power the wrong way?), but don't
understand how to wire it. I've already got a string of diodes
connecting to the motors - any chance of a quick diagram? Can it be the
same diode as I've labelled for the drops?

Thanks again,

--
Danny
 
Danny T wrote:

[snip]

Right. So am I right in believing 2x3V motors in parallel still only
require 3V supply, but probably double the current?
Correct.

4. You need back e.m.f. protection diodes across the motors.
Inductors (motor, relay ...) generate a large back e.m.f. when you
switch them off. This diode should be connected across the motor
with the cathode pointing upwards. The diode short-circuits the
back e.m.f. to protect other components.

Right, I think I understand that (when stopped, the motor is still
spinning, and will cause a spike of power the wrong way?), but don't
understand how to wire it. I've already got a string of diodes
connecting to the motors - any chance of a quick diagram? Can it be
the same diode as I've labelled for the drops?

+6V ---->|-->|-->|-->|---+
4 Diodes |
|
|
3.2V +-----+-------+-----+
| | | |
| | | |
| _-_ | _-_
- |___| - |___|
^ - ^ -
| | Motor | | Motor
| | | |
+-----+ +-----+
| |
| |
||-+ ||-+
||-> ||->
----||-+ -----||-+
N-Type | N-Type |
MOSFET | MOSFET |
| |
=== ===
GND GND
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

All inductors (not just motors) produce a "spike the wrong way."

When the battery is running low, and it's internal resistance is higher, the
motor will create more noise on the power supply rails. A low-dropout
regulator would better isolate the PIC from this than a simple dropper
diode; however, I'm 99% sure the diode will work - as long as your not
designing life support systems.

Dropper diodes are fine for the motor supply.

The 1N4148 is only rated for a maximum forward current of 300mA. Use the
1N4001.
 
Danny T wrote:
Danny T wrote:
snip

I don't understand the column headings given here:


http://www.rapidelectronics.co.uk/rkmain.asp?PAGEID=80010&CTL_CAT_CODE=30400&STK_PROD_CODE=M28648&XPAGENO=1

Anyone?

I need my PIC to drive 2x 3V motors... I've got two sets of motors -
one set are .45A, the other 1.07A (5240rpm and 13100rpm - I don't
know which will suit me best yet!)
VDS V = Maximum drain source voltage. They're all well above 3V so any will
do!

N chan / P chan = You want N channel.

RDS (on) = Equivalent resistance when FET is on. Ideally, as low as
possible. There will be a small voltage drop across the FET due to this
resistance. Knowing motor current, you can calculate what the voltage drop
will be using Ohm's Law.

ID cont = Maximum current. You need at least .45A or 1.07A depending on
which motor you choose.

PD = Maximum power dissipated by the MOSFET ( = V*I). You know the voltage
drop across the MOSFET, and the current. Multiply them together to
calculate the power.
 
Andrew Holme wrote:

I don't understand the column headings given here:

http://www.rapidelectronics.co.uk/rkmain.asp?PAGEID=80010&CTL_CAT_CODE=30400&STK_PROD_CODE=M28648&XPAGENO=1

VDS V = Maximum drain source voltage. They're all well above 3V so any will
do!

N chan / P chan = You want N channel.

RDS (on) = Equivalent resistance when FET is on. Ideally, as low as
possible. There will be a small voltage drop across the FET due to this
resistance. Knowing motor current, you can calculate what the voltage drop
will be using Ohm's Law.

ID cont = Maximum current. You need at least .45A or 1.07A depending on
which motor you choose.

PD = Maximum power dissipated by the MOSFET ( = V*I). You know the voltage
drop across the MOSFET, and the current. Multiply them together to
calculate the power.
You're a star! Thanks (again) Andrew :)

Gonna order the things I don't have from Rapid and no doubt I'll be
posting here in the week complaining! ;)
--
Danny
 
Andrew Holme wrote:
The 1N4001 is fine for 1.07A as long as you only run one motor at a time.
You should find something heftier, or use seperate dropper chains, if you
need to run two 1A motors at once. The .07 is negligible.
Of course, I should've realised that!

Motors will run together most of the time (when I get to it, it'll be a
little "robot" on 3 wheels, two driven, like a trike) except for
turning, so I'll just do two chains of diodes from the power :)


Resistors can go short circuit if you subject them to enough abuse, but they
tend to smoke and become discoloured in the process - which is a bit of a
giveaway.
LOL!!


I forgot to mention - on rapidelectronics - you want a MOSFET marked * for
"Logic level device with optimised design for 5V drive"
Yep, I figured that :)

Thanks!

--
Danny
 
Andrew Holme wrote:
Danny T wrote:
Hi all,

Following on from the "Calculating Resistors Required" thread, which
went off on a tanget (cos I'd no idea what I was doing!), could you
see if all looks ok with the following (inc. resistor values etc.).

I've posted the specs for motor/led/etc. I think might be useful at
the bottom.


[snip: good diagram]

1. As you said: the top of the 10k resistors should go to the PIC Vdd rail
and not to 6V.
2. You need a 100nF decoupling capacitor between Vdd and Vss mounted as
close to the PIC as possible. This smooths out noise and glitches on the
supply; it stops the PIC from crashing when you switch the motors on!
3. You can share power-supply dropper didoes between the motors, but use a
seperate diode for the PIC to reduce noise on the PIC supply rail.
4. You need back e.m.f. protection diodes across the motors. Inductors
(motor, relay ...) generate a large back e.m.f. when you switch them off.
This diode should be connected across the motor with the cathode pointing
upwards. The diode short-circuits the back e.m.f. to protect other
components.

Otherwise, that looks like it should fly!
5. You should also have a capacitor between each motor driver fet
source and the positive end of its motor, to act as a small local
supply, so those high frequency on-off edges don't get back to the
battery and then into the PIC.
A .1 uf film or ceramic in parallel with a few hundred microfarad
electrolytic might be enough. A 1 uf film or ceramic in parallel with
a 1000 uf electrolytic would be better.

My favorite kind of film capacitors for this service are the very low
inductance, stacked V series from Panasonic, sold by digikey:

http://rocky.digikey.com/WebLib/Panasonic/Web%20data/ECQV.pdf
--
John Popelish
 
Danny T wrote:
Danny T wrote:
snip

I don't understand the column headings given here:

http://www.rapidelectronics.co.uk/rkmain.asp?PAGEID=80010&CTL_CAT_CODE=30400&STK_PROD_CODE=M28648&XPAGENO=1

Anyone?

I need my PIC to drive 2x 3V motors... I've got two sets of motors - one
set are .45A, the other 1.07A (5240rpm and 13100rpm - I don't know which
will suit me best yet!)
Keep in mind that motors do not have to run at exactly the specified
voltage, but that the speed will be roughly proportional to the
voltage (torque held constant) and the torque will be roughly
proportional to the current (speed held constant). Picking the right
motor is a lot like picking the right gear in a car that matches the
motor (speed-torque and efficiency curves) to the driving conditions
(speed, climb, weight carried, wind, acceleration needed, etc.)

--
John Popelish
 
Danny T wrote:
Andrew Holme wrote:
That link doesn't work for me but I assume it's some sort of mains
power supply.

Nor me!


You need a REGULATED 6.0V supply. A wallwart may *not* be suitable
(excessive ripple, peak > 6V).

Yep, guessed this. I had to buy an unregulated 300mA supply for my pic
programmer (why, I don't know!), but this one has regulation figures,
so I assume it is. It is the one you found (85-1820), but before I
order my stuff, I'd like to ask you to check "Miles Harris" reply in
my "Calculating resistors required" thread :-\

Ta,

Danny
Miles is mistaken. The forward voltage drop of a silicon diode is
approximately 0.7V except at very very small currents.

I second the suggestion made by John P about adding decoupling & reservoir
capacitors for the motors. These should be connected between the 3.2V power
rail and ground, as close as possible to the motor +ve and FET source
terminals. These act like small downstream batteries, absorbing and
satisfying the transient (spikey) current demands of the motors, so the rest
of the circuit (upstream) sees fewer glitches. Circuit layout is critical
for these to be effective.
 
John Popelish wrote:

The source lead. The caps connect between the positive and negative
supply points for the motor and its driver transistor (as close as
possible to those points, too). When the drive transistor turns off
or on, suddenly, a wave of current would otherwise travel all the way
back to the battery, bouncing every circuit connected to it.
Sorry, I thought you meant both ends connected to the leads you
specified, but from reading Andrew Holme's post, I gathered that one end
connects to the join from the MOSFETs to the motors, and the other end
to ground - is this correct?

I don't quite understand the need for two *different* capacitors - why
would one not do?

Thanks,

--
Danny
 
Danny T wrote:
John Popelish wrote:
[snip]
Sorry, I thought you meant both ends connected to the leads you
specified, but from reading Andrew Holme's post, I gathered that one
end connects to the join from the MOSFETs to the motors, and the
other end to ground - is this correct?
I think you have that wrong. Here's a diagram:



+6V ---->|-->|-->|-->|---+
4 Diodes |
|
+--------+------+
3.2V +-----+-------+-----+ | | +
| | | | --- ---
| | | | C1--- C2---
| _-_ | _-_ | |
- |___| - |___| | |
^ - ^ - === ===
| | | | GND GND
| | | |
+-----+ +-----+
| |
| |
||-+ ||-+
||-> ||->
----||-+ -----||-+
N-Type | N-Type |
MOSFET | MOSFET |
| |
=== ===
GND GND


C1 and C2 are the two capacitors.

I don't quite understand the need for two *different* capacitors - why
would one not do?
The big capacitor (say 100uF - 1000uF) acts as a reservoir, but does not
respond so well to fast transients. The smaller capacitor (say 100n) takes
care of higher frequencies. One capacitor (perhaps 1uF) would help
somewhat. Two are "belt and braces."
 
Andrew Holme wrote:

I think you have that wrong. Here's a diagram:
Sorry, was thrown by this:

The caps connect between the positive and negative
supply points for the motor and its driver transistor (as close as
possible to those points, too)
I assumed he meant the MOSFET?


+6V ---->|-->|-->|-->|---+
4 Diodes |
|
+--------+------+
3.2V +-----+-------+-----+ | | +
| | | | --- ---
| | | | C1--- C2---
| _-_ | _-_ | |
- |___| - |___| | |
^ - ^ - === ===
| | | | GND GND
| | | |
+-----+ +-----+
| |
| |
||-+ ||-+
||-> ||-
----||-+ -----||-+
N-Type | N-Type |
MOSFET | MOSFET |
| |
=== ===
GND GND


C1 and C2 are the two capacitors.


I don't quite understand the need for two *different* capacitors - why
would one not do?

The big capacitor (say 100uF - 1000uF) acts as a reservoir, but does not
respond so well to fast transients. The smaller capacitor (say 100n) takes
care of higher frequencies. One capacitor (perhaps 1uF) would help
somewhat. Two are "belt and braces."
Right, I understand - but wasn't this what the back emf diode was for,
to stop these spikes going anywhere? :-\

--
Danny
 
John Popelish wrote:

Sorry, I thought you meant both ends connected to the leads you
specified, but from reading Andrew Holme's post, I gathered that one end
connects to the join from the MOSFETs to the motors, and the other end
to ground - is this correct?

No. The positive end of the electrolytic and one end of the film cap
connects to the positive lead of the motor. The negative end of the
electrolytic and the other end of the film capacitor connect ot the
source lead (grounded lead) of the mosfet driving the motor. This
acts as a small, 3 volt battery as close as possible to the motor.
I see. I understand your original post now, I was looking at the wrong
side of the MOSFET - of course, the other side was ground! :)


I don't quite understand the need for two *different* capacitors - why
would one not do?

The electrolytic is good at dumping a big current for a long time, but
it has the aluminum wound up inside it, so that there is a bit of
inductance in series with the capacitance that doesn't allow it to
have this current change in an instant. The smaller, low inductance
capacitor supplies the current during this brief time.
I understood (Andrew beat you to it ;)). Incidently.. What exactly does
the capacitor do with all this current it builds up?!


Since you have two motors and two motor drivers, there should probably
be a set o capacitors for each (especially if you use a separate
voltage regulator for each motor), unless the two mosfets are right
together and the positive leads to the motor are also very connected
directly together.
I'm not sure I understand. As you can see from my diagram, they're
"near", but not connected, since I need seperate switching and supplies
for my motor (seperate supplies are just because I'm using 1A diodes,
and the motors can pull 1.07A - if I stick to the smaller motors, I
could probably share them)

--
Danny
 
Danny T wrote:

Right, I understand - but wasn't this what the back emf diode was for,
to stop these spikes going anywhere? :-\
No. The caps keep the supply voltage from bouncing around when there
is a big load current change when the motor turns off or on very
suddenly.

Remember that trampoline visualization I told you about? The height
above ground represents the voltage the battery supplies to each
load. If you place a big lead ring around the spot where the fat kid
jumps, it isolates his impact from other things resting on the
trampoline. Place another lead ring around the reader (the small
capacitor across the supply pins of the PIC) and you isolate the
vibration a bit more, and if the reader shifts his weight, it keeps
that disturbance local, also.

The diodes across the motors keep the drain lead of the mosfets (not a
power supply connection) from seeing a big positive voltage each time
the mosfet turns the motor current off. This is a purely an effect of
the motor storing energy in its magnetic field and that energy has to
go somewhere when the magnetic field collapses as the current goes to
zero. This big spike can damage the mosfet, and couples noise
capacitively, to any conductors nearby. The diodes suppress the
action that makes an ignition coil produce such great sparks.

If the mosfets drove resistors instead of something inductive, there
would still be the power supply bounce, but no extra voltage spike on
the drain at turn off.

--
John Popelish
 
Danny T wrote:
Andrew Holme wrote:

I think you have that wrong. Here's a diagram:

Sorry, was thrown by this:

The caps connect between the positive and negative
supply points for the motor and its driver transistor (as close as
possible to those points, too)

I assumed he meant the MOSFET?


+6V ---->|-->|-->|-->|---+
4 Diodes |
|
+--------+------+
3.2V +-----+-------+-----+ | | +
| | | | --- ---
| | | | C1--- C2---
| _-_ | _-_ | |
- |___| - |___| | |
^ - ^ - === ===
| | | | GND GND
| | | |
+-----+ +-----+
| |
| |
||-+ ||-+
||-> ||-
----||-+ -----||-+
N-Type | N-Type |
MOSFET | MOSFET |
| |
=== ===
GND GND


C1 and C2 are the two capacitors.


I don't quite understand the need for two *different* capacitors -
why would one not do?

The big capacitor (say 100uF - 1000uF) acts as a reservoir, but does
not respond so well to fast transients. The smaller capacitor (say
100n) takes care of higher frequencies. One capacitor (perhaps 1uF)
would help somewhat. Two are "belt and braces."

Right, I understand - but wasn't this what the back emf diode was for,
to stop these spikes going anywhere? :-\
Well, that's interesting. Back emf occurs the instant you interrupt the
motor current. I was going to say motors also generate noise while they're
running - which they do; but then I asked myself: what causes this "running"
noise? Is it commutation? What's the difference between commutation and
interruption? Will the back emf diode also suppress commutation noise?
Possibly, but I'm sure a decoupling and/or reservoir capacitor would further
improve matters.
 
Danny T wrote:
John Popelish wrote:

The electrolytic is good at dumping a big current for a long time, but
it has the aluminum wound up inside it, so that there is a bit of
inductance in series with the capacitance that doesn't allow it to
have this current change in an instant. The smaller, low inductance
capacitor supplies the current during this brief time.

I understood (Andrew beat you to it ;)). Incidently.. What exactly does
the capacitor do with all this current it builds up?!
Capacitors store charge. When anything tries to change the voltage
across a capacitor, it responds by moving charge (current) to resist
the change.

When the motor first is switched on, the voltage between the mosfet
source and positive side of the motor tends to collapse toward zero as
the current needed to support this voltage with this new current
ripples toward the battery. The capacitors just give this current
someplace closer to come from. If current changes quickly along the
battery supply path, the inductance of that path produces large
voltage swings. If those current changes can be slowed, That wiring
inductance produces much less voltage swing.

Since you have two motors and two motor drivers, there should probably
be a set o capacitors for each (especially if you use a separate
voltage regulator for each motor), unless the two mosfets are right
together and the positive leads to the motor are also very connected
directly together.

I'm not sure I understand. As you can see from my diagram, they're
"near", but not connected, since I need seperate switching and supplies
for my motor (seperate supplies are just because I'm using 1A diodes,
and the motors can pull 1.07A - if I stick to the smaller motors, I
could probably share them)
If there are separate voltage supplies for the two motors, then the
only way to have a capacitor connected directly from motor positive to
mosfet source is to have two sets of them. If there is a single
supply that branches out to feed two motors, it still wouldn't hurt to
have a capacitor set for each motor. That way, it is not nearly so
important how close the two mosfet sources are connected, or if the
two motor positives are tied at the same spot.

This sort of insurance is often the difference between a
microprocessor that just works and one that has all kinds of fits.

--
John Popelish
 
John Popelish wrote:

If there are separate voltage supplies for the two motors, then the
only way to have a capacitor connected directly from motor positive to
mosfet source is to have two sets of them. If there is a single
supply that branches out to feed two motors, it still wouldn't hurt to
have a capacitor set for each motor. That way, it is not nearly so
important how close the two mosfet sources are connected, or if the
two motor positives are tied at the same spot.

This sort of insurance is often the difference between a
microprocessor that just works and one that has all kinds of fits.
Cheers. I'll have to copy these threads into a folder somewhere, lots of
useful info! Thanks :eek:)

--
Danny
 
Danny T wrote:
Danny T wrote:
snip

Yet more questions.. ;P

This comes from a book - "INSECTRONICS - Build Your Own Walking Robot"
by Karl Williams. I've no plan on walking robots, but it has IR
sensors
and stuff in it, so it's a good read. Anyway, one of the circuits
looks like this:

http://dantup.me.uk/tmp/circuit.jpg

I noticed a few things...

1. MCLR is tied to Vdd with a 4.7K resistor. I had them connected
directly. Since MCLR probably doesn't draw much current, I don't
understand what the resistor would do... Anyone?
This is an obsolete practice. Pull-ups were required for the original 7400
series TTL logic family back in the 1970s but they're not necessary with
modern CMOS. You can tie CMOS inputs directly to Vdd.

2. RB1 and RB2 have a 1K resistor, then what looks like two diodes. If
these are unused, are the diodes needed? If they're supposed to be
LEDs, 1K seems high - I calculated my two sets of LEDs as needing
120Ohms
and 160Ohms?
The (small) double arrows at 45 degrees identify them as LEDs. They will
glow dimmly with 1k. Perhaps the designer was trying to save power?

3. The speaker ties to the same "ground" as the main +5V supply, but
it seems to have its own +9V supply. Surely each should return to
it's own power source?!
The grounds are connected; note the earth symbols:

|
|
-------
-----
---
-

4. RA2 has a jumped, and gets tied to +5V or ground, via a 1k
resistor. I've been using 10k - how important is this value?
The value is not critical; 100 ohms or 100k would also work.

The resistor would be un-necessary for a CMOS input, but is a wise
precaution in case the software ever programs the I/O port as an output.
The same is not, apparently, done on JP7; is this an output?
 
Robert Monsen wrote:

I just removed the 4.7K resistor on my breadboard, and it still works
the same. I'll ignore this in future :)

I just looked at the datasheet for the 16F676, and it specifies a
resistor of at least 1k, along with an optional cap of 0.1uF to ground.
This is on pg 58 of the 16F630/16F676 datasheet.
I'm currently using 16F627 and 12F629. What section of the datasheet was
it under, so I can check what these say?


4. RA2 has a jumped, and gets tied to +5V or ground, via a 1k
resistor. I've been using 10k - how important is this value?

The value is not critical; 100 ohms or 100k would also work.

Actually, many microchip parts have internal "weak pullup resistors",
which can be turned on and of individually for port pins. They are 10k.
Look at the datasheet for your part.
I noticed these, but didn't full understand them. If these are turned
on, is it safe to remove the resistors and connect directly to 5V/Ground?
--
Danny
 

Welcome to EDABoard.com

Sponsor

Back
Top