Circuit & Component Check

Yep. Either will do for now, but until I put wheels on carpet, I won't know if the weedy one has enough power to move it. Got some cogs (a worm thing?), so I don't imagine it'll be a problem - can sacrifice speed for mobavility !

--
Danny
Reply to
Danny T
Loading thread data ...

Which leg of the MOSFET should it connect to? Not sure I understand its purpose :-\

--
Danny
Reply to
Danny T

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.

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
Reply to
John Popelish

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.

Reply to
Andrew Holme

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
Reply to
Danny T
[snip]

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.

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."

Reply to
Andrew Holme

Sorry, was thrown by this:

I assumed he meant the MOSFET?

Right, I understand - but wasn't this what the back emf diode was for, to stop these spikes going anywhere? :-\

--
Danny
Reply to
Danny T

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 understood (Andrew beat you to it ;)). Incidently.. What exactly does the capacitor do with all this current it builds up?!

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
Reply to
Danny T

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.

Reply to
Andrew Holme

Right, got that. Thanks! :o)

--
Danny
Reply to
Danny T

Cheers. I'll have to copy these threads into a folder somewhere, lots of useful info! Thanks :o)

--
Danny
Reply to
Danny T

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:

formatting link

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?

  1. 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?

  2. 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?!

  1. 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?

Sorry for asking silly questions, but I find it's the best way to learn! :o)

--
Danny
Reply to
Danny T

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.

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?

The grounds are connected; note the earth symbols:

| |

------- ----- --- -

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?

Reply to
Andrew Holme

Good news (for me!)... I just got my first breadboard circuit working! I think my problems had all been down to MCLR! I just created the circuit you've been helping with here, but without the motors (and without the Vdd->Vss cap, since I don't have them yet!). It just flashes two sets of LEDs on and off, and has the unused pins (and inputs I don't yet have switches for) tied to ground with resistors.

W00t! That's the hard part - now I can get programming world peace instead of just LEDs! =)

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

I thought they where LEDs, but thought I'd cover all bases ;) Ironically, the lowest resistor I have here is 1K, so I've had to use them for my test, and the LEDs glow fine - I guess there's no point giving them more power if they don't need to be brighter :-) (or maybe he was using his dads old resistor box too!)

I see. Is there any advantage to connecting all the ground together from different sources to just having them totally seperate? Is it just to make wiring easier, since any ground will do? Would this cause any extra noise from things like motors?

Ok, so what *exactly* is the resistor doing? What does it do when it's given say 0, 3, 5, 7 volts?

I see. Does the same hold for my circuit? I've got +5V, connected to a resistor, then to both the input pin and a switch. If I *know* my chip is an input (eg., I've tested it *with* the resistor), is it safe to remove?

Don't know, it's not explained, and the assembly's pretty long... I'll just ignore this for now :-)

--
Danny
Reply to
Danny T

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.

Also, note that MCLR can be used to avoid problems when the voltage comes up too slowly. Microchip sells a part specifically for this (the MCP100 series, if memory serves) that will keep MCLR low until the voltage comes up enough for the system to run. You can also build a circuit like this fairly easily, or just ignore it and tie it to Vdd if you aren't worried about it. However, MCLR problems seem to be endemic to the microchip product line for some reason.

Ground is the common reference point in your circuit. Without it, you can't connect up the parts of your circuit. This is because voltage is not an absolute measure, it's a relative measure. Thus, when you signal from one part of your circuit to another part using voltage you must reference that voltage signal to something. That something is ground.

Note, however, that ground isn't always the same. Wires have a little resistance and inductance, and so the more current that flows over them, and the more it changes abruptly (as in motors), the more voltage will be across them. Consequently, grounds that have lots of current can be different than grounds that have only a little current. Just something to keep in mind.

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 was just bitten by this, in that I forgot about the internal pullups, and wondered why my 100k resistor wasn't pulling the input to ground. Turning off the pullups fixed the problem.

The initial value for parts from reset is to be an input, I believe. Unless you explicitly change this, they will never be an output. However, you are not taking into account possible software errors that may creep in at a later date. Prudence suggests that you provide for this possibility by using a resistor.

--
Regards,
   Robert Monsen

"Your Highness, I have no need of this hypothesis."
     - Pierre Laplace (1749-1827), to Napoleon,
        on why his works on celestial mechanics make no mention of God.
Reply to
Robert Monsen

I'm currently using 16F627 and 12F629. What section of the datasheet was it under, so I can check what these say?

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
Reply to
Danny T

It's under 'special features of the CPU', where it talks about MCLR

I don't think so. Connecting it to 5V would just bypass the resistor. Connecting it to ground would just waste 0.5mA to no purpose.

The pullups work just like an external 10k resistance to Vdd. The point is that you can set ports up as inputs without worrying about the CMOS 'floating input' problem, which causes a big current drain when a CMOS input sits 1/2 way between ground and Vdd.

As far as your circuit goes, if you use these pullups, you don't have to connect the port to anything, it will automatically read as high when you look at it, and won't consume inordinate amounts of power.

You can also use this to your advantage with pushbuttons, for example. Use a normally open pushbutton, set the port to use the internal weak pullups, and connect the other side to ground. Then, if you push the button, the port will read 0, otherwise, it'll read high.

If you aren't using the port, however, you can just set it to be an output using the TRIS register, and then safely leave it unconnected.

--
Regards,
   Robert Monsen

"Your Highness, I have no need of this hypothesis."
     - Pierre Laplace (1749-1827), to Napoleon,
        on why his works on celestial mechanics make no mention of God.
Reply to
Robert Monsen

Actually, maybe you can explain the way that NPN 2N3904 transistor is connected? It looks odd to me that the emitter is not tied to ground, but the collector is. I am not sure I see what it is supposed to do in this circuit.

Dominic

Reply to
Dominic-Luc Webb

Maybe you mean RB0 and RB1.... if the supply is 5 volts and these are typical 5 mm 2.0 volt and 0.03 amp LEDs, then a typo would make more sense. This would work out to exactly 100 Ohm, just obeying Ohm's law.

I'll wait and see if anyone suggests an explanation for that transistor. It would more more sense to me if the collector and emitter were in reverse order. In that case, it would look like the basic textbook example with 9 VDC to one speaker wire and the other speaker wire going to collector and then the emitter goes to ground, as usual.

Surely someone with more experience sees something I do not.

Dominic

Reply to
Dominic-Luc Webb

Yes, the emitter and collector are the wrong way round: the collector should go to the piezo, and the emitter should go to ground - as you said.

Also, the base resistor (R5) is unnecessarily small. If we take an excessively high estimate of 200mA for piezo current, divide by a low estimate of 50 for gain (beta), we still need only 4ma of base current to saturate the transistor. The base resistor should be (5-0.7)/4 = 1k.

Reply to
Andrew Holme

ElectronDepot 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.