An autonomous mobile robot that counts floor markings and stops at a specified distance from an obstacle.
From Floor Markings to Motion
The challenge was to turn simple sensor readings into reliable autonomous behavior.
Rather than following a predefined path or relying on manual control, the robot needed to recognize environmental events as it moved: detect individual floor markings, keep track of how many it had crossed, and stop once it approached a wall at a specified distance.
The control system combined infrared sensing for line detection with ultrasonic distance measurement and Arduino-based logic to translate both inputs into motor commands.
Testing Environment
The robot navigated across a series of dark floor markings and used changes in reflected light to count each crossing before approaching the wall and stopping at the assigned distance.
Final System
An Arduino-controlled mobile robot using infrared sensing to count floor markings and ultrasonic sensing to stop at a specified distance from a wall.
PROJECT OVERVIEW
Roll Call is an autonomous mobile robot programmed to complete a sensing-and-navigation task without manual intervention.
As the robot moved through the test course, an infrared sensor detected changes in reflected light corresponding to floor markings. Each detected marking incremented a counter until the assigned target was reached. The robot then continued toward the end of the course, where an ultrasonic sensor measured its distance from a wall and triggered the motors to stop at the required position.
DESIGN GOALS
Create an autonomous robot that:
- detects floor markings using infrared sensing
- distinguishes markings from the surrounding floor
- counts each marking only once
- responds to a specified target line count
- continues navigating after counting is complete
- measures obstacle distance using an ultrasonic sensor
- stops at a specified distance from the wall
- operates without manual intervention
- remains repeatable despite sensor and lighting variability
INITIAL CONCEPT
The system used two forms of environmental sensing to divide the challenge into sequential behaviors.
An infrared sensor provided the input for line counting. When the measured light response crossed a calibrated threshold, the program identified the event as a floor marking and incremented a counter.
Once the required number of markings had been detected, the robot transitioned into its final navigation behavior. An ultrasonic sensor then monitored the remaining distance to the wall, and the robot stopped when the reading reached the assigned threshold.
The Problem
Detecting a floor marking sounds simple visually, but the robot does not see a “line” the way a person does. It only receives a changing sensor value.
The infrared sensor therefore needed a calibrated threshold that separated the floor from the markings reliably enough for the robot to recognize each crossing as a discrete event. That threshold was sensitive to environmental conditions, particularly lighting, making readings inconsistent across different testing conditions.
The robot also needed to coordinate two separate tasks. It had to count markings accurately without stopping early, then transition to distance-based navigation and stop at the required wall distance.
The challenge was therefore not just sensing the environment, but translating imperfect sensor data into predictable autonomous behavior.
System Architecture
The control system was organized around two sequential sensor-driven behaviors:
1. Detect & Count
The robot continuously read the middle infrared sensor while moving.
When the reading crossed the calibrated threshold and the current count was still below the assigned number of lines, the robot registered a line crossing and incremented the counter. The code then briefly changed the robot’s motion before continuing, helping prevent the same marking from being interpreted repeatedly while the sensor remained over it.
2. Approach & Stop
After the line-counting portion was complete, the ultrasonic sensor provided the robot’s current distance from the wall.
That measurement was compared against a predefined stopping-distance variable. Once the robot was at or inside that target distance, the motors were turned off. The submitted version used 5 cm as the stopping-distance constant.
Control Logic
The Arduino program connected the sensor readings to the robot’s motor behavior.
For line counting, the program compared the infrared reading against a threshold while also checking the current counter against the assigned target. A detected marking increased the count before the robot continued forward.
For the final stopping behavior, the ultrasonic reading was stored as the robot’s current distance. When that value reached the predefined end distance, the program shut off the motors.
Sensor Calibration
The infrared sensor distinguished floor markings by detecting differences in reflected light, but its readings varied with the surrounding lighting conditions.
Because calibration and testing did not always occur under identical lighting, threshold values that worked in one environment could become unreliable in another. This meant successful autonomous behavior depended not only on the code, but on calibrating the threshold for the actual test conditions.
Arduino control logic used to interpret sensor readings, count detected floor markings, transition between behaviors, and stop the motors at the target distance.
Line counting (left); distance (above)
Testing & Iteration
Physical testing exposed sensor behavior that was not apparent from the control logic alone.
During final testing, the first robot developed a sensor-position issue: a sensor expected to face forward reported approximately 10° rather than 90°. A replacement robot then produced unusually low infrared readings when passed over the test markings. After moving to another unit, I recalibrated the thresholds and the robot completed the test successfully.
This process reinforced that autonomous systems depend on both software and the physical behavior of the hardware. When sensor output changed, the control logic itself was not necessarily incorrect; the system had to be debugged across hardware, calibration, and software together.
Mechanical Analysis
Early system layout and free-body analysis used to examine component placement, wheel loading, weight distribution, and static forces acting on the robot.
Even though the project was primarily focused on autonomous control, the assignment also included basic mechanical analysis of the robot.
The calculations considered the robot’s weight distribution across the wheels and estimated forces on the wheel-ground contact area. The analysis assumed the stationary robot’s weight was shared between the left and right wheel supports.
The project also compared the torque required for the wheels against the motor’s stated stall torque. Interestingly, the simplified calculation suggested the available stall torque should exceed the required torque, even though the physical system exhibited behavior that did not fully match that prediction, an early example of the difference between simplified modeling and real hardware.
Final System
The completed system successfully integrated infrared sensing, ultrasonic distance measurement, motor control, and Arduino logic into a single autonomous sequence.
The robot could detect floor markings through changes in reflected light, maintain a running count of those markings, transition once the required number had been reached, and stop when the ultrasonic sensor measured the assigned distance from the wall.
More importantly, the project demonstrated how simple sensors can support autonomous behavior when their outputs are paired with carefully structured logic, calibration, and repeated physical testing.
Results
The final system demonstrated the complete autonomous task:
- detected floor markings through changes in infrared sensor readings
- converted threshold crossings into discrete counted events
- tracked progress toward an assigned number of markings
- transitioned between line-counting and final approach behaviors
- measured wall distance using ultrasonic sensing
- stopped autonomously at the specified distance
- operated successfully after hardware troubleshooting and threshold recalibration
Future Improvements
The biggest opportunity would be reducing the system’s sensitivity to changing lighting conditions.
Possible improvements include:
- dynamically calibrating the infrared threshold before each run
- sampling multiple readings rather than relying on a single instantaneous value
- adding filtering to reduce sensor noise
- improving line-detection logic to prevent duplicate counts
- validating thresholds under several lighting conditions
- creating a more robust transition between line-counting and stopping behaviors
- testing repeatability across multiple robot units
- improving hardware mounting so sensor orientation remains consistent
Key Takeaways
Roll Call was one of my first experiences building a complete autonomous mechatronic system, and it showed me that working code is only one part of reliable robotics.
A control algorithm can behave exactly as intended while the overall system fails because a sensor is misaligned, hardware differs between units, or environmental conditions change the input values.
The project introduced me to Arduino programming, sensor integration, threshold-based decision making, and physical debugging. More importantly, it taught me to treat hardware testing and calibration as part of the design process rather than something that happens after the code is finished.
