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

In summary, the conversation discusses the use of an Arduino to create a line-following robot. The individual is considering using a LDR but is unsure where to start. They mention participating in an Arduino contest and want their robot to follow a black or white strip on the ground to carry paper from a printer to a desk. They also mention using two servo motors to turn the robot and ask for tutorials or resources. Another individual suggests checking out the Instructables site. The conversation then shifts to discussing a similar project done with a Lego Mindstorm RCX, where different shades of grey were used to create commands and a speed track was used to allow for drifting. Turning was achieved by turning off or slowing down motors, and the project was done
  • #1
RaulTheUCSCSlug
Gold Member
179
27
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
  • #2
Have you tried the Instructables site? There are a bunch of Arduino projects. Maybe you can find one that will get you started.
 
  • #4
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
  • #5
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!
 
  • #6
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:

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

1. What is an Arduino Line Follower Robot?

An Arduino Line Follower Robot is a type of robot that uses an Arduino microcontroller to follow a line on the ground or a track. It typically consists of a chassis, motors, wheels, sensors, and an Arduino board.

2. How does an Arduino Line Follower Robot work?

An Arduino Line Follower Robot works by using sensors, such as infrared or light sensors, to detect the contrast between the line and the ground. The sensors send signals to the Arduino board, which then processes the information and controls the motors to steer the robot along the line.

3. What are the advantages of using an Arduino Line Follower Robot?

Some advantages of using an Arduino Line Follower Robot include its low cost, flexibility, and ease of programming. Arduino boards are affordable and widely available, and can be easily programmed using a simplified programming language. This makes it a great option for beginners and hobbyists.

4. What are some potential applications of an Arduino Line Follower Robot?

An Arduino Line Follower Robot can be used in a variety of applications, such as in automated production lines, warehouse and inventory management, and even in educational settings. It can also be modified for tasks such as detecting and avoiding obstacles, or following more complex paths.

5. How can I build my own Arduino Line Follower Robot?

To build your own Arduino Line Follower Robot, you will need to gather the necessary components, such as an Arduino board, motors, wheels, and sensors. You can then follow online tutorials or guides to assemble the robot and program it using the Arduino software. It may require some trial and error, but it can be a fun and rewarding project.

Similar threads

Replies
2
Views
2K
Replies
6
Views
13K
  • Mechanical Engineering
Replies
5
Views
984
  • Differential Geometry
Replies
1
Views
2K
  • General Engineering
Replies
19
Views
10K
Replies
16
Views
3K
  • Sci-Fi Writing and World Building
Replies
1
Views
3K
  • Sci-Fi Writing and World Building
Replies
2
Views
2K
  • Computing and Technology
Replies
13
Views
2K
  • Electrical Engineering
Replies
1
Views
6K
Back
Top