Monday, September 04, 2006
Plaas wins! Bumping works! :-D
Here's how you do it.
- set up to count the encoder pulses via an interrupt
- start the motor at full voltage
- when you get an interrupt stop the motor
- wait a calculated number of milliseconds
- start the motor again
There is enough torque at that speed that I can not stall the gearmotor shaft by squeezing it with my fingers. I have been able to stall the gearmotor operating at low voltages using PWM with little problem.
The step that I've achieved so far appears to be about 15 degrees. For a threaded rod with a 1 mm pitch that gives us a resolution of 0.067 mm.
I suspect that if I were to use the L298N chip and apply braking between steps I could get even more torque.
I've continued raising the wait period and got the rate down to just at 1 rpm in about 48 steps (7.5 degrees).
From the sounds of it, the spline algorithms I've got waiting to test should have very similar behavior these results -- very nice. One difference is I won't be using any timing at all; there's no need to turn it back on until the desired position changes.
I might be extrapolating too much but it sounds like, with a gearmotor and a handful of parts, you could create a motor that could be controlled over a wide range of speeds with decent torque and a high degree of positional accuracy. Sounds like, that's all the best properties of a stepper, gearmotor and servo combined into one package.
As best as I can see there is no advantage to transitioning into PWM.
I'm not sure there is really a price advantage to doing it this way, though. Cost to build one of these things runs at ~$18 per motor. (Including CPU, circuitry, H-Bridge, shaft encoder, and gearhead motor)
One of the reasons I'm looking at trying alternative shaft encoders (optical) is to try to remove the $5 cost for the hall effect encoder. An optical encoder motor should cost about $8 for CPU, circuitry, H-Bridge and motor, if you use cheap $1-$2 motors and print your own gearhead (and optical components -- you only need an LED and two photo transistors, or optical sensors -- these are real cheap).
First off, you might have missed the news that Austria Microsystems has been feeling us out to offer discounts on that chip of theirs. The discount that they've talked about thus far looks like it will knock about $1.50 off of that $5 price.
you only need an LED and two photo transistors, or optical sensors -- these are real cheap).
Um, the Hamamatsu chip that we were originally thinking of using to make an optical shaft encoder costs US$2.25 in one-off quantities.
While it is true that you can, in theory, print out a housing and chopper wheel for an optical system I seriously wonder if you can put together an optical shaft encoder for $5.
if you use cheap $1-$2 motors and print your own gearhead (and optical components
LOL! Indeed, the possibility of printing one's own gearhead has crossed my mind more than once. I've already written the scripts for the Art of Illusion 3D modeling programme to let you do just that.
They're in the subvention repository or I can send them to you via email if you want them. :-)
if you use cheap $1-$2 motors
The motor that is in the GM series of gear motors sells for C$2 in one-off quantities, which leads me to believe that I could get it from them in quantity for about C$0.50.
Granted, buying pre-built encoders, or using hall-effect sensors is easy and 'neat', but I think it should be possible to have the RepRap itself build the shaft encoder plastic moldings.
You only need to buy the infrared detector and emitter:
2x IR phototransistor = US$0.20 each (Or $0.13 each if you buy 100 at a time)
2x IR photoemitter = US$0.21 each (or $0.17 each if you buy 100 at a time)
Plastic housing = US$.02 (I don't imagine you'd use much plastic to RepRap the passive components)
Total cost = US$0.84 worst case, or $0.62 each in 50 unit quantities.
Assuming you can in fact get the $0.50 motor, this means you can build a gearhead motor, with built in encoder, for about $1.20 each, using the reprappable optical encoders.
You could do a similar approach with hall effect sensors : you'd need to buy the hall effect devices and magnet, but I couldn't find any single hall effect device lower than about $1; and you'd need two. For this approach, it might make sense to buy a manufactured solution, like that you mentioned.
LOL! Let's fac it, you just want to build an optical encoder. I say, go for it! :-D
But, as it is right now, I have 4 dead mice with some optical encoders just waiting to be used.
So, I'm going to tear out their beady little eyes, and chop off their tails to use as serial lines.... "Three blind mice"... umm, hmm.. "Four blind mice..." :)
I suppose it wouldn't work as is mit den Frankenmotoren, cause they don't have gears... but...
Beagle the Furious, I looked at the experiment Adrian did with the acetate printed ring, (from Forrest's link above) he was half way there! I can already think of a few ways of fiddling with the phase shift problem.
In any case, you've been salvaging optical encoders, I've found good info on the web related to mobile robotics relating to this. Very do-able. And my girlfriend wonders why I've stockpiled printers and such under the house, hah! ;)
I'm trying to stay much more simple right now, though. You don't need a high resolution shaft encoder if it is mounted onto the motor shaft itself, and gear it down afterwards. You get the high resolution for free.
For example, a small rotor with 3 vanes on it would give 12 signal changes per revolution with two optical sensors (3 on transitions + 3 off transitions for 2 sensors).
Gear the shaft down 1:150, and you now have an encoder that has 1800 signal changes per revolution.
Even one vane should be fine -- this would result in 600 signal changes per revolution for the same 1:150 gear motor. I'm thinking it should be pretty easy to mount either a semi-circle, or cut a piece of plastic with half black and half transparant and this idea to work reasonably well.
Maybe you can elaborate a little more? I'm still new to CNC control. If you have figures for backlash you've been able to measure, that would be great too.
For example, how does putting the encoder on the final shaft prevent backlash? It seems all it does is allow you to correct for the error by backtracking when you get backlash?
It doesn't prevent it. It just means that that it's taken into account when you measure shaft rotation.
How much backlash is there in the gearmotor? The threaded rods that I eventually might use don't have any measurable give that I can tell.
Are we talking backlash of 30degrees? 10degrees? more? less?
I guess worst case, an encoder with 37 tabs should give adequate accuracy and be about as difficult as printing a gear -- or could probably be printed onto transparency (6cm diameter and tabs about 5mm in width). That would give 148 signal changes per revolution.
I'd really prefer to use a simple 1 or 3 tab thing on the motor shaft itself though. Would adding some kind of lateral force that would try to pull the table to one side be enough to compensate for the backlash? Could the software compensate for it (I.E, measure the backlash using the limit sensors, for example.)
I have nothing resembling Forrest's GM4s, at hand so I'm wondering what those are like...
Simple heuristic rule: Backlash is thine enemy.
Really? You got that much backlash when you reversed the motor? That is really shocking to me, even for a planetary gear.
For example, in a 1:150 gearmotor, 10 degrees output backlash would be 1500 degrees input backlash. They both describe backlash error of .03mm if the shaft is driving a 1mm threaded rod.
Maybe I'm missing part of what you are saying, so I'll try and describe what I've got in my hands. The planetary gearset probably has a ratio near 150 to 1.
First I pickup up slack by spinning everything clockwise. I stop and begin spinning the motor counter-clockwise. It takes 3.5 rev. of the motor for the slack in the gears to translate into ratation at the output shaft.
I'm still confused, but maybe you are not by now. :)
If the 150:1 planetary gear motor has 1200 degrees of backlash from the point of view of the motor, the output shaft is going to have 8 degrees of backlash error (1200/150) If you drive a 1mm pitch threaded rod, you'll have 0.02mm of backlash error.
Seems good enough to me for this application.
Put another way, if I can tell you when the motor rotates 90 degrees left, or 90 degrees right (using a single vane encoder at the motor shaft), I will be able to position the axis to a location to within +/-0.03mm, plus whatever other errors there are.
BTW, I don't think you can measure backlash with a limit sensor in the typical manner. You have two chunks of backlash that cancel each other out, one from moving away from the sensor, the other from moving towards it.
If you can arrange an odd number of movements then I suppose you can measure backlash. In my experiments, I hard wired the limit sensor to the motor, turning it off. Instead if it was only sending data to an MCU you could cheat with a precise enough sensor. Maybe optical?
First, move towards the limit sensor, set a counter to zero when you get there (sensor turns ON) and -continue- moving past the sensor a small amount. Then, double back (causing one chunk of backlash) and continue until the sensor turns OFF. At that point you should be able to get the difference in counter pulses.
Never done that, maybe I'm wrong. :)
BTW, Getting higher precision is just a matter of being willing to spend more money. If you put the sensors directly on the table, for example, using a linear hall effect sensor or laser positioning sensors, you can get near micron accuracy. I don't think it makes sense here when you have a lot of variation on the thread extrusion itself (I'd estimate +/- .05 mm, at least, in thread size variation and extrusion warping.)
I agree, I think the reason it's possible to go with all these simplifications is because the present RepRap accuracy is set fairly low. For example, threaded rods are known to have variations in the thread pitch, but that's not a problem here.
I'm interested in fabricating smaller more accurate parts, not sure what would be allowed then. At the moment I'm focusing on ideas for a fine extrusion head. I might be able to blog about it in a bit.
I think we'll see better accuracies. If not on RepStrap machines, on Nth generation machines -- as designs are played with and improved. I suspect a hybrid approach with both additive and negative manufacturing is probably going to yield the highest accuracies for the RepRap machines. Speculation only, I guess time will tell.
Links to this post: