I have a DC brushed geared motor (about 6 Amps at 24 volts) on each wheel of a large 2-wheel robot lawnmower. When it goes uphill it slows down. Also when it hits a bump it changes direction (the wheel that hit the bump slows down). How can I make the wheels turn at a constant speed with load changes (regulate the speed)? I noticed that if I increase the speed it goes uphill OK. I was thinking of putting 2 little dc generators (actually dc motors) on each wheel to generate a dc voltage relative to the wheel speed (tachometers) (like a bicycle dynamo but dc). This dc signal from each dc tachometer would be the feedback for a PID loop to (try to) regulate the wheel speed. I am using a 50A Dual-Channel Motor Drive Module http://www.ebay.com/itm/271014349040?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649
Any comments? Anyone done something similar? Suggestions?
You need some sort of feedback. The generators would work but your two generators are unlikely to produce exactly the same output at the same speed. Many projects use an optical interrupter (either simple or quadrature) and a slotted disk to detect speed (or speed and direction with quadrature).
I don't think the little Arduino has enough speed and interrupt timers to count and calculate speed from two encoders as well as do all the other stuff it has to do such as a ping sensor, servos, IR sensor, four PWM outputs to the drive, etc. The analog signal from a generator would be instantaneous (an advantage of analog computing).
Contrary to what you would think, two interrupt driven encoders would take MUCH less processing time than the analog method. The reason for this is that the analog reads take a VERY LONG TIME.
If you handle a digital encoder with interrupts it will have very little effect on the code because handling the interrupt only takes a few clock cycles and it only needs to happen when the input changes instead of on every loop.
You might also want to look into hall effect sensors, as they are often used to measure rotation.
Good point. I had not thought of that. Thanks.