19

Specifics Looking at the PID Basic Example I think that you just need to instantiate two copies of PID controller, one for each wheel, encoder and pwm: PID leftPID(&InputLeft, &OutputLeft, &SetpointLeft,2,5,1, DIRECT); PID rightPID(&InputRight, &OutputRight, &SetpointRight,2,5,1, DIRECT); Then, in your loop() equivalent, you just ...


4

The "Green (Ground), Brown (Channel B), Yellow (Channel A), and Orange (Sensor Voltage +)" wires connect to the encoder on the back of the motor and allow the use of quadrature to detect the number and direction of motor turns. As noted on servocity's page for the motor, you can count the following numbers of cycles or events per rotation of the motor or of ...


4

Sure, here are a couple of choices for you: For high end, you can look at a 200 counts per revolution rotary encoder like this one: $30 Sparkfun 200 Counts Per Revolution Rotary Encoder You'll need a microcontroller like an Arduino to count the rotations, there's some sample code to play with. $5 Adafruit 24 Counts Per Revolution Rotary Encoder Cheaper, ...


2

When I'm processing quadrature encoder input in an ISR, I prefer to have a simple ISR running on a timer that's guaranteed to run fast enough to catch every state (not state change) of the encoder. Interrupting on every pin transition invites a situation where the processor gets bogged down if a pin starts bouncing. Interrupting at a fixed rate may use up ...


2

Interrupt service routines should always do the absolute minimum. Remember that while your MCU is servicing an interrupt, it is doing nothing else. For a simple quadrature encoder, it should be possible to have a pair of ISR's, one triggered by a change on the A channel, the other triggered by a change on the B channel. Pretty much the only thing these ...


2

Maybe you could take one from an old computer mouse, and count the light pulses directly from the mouse board so you could tell the length of the cord.


2

I would think you should be able to. I've used magnets and reed switches in a similar application for a speed sensor which uses the turns to calculate speed much like an encoder and it worked perfectly. The hall sensor should behave in a similar way.


2

Dead reckoning is not a measurement, it's a form of estimation. It is by definition inaccurate, and accumulates error over time. We use it when more precise forms of position measurement aren't available (because it's better than nothing) and only to the extent that the accumulated error stays below a desired bound. In other words: after your error ...


2

The automotive industry frequently uses Hall effect sensors to measure shaft and gear rotation. The Hall effect has some beneficial properties: it operates over a wide range of temperatures, is more immune to contaminants than, say, optical technologies, comes in a wide range of response profiles, and with multiple mounting options. I'd suggest placing a ...


1

I don't think that an odometer is the right sensor for this task. The wheels will definetly slip. The error will add up quickly and the measurement will not be very good. These types of sensors are not made to measure several kilometers of distance traveled. Use GPS instead. It does not require any modification of the vehicle. The data is much more ...


1

I've figured out the problem a while ago. It turns out to be a power supply problem. I'm using a computer power supply (Antec HCG 850M) with the under voltage & over current protections removed, so it doesn't trip. There was also another huge problem I didn't mention. The motor was randomly stopping and starting several times a second. Then I saw that ...


1

Yes you would: no current [Arduino] on the market (that I know of) can effectively track the state changes without missing a few state changes. (Maybe the Due would be better or another board with a higher clock rate.) Interrupts can help a little, but: I believe it stops everything else on the chip; the motors might stop slightly when the interrupt is ...


1

I like @kramer65's answer but because you indicated you might like to make an encoder, I thought I'd share some information on that. http://www.societyofrobots.com/sensors_encoder.shtml shows a very common way of making a rotary encoder. You attach a disk with evenly spaced holes or reflective surfaces depending on implementation to your shaft. You align a ...


Only top voted, non community-wiki answers of a minimum length are eligible