The replacement had to go 7.5mph for 8 miles, using only spare parts. It focused on a brushless direct drive balancing robot.
Ancient motors were rewound.
A session of pin punching, allen wrench punching, back & forth sliding, & metal removal liberated the shaft. It was heavily jammed in.
The original windings were 4 strands of 0.25mm in a wye.
The new winding was 50 turns of 0.2mm, 7ohms end to end. It got toasty at 0.6A 4.4V but made decent torque. Mounting on aluminum would probably do the job. At this power, they would be dramatically more efficient than the RC car, for a lot less money than any gear motors.
A motor is tested for a winding error by using the right hand rule, a fixed current source, & permanent magnet. 10 & 3 were swapped.
In order to reach 7.5mph, the motors would work in stepper mode when stationary, then at a certain speed, transition to back EMF mode. Over time, it became clear that balancing robots were not stable enough to reach 7.5mph, at the required size. Even the mighty segway relies on some passive stability.
A balancing robot could probably do the job with a control moment gyro, but having 3 motors would defeat the purpose of having a balancing robot.
Focus shifted back to doing it as simply as possible. A bare minimum 4 wheeled thing appeared.
A transition between stepper mode & back EMF mode was still required if the same wheels were going to provide steering & high speed. Thus began the mysterious world of writing a double motor controller which could control 2 motors in stepper & back EMF mode, in 2 directions, using L6234 brushless gimbal drivers.
Reviewing source code of simple ESC's reveals they're not very simple at all. They all depend on hitting a minimum RPM from hard coded delays before sensing back EMF. Commutation doesn't occur at the zero crossing, but after another delay equal to the time between the last commutation & the zero crossing.
They need a holdoff time to avoid a false crossing from noise. The holdoff time is 1/2 the lowpass filtering of the previous zero crossing time & initially from the hard coded delays. To further reduce errors, they require the zero crossing to be a certain direction. Stalling is detected by a timeout.
At 660rpm, the real back EMF looked nothing like the textbooks.
Oscilloscope plots of the full power voltage are never shown, but they have the clearest view of the 2 powered phases with the back EMF clearly visible in the floating phase. There's a glitch where it goes from 9V to floating. Software detects the halfway point to determine the commutation time.
The normal oscilloscope plot shows PWM modulated voltages. The back EMF phase is less visible.
Back EMF fluctuates from PWM on the other 2 phases. It must be sampled on only 1 edge of the PWM, which limits the number of samples to the PWM frequency. PWM didn't work completely. It had to be done in software to get all 6 pins of the L6234 transitioning.
Sadly, back EMF ended up not working. The 1st sign was that the waveform didn't obey the textbooks, because the working RPM of a 7.5mph rover was too low.
A workaround was to lowpass filter the commutation time. This meant it took 10 commutations to respond to a change in load or voltage, while the reference design could respond in 1 commutation. As soon as it hit a bump, it stalled.
After a period of dejection, self pity, & planning to lose $80 on a Losi micro T, a voice from the distant past appeared. Maybe a sensored motor would work.
There are no teardowns of a sensored motor, but blurry, shaky videos appear to show home made attempts with 3 hall effect sensors outside the motor casing.
A single A1321 sensor is applied to the outside & powered by 3.3V.
Waveform when turned manually.
Waveform when powered slowly. The sensor did indeed work without modifying the motor. It just needed seriously accurate alignment. There is a blog post about writing a sensored motor controller. It's just a lookup table.
Mounting 3 sensors in the perfect arc was a serious wood carving & hot gluing job for just 1 motor. It was finally a task worthy of 3D printing.
The alignment had to be on the inner edges of the magnets & spot on. Any errors would make it randomly stall.
It was such a complicated nest of wiring & precision wood carving, it was 1 of those classic, simple, cheap internet solutions to an expensive problem which ends up requiring an enormous amount of skill to fabricate, in reality.
The alignment errors showed up in the waveforms, but the rotor position was clearly sensed outside the casing. The sensors & phase voltages had to be in exactly the right order. It required trying out all 6 possible sensor orders. It didn't completely stop when in the wrong order, but it wasn't as smooth & tended to stall.
Once configured, it worked perfectly. It handled much higher torque. No load current was 0.25A at 15V. It was just like physical brushes. Instead of stalling below a minimum speed, it kept going, with speed responding to load. For precision movement, it still supported stepper mode. It was a surprising payback for an external sensor sensing the unmodified motor through the motor casing.
The 1st road test with motor sensors worked perfectly. It definitely needed breaks & slightly faster startup. The stalls were gone. 7.4V got it to the 7.5mph range, without getting hot. It was virtually silent. Radio range was only 10ft.
It easily rolled over rough terrain. The rolling distance without breaks was surprisingly long. Even with no power, it rolled into curbs hard enough to flip over. The sensors seemed to withstand it.
Startup was a hard coded stepper acceleration, transitioning to commutating mode, to keep the wheels from slipping. That failed miserably. It slipped when rotating to the 1st step. It was a long way from transitioning into commutating mode seamlessly.
The only practical way to get straight driving was to go straight into full power. It didn't slip as much as feared. It used less current.
After implementing heading hold steering & all the manual controls, it worked perfectly. All the issues with bang bang steering were gone. Manual steering was effective. Steering by unbalancing the motor PWM was indistinguishable from the fully articulated suspension. The difference was it was utterly dependent on software to drive straight.
As soon as it hit a puddle, it was dead. The surface mounted boards need a conformal coating. Radio range was another issue, being nowhere close to what it was on the g-buggy. Finally, the gyro is extremely temperature sensitive. It reused the IMU from the balancer, but being back to 4 wheels means it could use the more temperature resistant gyro.
It's probably the fastest a 60mm Pololu wheel has ever gone, certainly the fastest a brushless direct drive rover ever went. Another $80 purchase was averted.
The 1st run with the brushless direct drive rover went way beyond predicted range, yet again. Range on 2S 900mAh was over 8 miles. Maximum downhill speed was 8 min/mile. Uphill speed sagged to 8m50s/mile. It was hopeless on rough terrain. It needed D feedback & shorter battery cables.
It was finally documented with the latest improvements.
The camera made it top heavy enough to flip over from the smallest obstacle.