Creating a Line Following Robot with Arduino and Mindstorms: A Six Sigma Project

AI Thread Summary
The discussion centers on building an Arduino line-following robot for an office contest, utilizing sensors to detect a colored strip on the ground. The user considers using a light-dependent resistor (LDR) and seeks guidance on motor control for turning, suggesting the use of two servo motors for maneuverability. Participants share insights from their experiences, including a detailed explanation of a similar project using Lego Mindstorms, which involved programming for various commands and motor adjustments for turning. Key strategies discussed include using different shades of tape for line detection and implementing correction sequences to maintain tracking. Overall, the thread emphasizes the importance of sensor calibration and motor control for effective line following.
RaulTheUCSCSlug
Gold Member
Messages
179
Reaction score
28
I'm looking to build an Arduino that is capable of following a line depending on a colored strip on the ground, either black or white. I think I might use a LDR, but not quite sure where to even start to be honest. My office is having an Arduino contest, and I just want the Arduino to carry paper from the printer to a desk by following a path.

Basically I'm thinking of this:

Arduino reads sensor, if sensor comes back as less 0, then Arduino stays stationary, if comes back with 1, then Arduino turns on motor. Here's the tricky part, I want it to curve around corners but have no idea where I would even begin, probably by connecting two servo motors so that one rotates faster than the other and it turns?

Thanks, if anyone knows of any tutorials or anything online, I would love to look at them. I am fairly new, so some of the tutorials I've looked at have had me kind of stumped.
 
Computer science news on Phys.org
Have you tried the Instructables site? There are a bunch of Arduino projects. Maybe you can find one that will get you started.
 
I did a similar thing with a Lego Mindstorm RCX back in 2002. The "brick" was oriented to near vertical to reduce the angular inertia about the yaw axis. The small wheels are in the back, with the sensor extended about an inch in front of the brick (can't be seen in photos). In the second attached image, the bot is moving from left to right. It follows the right side of a dark grey line on a white surface. There were 4 shades of "grey", the white board (white), grey electrical tape (light grey), brown electrical tape (dark grey), and black velcro tape (black and not reflective). The black strips were used for "commands", a single strip was a command to u-turn and continue line following, and two black strips in sequence was a command to stop. The light grey tape was used on a "speed" track to create a wide "boundary" for the line following between white and dark grey, allowing for some drifting at full speed (about 40 cm / s), before making corrections. The dark grey line tape was made wider in the turns to avoid losing track of the line.

The turning was done by initially turning off a motor for coast mode, then if not corrected, stopping a motor for brake mode (and perhaps putting the other motor into coast mode, I don't recall all of the details of the entire sequence). The timing between correction modes was just fixed loops determined by trial and error. U-turns were a canned sequence that started the outside motor forwards, a brief delay, then starting the inside motor backwards, then either going back into line follow mode (strip command) or stop (remote control command). For the strip commands, after a u-turn, the brick went back into line follow mode. The remote controls included forward, stop, left turn, right turn, rotate left, rotate right, u-turn, and begin line follow. The rotates could be continuous spins.
lego01w.jpg

lego03w.jpg
 
Last edited:
  • Like
Likes RaulTheUCSCSlug
rcgldr said:
I did a similar thing with a Lego Mindstorm RCX back in 2002. The "brick" was oriented to near vertical to reduce the angular inertia about the yaw axis. The small wheels are in the back, with the sensor extended about an inch in front of the brick (can't be seen in photos). In the second attached image, the bot is moving from left to right. It follows the right side of a dark grey line on a white surface. There were 4 shades of "grey", the white board (white), grey electrical tape (light grey), brown electrical tape (dark grey), and black velcro tape (black and not reflective). The black strips were used for "commands", a single strip was a command to u-turn and continue line following, and two black strips in sequence was a command to stop. The light grey tape was used on a "speed" track to create a wide "boundary" for the line following between white and dark grey, allowing for some drifting at full speed (about 40 cm / s), before making corrections. The dark grey line tape was made wider in the turns to avoid losing track of the line.

The turning was done by initially turning off a motor for coast mode, then if not corrected, stopping a motor for brake mode (and perhaps putting the other motor into coast mode, I don't recall all of the details of the entire sequence). The timing between correction modes was just fixed loops determined by trial and error. U-turns were a canned sequence that started the outside motor forwards, a brief delay, then starting the inside motor backwards, then either going back into line follow mode (strip command) or stop (remote control command). For the strip commands, after a u-turn, the brick went back into line follow mode. The remote controls included forward, stop, left turn, right turn, rotate left, rotate right, u-turn, and begin line follow. The rotates could be continuous spins.
View attachment 102366
View attachment 102365
Interesting, I've never worked with a Lego Mindstorm, so each different color was able to be given a new function? And how did you account for turning? Did you slow down one of the motors? Or just turn it off?

I always wanted to play around with a mindstorm when I was younger, but could never afford it. Glad I'm an adult now with a bit more cash flow!
 
RaulTheUCSCSlug said:
I always wanted to play around with a mindstorm when I was younger, but could never afford it. Glad I'm an adult now with a bit more cash flow!
This was a fun project in a company sponsored six sigma class (and yes, just like the Dilbert cartoon, there was a prior total quality management class, but the six sigma class had a totally different name).

RaulTheUCSCSlug said:
Interesting, I've never worked with a Lego Mindstorm, so each different color was able to be given a new function? And how did you account for turning? Did you slow down one of the motors? Or just turn it off?
The mindstorm sensor includes it's own red LED emitter, which can be turned on so that external lighting variations don't throw it off and so it can be located close to a surface, such as line following. In addition to the white board, I tested various colors of electrical tape to see the midpoint and range of values returned by the sensor for each of the tapes. Since electrical tape is reflective, I also tested with friction tape which is not reflective (velcro tape would also work), in order to get the lowest (darkest) readings.

For line following correction, there was a sequence of ever increasing correction, but limited to prevent over correction. Turning involved ramping down the inside motor, which included turning it off (coasting) or braking (back emf). The tighter the turn, the slower the mindstorm would move, due to higher cycling rate of correction to follow a curve.

The mindstorm was programmed to follow the right edge of the following line. To prevent the mindstorm from crossing over the left edge of the tape (a failure mode), I used multiple strips to make the following line wider in the turns to give the mindstorm more room for correction. You can see that in the attached images from my prior post.

The mindstorm programming is interesting in that it's parallel programming. In this case there were 4 threads. Main - monitors the sensor for black strips, shuts off tracking when black strip encountered, and determines if one or two strips are present, then either uturns and restarts tracking if one strip detected, or stops if two strips detected. Track - main tracking logic. Slowl - ramp down program for left motor. Slowr - ramp down program for right motor. The 4 threads ran in continuous loops and communication between threads used global variables.

The minimal goal for the class was line following, which only requires detecting two shades of grey (the amount of led light reflected back to the sensor), and using the remote to start or stop the mindstorm. The optional goal was to add track based commands, (in my case I chose u-turn and stop), which would need three shades of grey. In order to set what was a speed record at the time, the fourth shade of grey was chosen to be mimic the reading when the sensor was centered directly over the right edge of the following line (so no turn correction), allowing for some drift on high speed straight sections with minimal correction (the coast mode on inside motor), ending up at a bit over 40 cm/s. Without this fourth shade of grey tape, the regular line following speed was slower due to the rate of cycling between left and right turn correction. Orienting the RCX brick to near vertical greatly improved yaw response time. It was tilted backwards just enough (with some margin) to prevent it from toppling over forward when braking from high speed to a complete stop, although it would straighten up enough to lift the rear wheels off the track (which looked cool).
 
Last edited:
Sorry if 'Profile Badge' is not the correct term. I have an MS 365 subscription and I've noticed on my Word documents the small circle with my initials in it is sometimes different in colour document to document (it's the circle at the top right of the doc, that, when you hover over it it tells you you're signed in; if you click on it you get a bit more info). Last night I had four docs with a red circle, one with blue. When I closed the blue and opened it again it was red. Today I have 3...
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...
Back
Top