CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Random reset
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
luckyluke



Joined: 18 Apr 2006
Posts: 45

View user's profile Send private message

Random reset
PostPosted: Thu Mar 30, 2017 2:12 am     Reply with quote

Hello
I am making robot for a school project and having random reset and malfunction problem.
I am using two 6v dc motor, two tb6612fng hbridge driver, five ir sensor, lm2940 5v regulator, 3s lipo battery.

Rarely it works perfectly but generally sensors misses targets or gives false positive signals to microcontroller (pic 18f2520).
I am also having resetting problem at start up and at the moment of hitting target (which means motors demand for current i guess).

I would like to hear your opinions and suggestions.
Ttelmah



Joined: 11 Mar 2010
Posts: 19216

View user's profile Send private message

PostPosted: Thu Mar 30, 2017 2:56 am     Reply with quote

How are you getting the 6v for your motors?.

If you have a 3s Lipo battery pack, you have about 11v nominal here.
luckyluke



Joined: 18 Apr 2006
Posts: 45

View user's profile Send private message

PostPosted: Thu Mar 30, 2017 3:05 am     Reply with quote

I give them 11 volt.
They work less than 1 minute. Motors are ok with it.
Ttelmah



Joined: 11 Mar 2010
Posts: 19216

View user's profile Send private message

PostPosted: Thu Mar 30, 2017 3:13 am     Reply with quote

Ouch. Except they will probably be sparking like hell. Result lots of RF....

Think again. Switch down to a 2s battery, and see what happens.

Add a small bipolar capacitor right across the motor terminals. Perhaps a 10nF polyester or ceramic. This will help to suppress the arc. What is the current rating of the motor at 6v?. The starting current can be up to perhaps 10* the rating, and with your nearly double voltage, you could be getting something like 20* the rated current momentarily....
luckyluke



Joined: 18 Apr 2006
Posts: 45

View user's profile Send private message

PostPosted: Thu Mar 30, 2017 4:54 am     Reply with quote

i am doing it for extra speed and power

if i adjust down pwm duty with 3s battery is it same thing using 2s ?
a fully charged 2s lipo is 8.4 volt

i am going to try 2s with capacitors
benoitstjean



Joined: 30 Oct 2007
Posts: 543
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Thu Mar 30, 2017 4:55 am     Reply with quote

I've played with a combination of DC motors and PIC microcontrollers many many years ago and I remember having similar reset problems due to the motor creating a current surge when starting which is why motors have start capacitors on them like Ttelmah suggested.

The current surge created by the motor going from 0 to 11V in a fraction of a second probably starves your overall power just enough for the PIC to reset. This is a bit like disconnecting a toaster while it's heating - the electric arc you see at the plug is due to the sudden current drop at that voltage... but in your case, it's the opposite, you feed the motor 11V all of sudden and spikes the current.

You may also want TVS (Transient Voltage Suppressors) on your inputs and probably also your MCLR pin. They act a bit like zener diodes buts much faster and limit spikes.

But I'm pretty sure if you search online, you can find schematics of what you're trying to accomplish.

And if the motors are 6V, then you need to give them 6V.

Be careful with these batteries, they can explode easily if you're not careful! Look online for exploding LiPo, you will find more than enough. I would start with a standard power supply before using a LiPo battery. At least if you short or reverse the polarity, you won't get a loud 'POOF' with magic smoke.

Ben
newguy



Joined: 24 Jun 2004
Posts: 1901

View user's profile Send private message

PostPosted: Thu Mar 30, 2017 6:23 am     Reply with quote

As you've discovered, motors are very noisy from an electrical point of view. You need to think "contamination" and "isolation". You have to isolate the motors from your logic.

Your logic needs TVS and/or MOV protection at the power input to the board. A choke (series inductor), rated for the current draw of your logic portion, may be required. A "pi" cap - inductor - cap input circuit is a good idea. The caps should be large value electrolytic and should also have a 0.1uF ceramic in parallel with each for high frequency noise (electrolytics are only good up to a few 10s of kHz).

Your FET motor control and its driver are considered to be part of the "contamination". You need to treat any line running from your micro to the driver as a source of contamination. LPF, with the fc chosen to allow your max freq PWM signal, is a good idea. TVS on those lines are also a good idea. A small value series R (100R typical) is also a good idea.

Same idea with any other line "leaving" your control board (to connect to a sensor for example). LPF, TVS, and series Rs are the norm. Physically locate these lines far away from the motors and make an effort to orient them at 90* to the motor's lines if possible.

Your control board should have a proper ground plane. You can get by with a 2 layer board, but a 4 layer with internal Vcc and ground planes would be better.

The motors themselves need something to snub the noise. Google "snubber" network. If a motor turns only in one direction, a properly rated diode will suffice, but if the motor is bidirectional an RC snubber is necessary.
luckyluke



Joined: 18 Apr 2006
Posts: 45

View user's profile Send private message

PostPosted: Thu Mar 30, 2017 7:26 am     Reply with quote

I will consider all your suggestion but since i have limited size and weight i can't put all of them.
I will start with adding tvs. Any suggestion about tvs model?
alan



Joined: 12 Nov 2012
Posts: 349
Location: South Africa

View user's profile Send private message

PostPosted: Thu Mar 30, 2017 7:31 am     Reply with quote

Sometimes it is better to get the circuit to work and then worry about size/weight.
So implement what were suggested above, if it works, then you know where your problems are originating.

Regards
luckyluke



Joined: 18 Apr 2006
Posts: 45

View user's profile Send private message

PostPosted: Thu Mar 30, 2017 1:12 pm     Reply with quote

I added a 10nF capacitors to motors and I used a 2s battery.
As the battery voltage decreases, the reset state decreases
but i lost speed and power from motors.

Size and weight is important because there are competition rules.
Ttelmah



Joined: 11 Mar 2010
Posts: 19216

View user's profile Send private message

PostPosted: Fri Mar 31, 2017 12:59 am     Reply with quote

You are potentially asking the motors to give up to perhaps 4* their rated power.
Now this brings a whole host of problems. The first is the obvious one of overheating. For a short time this is OK. However the big problem is that you are putting perhaps twice the rated current through the commutator and armature. This means the commutator will arc more than designed (massively reducing it's life), and introducing the RF problems you are seeing.
The motor efficiency will also plummet. Expect no more than perhaps 60* of their normal efficiency. So in terms of something that presumably has to carry it's own battery, not a good way to go.
You are asking the motor to do more than it is rated to do, and are then surprised that this causes problem.... Not a good start....
Have you actually looked with a current probe and a scope at what sort of current is instantaneously being drawn?. Also look at the waveforms on the motor connections. Be prepared for just how high the current spikes may be, and the amount of noise being generated.
You can reduce problems generically by good design. Routing of the grounds, routing of the power connections, some care in the layout of wires between parts of the circuit.
Also the capacitor to help cut the signal from the motor does want to actually be directly on the motor terminals, not on the drive connections. You did realise this?. Ideally it actually wants to be on the armature, but this is of course impossible, so as close as possible.
A search here, and generally online, will find a lot about interference and how to design to avoid problems.
luckyluke



Joined: 18 Apr 2006
Posts: 45

View user's profile Send private message

PostPosted: Fri Mar 31, 2017 2:51 am     Reply with quote

interesting thing is it didnt make this problems for the first 20 match

robot is for competition thats why i push the limits. steel chassis cover motors like cooler around it. i just need a 20 sec proper work thats all.


if i use two battery one for motor and driver one for 5v i have to connect their ground together so
is separating motor and 5v supplies can solve problems ?

if its not a fully charged 2s lipo has 8.4 do i have to adjust pwm duty to 6v? (%70 duty)
Ttelmah



Joined: 11 Mar 2010
Posts: 19216

View user's profile Send private message

PostPosted: Fri Mar 31, 2017 4:16 am     Reply with quote

So many parts of this are dependant on factor you are not telling us.

What is the inductance of the motor?.
What is it's DC resistance?
What is your PWM frequency?.

With PWM feeding a motor, to get a near linear response as you vary the PWM, the minimum pulse width needs to be greater than 5*L/R. If your PWM frequency is such that your shortest pulse is below this (depending on how low your minimum drive percentage wants to be), the torque of the motor will tail off. This is one part of 'why' you cannot take a 10v motor and run it off 20v at 50% PWM, and automatically get the same response as at 10v.
Then there are voltage limits and current limits internally on the parts.
luckyluke



Joined: 18 Apr 2006
Posts: 45

View user's profile Send private message

PostPosted: Fri Mar 31, 2017 5:05 am     Reply with quote

motor is
https://fmcc.faulhaber.com/resources/img/EN_1717_SR_DFF.PDF
6v 14:1 reduction
pwm is about 10khz (i will write exact frequency )
Ttelmah



Joined: 11 Mar 2010
Posts: 19216

View user's profile Send private message

PostPosted: Fri Mar 31, 2017 7:28 am     Reply with quote

Good. A motor with data. Smile

What's the minimum PWM percentage you need to be able to select? (if for instance your PWM accelerates it from 20% to 60% power, it's the '20%' figure that matters).

Even at 60% PWM, 10Khz is above the PWM frequency that will allow the motor to generate it's full torque...
Basically because of the inductance it takes time for the current to rise, when a voltage is applied to a motor. This limits the PWM pulse widths that can be used without loss of torque. Since you want maximum torque, you need to drop your PWM frequency.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group