What is the part number of the IR Emitter/Sensor parts (U4-U8) used on the 3PI?
The reason I ask is that I want to add one more in an attempt to measure distance traveled by counting the passage of wheel spokes. I’d use ADC6 or 7 with circuitry similar to the line sensors, and mount the additional sensor close to one of the wheels facing outwards. Ought to be able to detect a spoke (white) or no spoke (equivalent of black since no IR reflected).
My ultimate goal is a maze solver that can handle a maze that contains loops (cycles).
We offer the 3pi sensors on small carrier boards:
The sensors on these boards and on the 3pi are generic versions of the Fairchild QRE1113. The 3pi sensors are connected like the QTR-1RC sensors, but with smaller capacitors. If you want to use a dedicated analog pin like ADC6, you would need the the QTR-1A or a circuit like it.
If you do try to get encoder feedback working on the 3pi, I’d be very interested to hear how it goes. Note that encoders might not be necessary for what you’re trying to do, however. I’ve made a 3pi looped-maze solver that worked strictly off of timing on a 16x16 gridded maze. Because the voltage to the motors is regulated on the 3pi, the behavior is very consistent and highly repeatable. If your looped maze is at least on a grid (i.e. you know that intersections can only occur, say, every 6 inches), then timing will probably work once you do some tests to characterize the timing of your 3pi as it drives along the line. Good luck, and let us know how it turns out (or post here and ask for help if you get stuck)!
Thanks Ben, I’ll keep you posted on progress.
I’m curious why you chose the RC sensor design as opposed to the analog design for the 3PI. My back of the envelope calculation for the 328P ADC is as follows:
- ADC clock at 200 KHz for full 10 bit resolution. Faster if I only need 8 bits.
- First ADC conversion takes 25 ADC clocks, and any additional conversions will take 13 clocks.
- Since there is only one ADC with selection of 1 of 8 sources, the total conversion time for 5 sensors would be (25 + (4 X 13)) / 200000 = 385 microseconds.
Using the 3PI digital approach with the RC sensor configuration you measure all 5 sensors in parallel with the longest delay of the five sensors determining the overall measurement time. The maximum allowed time before the measurement times out seems to be 800 microseconds but I’ve not assessed what a typical measurement delay actually is. Can you give me some idea?
In general, we like the digital sensor configuration better than the analog one. They are inherently more resistant to noise due to the presense of the capacitor, and they allow for higher sensing resolution if you are willing to sample for a longer period of time. This can be especially useful if you want to be able to distinguish between different regions of dark. This application note demonstrates what I mean (for a sensor mounted relatively far from the ground, the RC version makes it much easier to distinguish between black and white than the analog version does, as long as you’re willing to sample for longer).
Your time calculation for the analog conversions isn’t quite right. The AVR on the 3pi runs at 20 MHz, which means you need to use an ADC clock prescaler of 128 if you want full 10-bit resolution, which results in an ADC clock of 156 kHz. Also, you would probably want to average a few samples per sensor to minimize the potential effect of noise, which very quickly gets you to the 800+ ms sampling time. Finally, I’m not sure you really gain that much by sampling much faster than 1 kHz.
I think a measurement timeout of 800 us is probably pretty good for the 3pi sensors, but I suggest you play around with it yourself under your particular operating conditions. Shortening the timeout decreases your ability to detect dark well by causing gray regions to produce the same sensor output as black regions. If your white regions are very bright, it might be fine to treat all pulses longer than, say, 400 us as “full black” by setting the timeout to 400 us. However, when trying to locate a line, the ability to distinguish between gray and black can help you determine the position of the line with higher resolution.