Smoother tracking through sharp curves
16 ANALOG CHANNELS · 16 STATUS LEDS · FFC
This compact curved array uses sixteen reflective sensors for line-follower robots. Its geometry improves detection consistency through turns and increases line-position resolution compared with a straight sensor layout. Every channel has an onboard status LED for immediate alignment, calibration and debugging feedback.
Multiplexer mapping
A 16-channel analog multiplexer reads every sensor through one microcontroller ADC pin. Four digital select lines choose the active channel. Position thresholds progress from 0 on the left to 15000 on the right.
| Sensor | MUX | S0 | S1 | S2 | S3 | Position |
|---|---|---|---|---|---|---|
| 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| 2 | 1 | 0 | 0 | 0 | 1 | 1000 |
| 3 | 2 | 0 | 0 | 1 | 0 | 2000 |
| 4 | 3 | 0 | 0 | 1 | 1 | 3000 |
| 5 | 4 | 0 | 1 | 0 | 0 | 4000 |
| 6 | 5 | 0 | 1 | 0 | 1 | 5000 |
| 7 | 6 | 0 | 1 | 1 | 0 | 6000 |
| 8 | 7 | 0 | 1 | 1 | 1 | 7000 |
| 9 | 8 | 1 | 0 | 0 | 0 | 8000 |
| 10 | 9 | 1 | 0 | 0 | 1 | 9000 |
| 11 | 10 | 1 | 0 | 1 | 0 | 10000 |
| 12 | 11 | 1 | 0 | 1 | 1 | 11000 |
| 13 | 12 | 1 | 1 | 0 | 0 | 12000 |
| 14 | 13 | 1 | 1 | 0 | 1 | 13000 |
| 15 | 14 | 1 | 1 | 1 | 0 | 14000 |
| 16 | 15 | 1 | 1 | 1 | 1 | 15000 |
Fast channel selection
PC0–PC3 select the multiplexer channel. Direct PORTC manipulation changes only its lower four bits and samples faster than four separate digitalWrite calls.
inline void selectMuxChannel(uint8_t ch) {
PORTC = (PORTC & 0xF0) | (ch & 0x0F);
}Fast analog reading
The multiplexer output connects to A4. A custom ADC routine uses AVcc as reference and avoids the overhead of analogRead when maximum sampling speed is required. Standard analogRead remains suitable when that speed is unnecessary.
inline uint16_t fastAnalogRead(uint8_t ch) {
ADMUX = (1 << REFS0) | (ch & 0x0F);
ADCSRA |= (1 << ADSC);
while (ADCSRA & (1 << ADSC));
uint8_t low = ADCL;
uint8_t high = ADCH;
return (high << 8) | low;
}Firmware thresholding ignores weak reflectance values, while short analog routes and the FFC connection reduce noise and wiring bulk.
Open design files ↗