I don’t have the link but I do have the file. A little over 2 Meg WMV file.
PM your email address if your email can handle that size.
I don’t have the link but I do have the file. A little over 2 Meg WMV file.
Why not just put it on youtube? I would like to see it as well.
Got a preliminary look at the JAG waveform:
PWM generated with VEX controller
9 volt power supply (all I had)
CIM-01 no load
Looks like the inductive spike settles in 15 to 20 % of the wave form period. This is what I would call a 3*L/R period… so I’m guessing the L/R is in the neighborhood of 1/15kc * (.15/3)= 1/300 ms . My motor leads are short so with some added wire resistance this might conservatively decrease to about 1/500 ms or about 2 us.
So it seems that the inductive spike settling is not the driver for the motor shut down to measure the back_emf. One could just shut it down for a pwm cycle, make the reading and turn the controller back on. The controller restart might take a cycle or two to get going but that wouldn’t be too bad.
I ran the waveform with braking and coast mode. It was strange that the coast mode waveform didn’t appear any different. This is not what I expected…so maybe someone can verify this.
Don’t forget that the coast/brake mode only affects the turn on of the two lower pairs of FETs when the PWM goes to a value that would represent “off” i.e. no direction. During that time, the two FET groups (six FETs in all) would present a short to the motor. Effectively, this is about 6-8 mohm at the output of the JAG. The Jag also produces a charge pulse to charge up the cap in the voltage doubler of the FET driver chip periodically.
Al, the short is what I would expect in the brake mode. It seems to me that the two FET groups would be open in the coast mode and the current would discharge through the protection diodes. When the current is zero , then the voltage would jump to the back_emf. This is what I saw with the vex controller and also agrees with other waveforms that have been posted for H bridges online. So I’m still vexed …seems the coast mode might not be operational.
I am trying to remember the tests we did way back in January. It seems to me that we had a drive train with AM transmissions and two CIMs per. I only connected one motor on each side of the drive train so that I could intermittantly load the drive train by shorting out the other motor. As I remember, with no drive (stick at neutral) I would see about 6-7 volts as the motors coasted down from full throttle at the output of the JAG. Looking at the output of the driven motor open circuit I saw somewhat higher, maybe 8-9 volts. When we used the brake jumper, the output went down to less than a volt when the throttle was released. In all cases though, the brush noise was significant. It seems to me that worst case was winding down from full throttle to about 80%. Moving up to full throttle produced less noise and inductive kick. I also remember a distinctive ripple that was associated with the switching of the brush assembly. Don’t quote me but I think the ripple voltage was in the 0.2-0.5 range. As the JAG is firmware controlled, I would think that a small code change might make EMF measurements much easier. Wink, Wink, nod, nod, to anyone from Luminary who is listening.
I downloaded the JAG Brushed motor software from Luminary micro to see what they are doing. After some looking, I found hbridge.c which shows how they control the gates. Looks like when a limit sw is activated , the high side gates are off and the low side gates correspond to either a coast or brake configuration. The coast has both low side gates off and the brake has both low side gates on. The limit sw is polled every interrupt so should be fast shutoff. For those that want to take a look, I am posting it here… I think this is ok since it has the copywrite headers on it.
The ckt doesn’t seem to have voltage sense on the motor output terminals so I don’t think they can read Back_emf as currently configured. I see a boost vsense but I think that only manages the boost voltage.
The inputs are 3.3v for the brake/coast and the limit switches. So would need to be careful when driving these with 5v Crio logic. The max voltage we can put into these ports is 5.5v and might be wise to use level shifting just in case of a slight over voltage. The level shifting would be needed for the brake/coast input. The limit switches have 3.3v pull-ups and are looking for a ground to pull them down. If Crio can be configured without a pull-up and be just a open collector might get away without level shifter.
hbridge.c (19.4 KB)
hbridge.c (19.4 KB)
There is a 0.0005 ohm current sense resistor on the h bridge low and ground. On page 2 of the schematic lower left the current sense amplifier is shown. Appears they are filtering it a bit. Currently this is only being used for over current protections. This could be sampled when the H bridge is in the on state of the PWM period. This would give the current draw of the motor and if the motor RPM- current curve is known the the approximate velocity can be found. Is this the focus of the post?
Do you think that this ripple could be sampled? I assume that the frequency would be proportional to the speed of the motor. Perhaps a Schmidt trigger could clean it up. This could then be sampled by the cRio to determine the speed of the motor. Not quite the same as back emf speed controller, but would not require a mechanical sensor to determine speed.
I don’t see why not. There are some variables that come into play though. The ripple frequency/PRR is affected by wear on the commutator and brush assembly. I would guess it would be significant until the brushes fully wear in. I have not counted up the commutator segments on any of the motors so I can’t give you an idea of frequency vs. motor rpm. The sensor would have to track over a wide range of frequency and varying DC levels but it should be possible. The harder part is getting rid of the brush noise and inductive kicks. Since the frequency is pretty low, some adaptive DSP might make things very nice for this application.
I think for this discussion, we should likely rule out using the brake mode on the controllers. If this proves to be possible, then adaptive motor control would be better than simple brake mode. Although the current demands go up, motor position control would prove much better than a short across the motor.
This might be a viable alternative to estimate back_emf and probably deserves its own thread. It introduces motor L , total system R and current rate into the equation. I.e. v_bemf = Vm - Ldi/dt - iR . We know that in the short term current rates can be very high and the motor inductance is a big unknown. Also R varies all over the place…particularly when the motors are heating up from stall conditions and battery resistance unknowns also factor in. However, if we wait until the current rates are negligible, then v_bemf = Vm -iR and under stable R conditions, this is a good approx. When the duty cycle is high, we measure current during the ON phase of pwm cycle so v_bemf = Vsupply -iR , where Vsupply is the sensed supply voltage which the JAG already has. For low duty cycles, probably best to use current on the OFF phase so v_bemf = - i*R. Of course, we would have to be in the braked mode to see the current.
The same v_bemf equation enters into my proposed project…but we shut down momentarily so that i= 0, di/dt=0 and then measure Vm with an a/d dynamically while in the coast mode. So this eliminates some error sources but places extra constraints on the controller.
I have not counted up the commutator segments on any of the motors so I can’t give you an idea of frequency vs. motor rpm.
Last time I counted there were 20 clicks per rev on the CIM01 so I’m guessing 10 segments. At 5310 rpm the segments are zipping by every 1.1 ms but we still get 15 jag pwm cycles to average over that time. The Victor 884 (120 Hz) only gets 1/8 of a pwm cycle while the Victor 883(2khz) get 2 cycles to average. I suspect this contribtes to the Victor nonlinear xfer function but I’ve never proven it to myself.
Here’s a totally crazy uneducated idea, but could you count the segments?
It is actually the other way around. The 883 is 2kHz and the 884 is 150Hz. I suspected early on that the 15kHz PWM frequency on the Jags would play havoc with winding inductance. Of course it varies from motor to motor. We have not done any serious research into this though. We did not use a Jag on the robot after we killed one in practice with the dreaded one way only U6 failure. Since it was in a steering motor, no one wanted to use them after that. I did not coorelate the noise spikes and the switching frequency. Scott had asked me to try and duplicate the problem but I never did. I did beat the heck out of the pair without failure.
BTW, be advised the current monitored across the 0.0005 ohm resistor will have pulses that mimic the output until the device is sent to full throttle.
I think FRC20 counted back EMF pulses for autonomous in Overdrive.
My thoughts exactly. If the victor is missing entire commutations, it is very hard to make the assumption that the motor is acting as the old “inductor resistor back-emf” model. When you commutate mid-pulse, you change the effective duty cycle.
Since we last discussed this, I’ve had more time to pull out the math-hammer and analyze your theory a bit more. As far as I can tell, more hertz is more better, * once you get over the initial low-nyquist weirdness*.
I believe the response will be similar to that of the “sample and dump” oversampling that was implemented in the FPGA. They both act as low-pass filters, but inputs reflect across nyquist boundaries created by the chopping. In the FPGA, the chopping is from the “and dump”. In the motor, the chopping is from brush commutation.
If the chop frequency and the input frequency perfectly align, it can completely attenuate the signal. The frequency response of the entire system would look like a low-pass filter with periodic ripple or dents. This may explain the perceived improvement of going to a chop rate.
However, I still hold that the attenuation from increasing the chop freq by two decades completely swamps the nyquist attenuation, and it is more reliable as it doesn’t depend on motor speed.
As for “playing havoc with the winding inductance”, I still don’t understand what you mean by this. I can’t imagine we’d be near self resonance…
The winding inductance forms an L/R filter with the winding resistance and the wiring and controller series resistance. This produces a low pass filter that affects the current in the motor windings. I no longer have my notes and we are short handed here at work so I can’t reproduce the calculations right now. I believe I opened both the CIM and FP motors and found that 150 Hz chosen by IFI in the 884 seemed to fit with the commutator spacing PRR to optimize the current when the motors were spinning near peak efficiency. I am running on my audio experience here with 15kHz being the edge of normal hearing range and the effects of series inductance in audio circuits particularly telephone links.
Since the average winding current is directly related to the behavior of the motor, anything affecting motor current affects the motor behavior. Nyquist might be the wrong way to analyze this since the commutator spacing (between segments) is much less than the contact size and the output PWM is a fixed frequency while the commutator PRR is variable depending on the motor speed.
This is what I have been thinking…If we consider a set speed, how many pulses supply current to a particular winding at 150 Hz or 15Khz and how does the L/R affect the current? If we set this limit…at some speed a motor is spinning at a rate that allows a 150 Hz PWM at 50% duty cycle to supply current to an entire commutator segment, that is 3.3msec. Then the current rise time is a small fraction of the total current for that time period. For the same speed, segment length and duty cycle, a 15kHz PWM would make 100 on/off transitions and the L/R rise time over the same period becomes a significant portion of the supplied current over that same segment. Although at 150Hz the next segment would receive no current, the overall long term average current in both cases would seem to be 50% until you consider the rise time of the L/R equivalent. In addition, when either input pulse returns to zero, the inductance will try to cause the current to continue flowing. It is this that forms the sparking at the commutator/brush interface. That might prove to be useful in that an arc detector could be used to synchronize the sample circuitry. If that were possible, then a sample taken after the pulse would be by definition the back EMF. This of course, will become impossible when the duty cycle approaches 100%.