Topics Topics Edit Profile Profile Help/Instructions Help Member List Member List  
Search Last 1|3|7 Days Search Search Tree View Tree View  

Are PICS and brush motors compatible

:: EPE Chat Zone ≠:: ≠Radio Bygones Message Board :: » EPE Forum Archives 2005-2006 » Archive through 20 August, 2006 » Are PICS and brush motors compatible « Previous Next »

  Thread Last Poster Posts Pages Last Post
Electronics stores Cape Town??Noel14/08/06  05:52 pm
  ClosedClosed: New threads not accepted on this page        

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Pat
Regular Contributor
Username: Pat

Post Number: 49
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 07 August, 2006 - 02:00 pm:   Edit Post Delete Post Print Post

My granddaughter wanted an automatic garage door like mine for her dolls house so I used a Meccano setup using a small 6v geared brush motor controlled by a PIC.
1. Pressing S1 rotates the motor and when door fully open microswitch MS2 stops it.
2. Pressing S1 counter rotates the motor and when door fully closed microswith MS1 stops it.
3. Pressing S1 whilst opening stops the motor. Re-pressing S1 restarts the motor.
4. Pressing S1 whilst closing stops the motor, pauses for 3 seconds, then re-opens the door.

The door works as programmed but intermittently (no set pattern to it!) refuses to stop when S1 is pressed as the door is opening and when closing decides to reverse immediately instead of pausing. MS1 and MS2 always appear to work as programmed.

I have come to the conclusion that the brush motor is to blame because if I move the PIC further than a metre from the motor it stops misbehaving. Also I believe the hash from the motor is not airborne but is transmitted through the wires because if I introduce a 4" long spring in both battery leads (acting as a choke) there is a definite improvement. Is there a recognised way of combatting brush motor hash? Do some stepper motors have brushes?
Any help in this matter would be much appreciated!
Kind regards,
Pat
Top of pagePrevious messageNext messageBottom of page Link to this message

Arw
Board Administrator
Username: Arw

Post Number: 294
Registered: 04-2005


Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 07 August, 2006 - 02:16 pm:   Edit Post Delete Post Print Post

Have you suppressed the motor, e.g. 0.1µF ceramic capacitor across the motor terminals. The spikes might be causing false triggering.
Top of pagePrevious messageNext messageBottom of page Link to this message

Grab
Frequent Contributor
Username: Grab

Post Number: 236
Registered: 05-2005


Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 07 August, 2006 - 02:21 pm:   Edit Post Delete Post Print Post

Yes, stepper motors have brushes too.

The most likely cause is that the motor is pulling down the power supply temporarily as it starts up, although it's possible that it's adding spikes as well. Either is bad news. Longer wires to the PIC would essentially be adding extra resistance/inductance in the supply line, which would filter that noise out.

If you put a diode in the power line to the PIC (and any other electronics) and a reasonable size capacitor after the diode (10uF would be fine, or whatever you have in your bits box) then a temporary drop-out on the supply will leave the PIC operating off the capacitor until the power supply recovers.

The capacitor will help filter out spikes as well, but not brilliantly. To get rid of spikes, you'll need a voltage regulator. The 7805 is the standard 5V regulator, but you might find it's not too keen on running off 6V. A low dropout regulator would be better - can't remember the best one to use, but a quick look in the Rapid Electronics catalogue should find you one. Sling this in between the diode/capacitor and the PIC, and you're sorted.

Graham.

(Message edited by grab on 07 August, 2006)
Top of pagePrevious messageNext messageBottom of page Link to this message

Pat
Regular Contributor
Username: Pat

Post Number: 50
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 07 August, 2006 - 03:41 pm:   Edit Post Delete Post Print Post

Thankyou ARW, the motor did already have a .22uf
cap across the terminals.

Grab, I did protect the PIC from motor spikes by using a small 1A power diode 1N4000 which also conveniently reduced the PIC voltage by 0.7v and also allowed placement of a 0.1 uf cap plus a 100uf/16v electrolytic for extra smoothing. I cannot help feeling that the best method is use of a choke but at such low voltage calculation of a specific value is not exactly scientific keeping in mind the introduced resistance. It just occurred to me that there must be several readers who perhaps dabble in robotic motors which must be similarly afflicted but as a "matter of course" employ a generic ???? to combat the interfernence to the microcontroller.
Meanwhile I will try the voltage regulator idea. Thankyou for the suggestion.
Regards,
Pat
Top of pagePrevious messageNext messageBottom of page Link to this message

Pat
Frequent Contributor
Username: Pat

Post Number: 51
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 07 August, 2006 - 04:17 pm:   Edit Post Delete Post Print Post

Perhaps I should mention that I use 2 6v relays between the PIC and the motor. The relays are close to the motor whilst the PIC is some 12" from both. Originally they were all in one box and interference happened continuosly whereas now it is about 60% of the time.
Pat
Top of pagePrevious messageNext messageBottom of page Link to this message

Violin_m
Frequent Contributor
Username: Violin_m

Post Number: 82
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 07 August, 2006 - 06:14 pm:   Edit Post Delete Post Print Post

Hi. I have always used transistors or optocouplers for switching. Without any problems. Knowing the problems relays can cause when switching Violin.

(Message edited by violin_m on 07 August, 2006)
Top of pagePrevious messageNext messageBottom of page Link to this message

Dave_g
Frequent Contributor
Username: Dave_g

Post Number: 157
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 07 August, 2006 - 06:52 pm:   Edit Post Delete Post Print Post

Pat - have you disconnected the motor and just tried it with the relays?

Additional thought, what PSU are you using? It might be that the source impedance of the supply is causing a "brown out" and the PIC occasionally resets. On a similar note, it could simply be that the inductor in series with the motor is the way to go. Have you dealt with the back EMF problem of the motors and the relays?

Excuse me thinking aloud (!) but if the relays are close to the motor, then presumably the transistors that drive the relays are close to the PIC. You therefore have long leads before the greatest load, are the relays closing properly and on time? Martin is right, I would tend to drive the motor directly, with the transistors preferably near the motor.

The whole thing smells of power regulation, and Graham is spot on with using a 7805, which are simple and brilliant at reducing noise & spikes. This and your existing smoothing/filtering capacitors should see it resolved.
Top of pagePrevious messageNext messageBottom of page Link to this message

Terry
Frequent Contributor
Username: Terry

Post Number: 218
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 07 August, 2006 - 07:07 pm:   Edit Post Delete Post Print Post

Try adding a low ohm resistor to one of the motor leads, it will help kill the spikes. This has worked well for me in the past when nothing else would.

Terry
Top of pagePrevious messageNext messageBottom of page Link to this message

Magnum4
Frequent Contributor
Username: Magnum4

Post Number: 309
Registered: 04-2005


Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 07 August, 2006 - 09:49 pm:   Edit Post Delete Post Print Post

Hi Grahm.
Are you sure some stepper motors have brushes? I would be very interested.

I find an inductor in line with the motor helps enormously. Also caps on motor terminals.
Do not overlook supply decoupling to control electronics, and include a largish cap before the regulator as well as a small one.(including the series diode to the controller chip)
Regards,
Jim
Top of pagePrevious messageNext messageBottom of page Link to this message

Zeitghost
Frequent Contributor
Username: Zeitghost

Post Number: 317
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 07 August, 2006 - 10:36 pm:   Edit Post Delete Post Print Post

Must be an odd stepper if it does have brushes... principle is a wound stator with a hard magnetic rotor sans any windings at all.

There are other variations (hybrid?) available though.
Top of pagePrevious messageNext messageBottom of page Link to this message

Zeitghost
Frequent Contributor
Username: Zeitghost

Post Number: 318
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 07 August, 2006 - 10:38 pm:   Edit Post Delete Post Print Post

Have you tried 1nF capacitors across the switches?

Put these close to the PIC to reduce the amount of picked up by the inputs.
Top of pagePrevious messageNext messageBottom of page Link to this message

Epithumia
Frequent Contributor
Username: Epithumia

Post Number: 56
Registered: 06-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 07 August, 2006 - 11:20 pm:   Edit Post Delete Post Print Post

Have you got diodes on the relay coils to kill the back EMF?

Have you kept the power wiring to the relays and motor separate from the power wiring to the PIC? If there's a voltage drop across the relay or motor power wires and their connectors, will this voltage drop affect the PIC's power?
If you need me, Neil and me will be hanging out with the Dream King. - Tori Amos
Top of pagePrevious messageNext messageBottom of page Link to this message

Pat
Frequent Contributor
Username: Pat

Post Number: 52
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, 09 August, 2006 - 12:48 pm:   Edit Post Delete Post Print Post

Thankyou all for the helpful replies. Terry, I used the low resistor but unfortunately it did not help. Dave, electrically energising the relay to directly switch the motor on and off causes no problems. The power source is either a 6v 1AH or a 4.5AH rechargeable battery. The PIC pcb is presently 1metre away from the relay pcb and motor. The PIC pcb includes a 2k2 base bias resistor, the transistor and back emf diode and I will stand correction but better to send a low impedance collector voltage of 5v+ over that distance than the higher impedance PIC output. Nevertheless I did as you suggested but still get exactly the same problem.

I am using a 16F84 and taking advantage of the light pullups on portb. N/O switch S1 input uses RB7, which controls RB5 output to energise RLY1 to raise the door and when fully open pressing it enrgises RLY2 to close the door. The other two inputs are microswitch MS2 to RB4 which operates when the door is fully open and MS1 to RB3 when fully closed. Whilst the door is opening pressing S1 a second time is programmed to stop the motor (but it does not always work). When the door is closing pressing S1 a second time is programmed to stop the motor, pause for 3 seconds, then reverse the motor to re-open the door. This always works except most times instead of pausing, it ignores the 3 second delay and reverses immediately. What I cannot understand is that pressing S1 to initiate motor operation always works correctly and what is important is that both MS2 and MS1 always stop the motor (we are talking several hundred operations!) and never a hiccup. This will no doubt bring the rebuke "Check your program". Well this is it:

reverse bcf portb,1 ;stop motor
call revdel ;debounce etc.
go to open1
Note this program will not print correctly in Chatzone Preview butis set out correctly (reverse is the label)

As stated sometimes it works correctly but most time misses out the call to 'revdel' which is simply a 3 second delay. Instead of calling for revdel I have even tried putting the whole delay between 'bcf portb' and 'go to open1' but most often ignores it and still goes directly from 'bcf portb' to 'go to open1'.

Meanwhile instead of powering directly from the battery. given the light load, I have tried powering via a TO 220 5v fixed voltage regulator with no improvement ie. S1 always initiates motor operation in the correct direction, MS2 always stops the motor as does MS2 but when opening a second press on S1 does not always respond but when closing it always responds to S1 but most often the motor reverses but misses out the 3 second pause.

Epithumia, power wiring is all on the relay board close to the motor This does result in a slight voltage reduction to the PIC when the relay and motor are operating but is smoothed by che 0.1/100uf combination and well above the minimum PIC voltage.

Zeitghost, the 1nf caps across the switches did not bring significant improvement.
Kind regards to all,
Pat
Top of pagePrevious messageNext messageBottom of page Link to this message

Paul_goodson
Frequent Contributor
Username: Paul_goodson

Post Number: 504
Registered: 05-2005


Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, 09 August, 2006 - 02:05 pm:   Edit Post Delete Post Print Post

Hi Pat
Just a quick and silly one!!
I had a similar problem with the project Iím working on at the moment.
I was using the same switchers to be used for different functions and it was all going pear shaped.
But then in my case it was sorted by after testing if a switch was set
I then tested it to make sure it was then clear with a small delay be fore going to the next instruction.
This was do to the fact the program was testing the switchers far to fast.
I know it was suggested using a small cap too
But all the same it might be worth a go if you havenít already done so.

Paul
The bluntest pencil is better than the sharpest memory!!!!!!!
Top of pagePrevious messageNext messageBottom of page Link to this message

Mike_b
Frequent Contributor
Username: Mike_b

Post Number: 246
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, 09 August, 2006 - 04:20 pm:   Edit Post Delete Post Print Post

Yep - noise and pics dont go together.

Try:

1. inserting .1uF caps from motor to ground
2. inserting a diode in the power line - wire the motors to the 'power side' of the diode - wire the pic to the other side and add a nice fat 470uF cap (when the power dips 'cos of motor demand, the pic will remain powered)
2. wire a, 4.7mH choke after the diode and bung .22uF caps to earth either side - that will help to take noise off the supply line.
3. try to keep power lines to the motor away from pic and keep earth returns short
4. place a 0.1uF cap directly across the pic power lines with leads as short as possible


that should help

rgds

mb
Top of pagePrevious messageNext messageBottom of page Link to this message

Epithumia
Frequent Contributor
Username: Epithumia

Post Number: 60
Registered: 06-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, 09 August, 2006 - 04:40 pm:   Edit Post Delete Post Print Post

I like Mike's choke idea. With fast spikes around the diode may not the switching fast enough to provide the isolation we expect.

Have the ground wires for the switches also got motor or relay current going through them?

Is the oscillator internal or external? Are the oscillator wires as short as possible?

What's the construction: PCB? Veroboard? Breadboard?

Can your code go wrong if the switches inputs bounce up and down instead of switching cleanly?

Rob
If you need me, Neil and me will be hanging out with the Dream King. - Tori Amos
Top of pagePrevious messageNext messageBottom of page Link to this message

Grab
Frequent Contributor
Username: Grab

Post Number: 240
Registered: 05-2005


Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, 09 August, 2006 - 04:43 pm:   Edit Post Delete Post Print Post

Doh, what was I on! Sorry, brainfart on the stepper motors! :-)

Pat, I see you're talking about using a 5V regulator, but then you say you see a reduction in voltage when the motor's on. Correct me if I'm wrong, but are you trying to drive the PIC *and* the motor off the same smoothed supply?

If so, there's your answer. *ONLY* the PIC (and any other electronics) should be driven off supply that's smoothed with the diode/cap/regulator. The motor, relays and any other power parts *MUST* be driven directly from the battery. The whole principle of the smoothing/regulating is that you're creating a supply that's isolated from the horrible things the motor's doing to the battery voltage. If you connect the motor to that smoothed supply, surprise surprise, it don't stay smooth for long... ;-)

To get this to work, the PIC side should provide just an open-collector output to drive the relay, and the other side of the relay should be permanently connected to +V. That lets you interface the smoothed and unsmoothed sides without letting the unsmoothed voltage in.

Graham.
Top of pagePrevious messageNext messageBottom of page Link to this message

Dave_g
Frequent Contributor
Username: Dave_g

Post Number: 158
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, 09 August, 2006 - 09:17 pm:   Edit Post Delete Post Print Post

Pat - shame all this didn't work, but I'm still convinced, like Graham, this is a PSU problem. Can you clarify if the PIC has it's own supply? The motor, especially after your relays, has no need to have a regulated supply and the 7805 will take out most nasties.

I do see your point re impedance, but the advantage would be keeping the high current switched lines as short as possible. Moot point!
Top of pagePrevious messageNext messageBottom of page Link to this message

Obiwan
Frequent Contributor
Username: Obiwan

Post Number: 627
Registered: 12-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, 10 August, 2006 - 02:05 am:   Edit Post Delete Post Print Post

OK, I'll say it.

Must some sooommme doll house to have a garage door opener!! Fancy Schmancy!

Uh, who's driving Barbie around anyway? Her and Ken split a while back!
Do Not Hit The Fly That Lands On The Tigers Head.
Top of pagePrevious messageNext messageBottom of page Link to this message

Pat
Frequent Contributor
Username: Pat

Post Number: 53
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 11 August, 2006 - 08:39 am:   Edit Post Delete Post Print Post

Thankyou all for your suggestions of which I was going to try out one at a time but first I had developed a niggling doubt about using the light pullups on portb so I changed the polarity of the inputs and hey presto this seems to have solved my problems. Well put it this way: I opened and closed the door 50 times and only on one occasion did pressing S1 fail to stop the motor when the door was opening and on reflection maybe I did not press it properly. I can only assume, and it does seem to indicate, that the higher input impedance of the pullups are not appropriate to noisy environments. Anyone care to comment on this?

Obiwan, I can appreciate your sentiments and my grand daughter has been ribbed by her brothers who are now calling her "Lady Penelope". Lady Penelope now feels it more appropriate if Parker was supplied with a radio control. I told her that to the best of my knowledge no one sells 6v radio controls.

Kind regards to all,.
Pat
Top of pagePrevious messageNext messageBottom of page Link to this message

Paul_goodson
Frequent Contributor
Username: Paul_goodson

Post Number: 505
Registered: 05-2005


Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 11 August, 2006 - 09:19 am:   Edit Post Delete Post Print Post

Nice one Pat

You may have a bit more work to do if someone comes up with a 6v-radio control


I think you are correct with the input impedance.
Mike H told me here on a thread a few weeks back regarding a keypad issue
That he for one did not like to rely on internal pull-ups and used external resistor I think for that reason.

Paul
The bluntest pencil is better than the sharpest memory!!!!!!!
Top of pagePrevious messageNext messageBottom of page Link to this message

Mike_b
Frequent Contributor
Username: Mike_b

Post Number: 247
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 11 August, 2006 - 10:23 am:   Edit Post Delete Post Print Post

.... for the record, I have had interrupt trouble from noise when using rb0 and the internal pull up - 'replacing' the internal pull up with a 4k7 solved the problem, but like all these little tricks, it was a bugger to find.

rgds

mb
Top of pagePrevious messageNext messageBottom of page Link to this message

Dave_g
Frequent Contributor
Username: Dave_g

Post Number: 159
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, 13 August, 2006 - 06:51 am:   Edit Post Delete Post Print Post

Nasty little fault that, definately one to remember - thanks Pat!

Administration Administration Log Out Log Out   Previous Page Previous Page Next Page Next Page