PDA

View Full Version : destroying my last pic? driving a miniature motor



Michael Wakileh
- 5th August 2007, 12:53
Hi everyone,
Please help me if you can....I don't want to destroy my last pic....

I'll get right on topic:
I had partial success driving a 4mm motor directly from the 4 pwms of my 16f690. I was using pulse steering to output hpwm signal on 4 pins. Testing this, I realized that this would not allow me enough current on the motor i am using.

Here's what I did initially:
I chose 250 ohm resistors for each pwm output because 5v/250ohm is 20 mA the max a pic can source or sink. After the resistor these lines converged going to the positive terminal of the motor. Because I gave moter 4 pwm signals, the resistance to 5v(supplied by PWM) was actually 250/4=62.5ohm.
My motor has 9.6ohm internal resistance
62.5ohm divider: 9.6/9.6+62.5ohm x 5V==>motor was only getting .666v….
Current through the motor 5v/72.1ohm = 69.3mA
This was not enough to get it spinning nicely...


Here's where I destroyed 2 pics:
I quickly tried hooking up one of the 4 pwm signals through a 2n2222 to
boost the current. Although i thought i had enough protection using diodes when I ran the program, not much happened... Also some sensors on i2c and power lines didn't blink as they normally do at startup. Only removing the pic 16f690 got those sensors blinking again. After adding some more diodes, safer resistor values I tried again with another pic....Same result... Unfortunately I can not reproduce the exact schematics as it was 5am and I was tired a little impatient and yes...drinking...;)
I think I may have left the other pwm pins floating, or possibly switched the collector and emitter. All I know is that I didn't even get to see smoke...


Can anyone advise me on a lowest partnumber/smallest parts solution that would do the beforementioned. HERE IS WHAT I HAVE IN MIND...

Darrel Taylor
- 5th August 2007, 13:45
That diagram's a little hard to follow.
Does this look like what you were thinking of?

<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1913&stc=1&d=1186317831">

Hope not. :o
<br>

Darrel Taylor
- 5th August 2007, 16:13
With a 2N2222A, here's what I think would work.

<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1915&stc=1&d=1186326546">

If you don't have a good, solid, well filtered power supply, the PIC will have problems. Resetting, or just doing weird stuff.

And the motor's proximity to the circuit, may have the same effect.
<br>

Michael Wakileh
- 6th August 2007, 18:08
Thanks Darrell... you always come to the rescue.... I will try this out tomorrow. You redrew my schematic nicely, but I did have the emitter going to ground (btw, which program do you use?)... Is there a difference in connecting the load between emitter and ground, or between collector and vdd (besides resistance increasing base to ground when the load is on the emitter side)? For power I try to stay mobile. Here I used just a 9V battery, 7805, 100nFcap, and an electrolytic cap.... Eventually I will be using 4 or 5 of these motors and probably a seperate power supply...

mikendee
- 6th August 2007, 21:19
Have you had a look at the MicroChip app note AN 893 . Hopefully it might be of some help.

This should be the link to it.
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en012134

Darrel Taylor
- 8th August 2007, 01:50
Is there a difference in connecting the load between emitter and ground, or between collector and vdd (besides resistance increasing base to ground when the load is on the emitter side)?

With transitors, the current you get out is dependant on the current from the base to emitter. If the voltage on the emitter changes, then the base to emitter current will be reduced. So if the load is between the emitter and power, ... as the transistor starts to conduct, the emitter voltage changes and counteracts the base current that's trying to turn it on. While it seems to kinda sorta work a little bit, you always end up with a lower current output.

So basically, you want the emitter to be at a constant voltage, either GND or V+.

But the difference is ... if you want to "source" current to the load from V+ (like in the first schem.) you would use a PNP transistor. Then output HIGH from the PIC is OFF, and LOW is ON.

And as I read this back, it doesn't even make sense to me. (I'm a software guy). :o

Alain!!! Help!!!! Anybody!!!

Archangel
- 8th August 2007, 06:50
Thanks Darrel,
I have seen it in print that the transistors should go one way but not the other, but never an explanation as to why.
Thanks!

rhino
- 8th August 2007, 14:31
...You redrew my schematic nicely

Darrel.... what do you use for schematic drawings?

Acetronics2
- 8th August 2007, 14:52
And as I read this back, it doesn't even make sense to me. (I'm a software guy). :o

Alain!!! Help!!!! Anybody!!!

Hi, Darrel

For simplicity :

1) Motor ( or load ) has one terminal connected to GROUND

- use a PNP Transistor w/Emitter to POwer ( or P- Mosfet W/ Source to Power ). the "ON" state will be with a LOW state from the PIC.

2) Motor has one terminal Connected to POWER

- use a NPN Transistor W/Emitter to GRound ( or N Mosfet w/ Source to GRound ). the "ON" state will be with a HIGH state from the Pic.


That's all !!!

Alain

Darrel Taylor
- 8th August 2007, 14:56
Darrel.... what do you use for schematic drawings?
I guess I forgot to answer that part.
Or maybe I was unconsciously avoiding it, since the program I use is a constant source of mental anguish.

I use IVEX WinDraft/WinBoard.

Ivex went out of business a couple years ago, and now there's no one to fix all the bug's.
Which is probably why they went out of business in the first place. (there's a lot of bug's).

And when the company closed, so did it's online Auto-Router server.
So now everything has to be routed manually. And of course that's hard to do because of the Bug's.

The last board I did, ... 18F6720, 10 other chips, 101 resistors,35 capacitors, etc. took almost 2 months to route manually.

I've got to find another program. And PCB123 just doesn't do it for me. :o
<br>

mackrackit
- 8th August 2007, 15:09
Have you tried this?
http://www.expresspcb.com/
I can not complain about the service (fast board turn around) and the free program is easy to use.

Acetronics2
- 8th August 2007, 15:26
I've got to find another program. And PCB123 just doesn't do it for me. :o
<br>

Hi, Darrel

Did you had a look to the Ulticap/board/Route SUITE ???

http://www.ewbeurope.com/fr/u_board.html

a bit expensive, but works fine ... really fine !!!


Alain

Darrel Taylor
- 8th August 2007, 15:51
Have you tried this?
http://www.expresspcb.com/

I have.
But just like PCB123 it's geared towards bringing business to that specific PCB manufacturer. So you can't take those files to another board house (that's probably cheaper). And if I'm designing a board for a customer, I can't lock them into 1 specific vendor. They want the gerber files and NC files so they can have them made wherever "They" choose.


Did you had a look to the Ulticap/board/Route SUITE ???

http://www.ewbeurope.com/fr/u_board.html

No, I've never seen that one. The screenshots look nice, but I don't understand a word they're saying. :o

I'm thinking of looking at PADS or something.
One that'll be the last program I have to learn, and will still be around in 15 years.
<br>

Acetronics2
- 8th August 2007, 16:28
I have.

No, I've never seen that one. The screenshots look nice, but I don't understand a word they're saying. :o

I'm thinking of looking at PAD's or something.
One that'll be the last program I have to learn, and will still be around in 15 years.
<br>

Hi,

I didn't understand exactly what was going on with their site ... in English, it's redirected to National's site ... but no more Ulticap ( Scheme drawing ) just Ultiboard and Ultiroute !!!

For price, I saw ~ 2500 Euros for the 1400 pins limited version.

I think the best to see is to ask for the free demo CD ...

For personnal use, I could send you a copy of the "elder" 5.5 v CD ( dating 1998 ? ) ... but some little bugs ( easily avoidable !!! ) are still existing.
It's legal ... cause the Ultimate Technology Society ( original creator) no more exists nor supports this version ... which was NOT Copy-protected !!! ( hahaha !!!!)

Personnally, I use the 5.71/72 Unlimited Student version ... that need a DONGLE.
If you want samples ... just ask : Malc C train Controller for Example !!!

The look is very close to today's versions (9.x or 10.x ). just the 3D show didn't exist.

Alain

Michael Wakileh
- 16th August 2007, 22:47
I finally got around to actually testing the above circuit and it works perfectly! I used a seperate power supply for the motor, because my program slows down when everything runs off of my old battery. I got the impression that my communication routines take much longer when the motor is on, and I suspect this is due to undervoltage (I will post results with a new battery). Anyway I just wanted to finally thank you all for the great help and links, especially Darrel for his great transistor explanation...

While searching for schematics and layout programs I did stumbled upon eagle (http://www.cadsoft.de/). I've started using the free version which is limited to 4 x 3.2 inches, two signal layers, and one sheet for the schematics.... Doesn't seem that hard to learn because there's lots of good tutorials out there (for example on programming new parts etc) and there's a lot of downloadable parts libraries. It can output in a lot of formats (some for 3rd party board production, some vector formats for home etching, and also there's a ULP addon for producing G-code directly), but it doesn't do any simulation. I prefered the graphics of the schematic layout on IVEX Windraft (color contrast makes it easier to follow and nicer for web publishing..) and I'm not sure if there's a lot of eagle users in the US, but if you're looking for a solid program that will probably be around for quite some time you could give it a shot...

Michael Wakileh
- 16th August 2007, 22:52
Also there seems to be a library for 3d show...
http://www.matwei.de/doku.php?id=en:eagle3d:eagle3d

Sean_Goddard
- 21st August 2007, 13:10
http://www.cadsoftusa.com/

Try that!!!

D'OH!! Just seen above =/

OK this>> http://www.expresspcb.com/ExpressPCBHtm/Download.htm

RussMartin
- 28th August 2007, 07:52
I guess I forgot to answer that part.
Or maybe I was unconsciously avoiding it, since the program I use is a constant source of mental anguish.

I use IVEX WinDraft/WinBoard.

Ivex went out of business a couple years ago, and now there's no one to fix all the bug's.
Which is probably why they went out of business in the first place. (there's a lot of bug's).

And when the company closed, so did it's online Auto-Router server.
So now everything has to be routed manually. And of course that's hard to do because of the Bug's.

The last board I did, ... 18F6720, 10 other chips, 101 resistors,35 capacitors, etc. took almost 2 months to route manually.

I've got to find another program. And PCB123 just doesn't do it for me. :o
<br>

I use IVEX WinDraft and WinBoard--and PentaLogix ViewMasterEZ for post-editing the Gerbers. Never much anguish, mental or otherwise. My last upgrade was to 3.12 on WinDraft and 2.26 on WinBoard.

I rarely have problems with WinDraft/WinBoard. Which bugs are "bugging" you? The only chronic, serious difficulty I've encountered is laying in copper zones (such as ground or power planes) with WinBoard, but I started doing that with ViewMasterEZ.

On routing, I don't know what to say--I learned PCB layout before CAD, when it was done on a drafting table!--so I find "manual" routing with WinBoard is a breeze (I never used their auto-routing service). As you've probably already discovered, the first secret of easy routing is starting with the right component layout--and that's more nearly art than science!

But if I can help you (or anyone) out with WinDraft and/or WinBoard problems, let me know. Fundamentally, they are good, powerful products and, since the company is gone, now very accessible.

IVEX was around for over a decade (that's a long time for a small company in a technology field) and did not fail because of a "buggy" product. While in business, they constantly improved and updated their offerings and were even distributed by NTE. They were, I believe, "caught in the middle" between the low end, inexpensive (or free) manufacturer-specific products (PCB123 is an example) and the high end (ORCAD). The founder decided to shut down and move on. I don't agree with how he did it, but I understand the why. And there are still a lot of IVEX users out here.

Darrel Taylor
- 28th August 2007, 08:40
That would be great if you could tell me how to keep it from corrupting the file when it gets big.

Once it goes over about 500 pins or so, things start going haywire. (I have an 850pin license).

I'll be working away and suddenly after moving something, the rats nest goes crazy.
Yellow lines between things that shouldn't even be connected together. When you hit F2 over a trace, it shows it's not assigned to any nets anymore, it's just blank.

If I don't have the rats nest turned on when it happens, it may go unnoticed and get saved that way. Then I'm really cork-screwed. I have to search thru the auto-saved files hoping it hasn't gone too long, or it gets over-written. When that happens I start searching through the dozens of saved files I have, since I have to save after every successful placement, if not I lose hours at a time worth of work.

It's a serious PITA.
<br>

RussMartin
- 28th August 2007, 09:18
See my private message.

RussMartin
- 28th August 2007, 09:38
Well, the first things I would need to know: Are you talking about WinDraft (for schematics) or WinBoard (for board layout)? And which version of either?

Generally speaking, when you start crowding your pin limit (yes, 500 is crowding an 850 limit) with WinBoard, things can sometimes get a little flaky.

One reason I may have fewer problems is that I'm an old guy and have never completely trusted personal computers. So whenever I'm doing something that creates a file, I automatically hit CTRL + S anytime I make a significant change. (I started doing this over 25 years ago, I think with WordStar on a CPM system--it was a Kaypro. It's still a habit.)

Another reason I likely have fewer problems is that I run all of my IVEX stuff on a separate computer that does nothing else but schematic and board work--it's a cheap old clunker (Compaq Presario 1700), but it does the job just fine, since I don't use it for word processing and Internet and E-mail and who knows what else. All the programming duties on the bench are handled by another even older clunker (Compaq Armada 1700).

You may have noticed with WinBoard that, anytime you move something, it recalculates.

The simplest recovery (if you've saved the file regularly) is to close the file, re-open it, and simply re-import the netlist.