102.1 Line following with one light sensor.

5 stars based on 37 reviews

There are many ways to program the NXT robot so it can follow a line. This article presents how to achieve line following using line following robot code nxt robot steering option of the motor block in Lego's G-Code. Lego's tutorial shows a "Bang-Bang" control where the robot either turns left or right depending if the sensor is on a black or white surface.

While being able to follow the line, the robot using this algorithm looks a bit drunk. A solution that produces a much better solution is the Fuzzy Logic approach presented earlier. However, only a few students at the primary school level are able to understand and program this algorithm. If the block receives a steering value of zero, the robot goes straight on. For positive values, it will turn to one side and for negative values to the other side.

We want the robot to go straight on when it is exactly on the edge of the black line. Thus, the line following robot code nxt robot the sensor reads when on the edge needs to be subtracted from the current sensor value. Most of the time, the different sensor readings between the black line and the white surface are relatively small. The produced steering is not enough to keep the robot on the line.

To solve that problem, we amplify the value obtained from the subtraction with a constant factor. The best value needs to be found through experimentation. The robot can be any type of robot that has one motor for each wheel. The distance between the sensor and the surface should be around 2 cm. You only need 5 different blocks to implement the algorithm. First put the robot on the white surface and note the value for white Use the "View function of the NXT.

Then put the robot on the black line and note the value obtained for the line. Finally add the two values and divide them by to to build the average value. This is the number that you line following robot code nxt robot put in case "B" of the first math block.

International trade name for exxonmobil logo font

  • Will bitcoin break all time high the short answer is yes

    Ripple xrpelectroneum etn mobile miner update cryptocurrency coinsbitcoin btc crash news

  • Amagi metals litecoin

    Blockchain explained simply irresistible

Caravan exmouth market yelp

  • Trading bitcoin di olymptrade

    Wo bitcoin kaufen schweiz

  • Bitcoin dollar exchange rate historical europe

    Counterparty vs ethereum crypto

  • Blockchain bitcoin explained vimeo

    Bw bitcoin miner

Ep 134 ethereum news fork clients released coinbase etc and eth poloniex security prob drone

28 comments 2015 bitcoin price

Robot power ranger ninja storm game boy

In the following, an improved version, based on Fuzzy-Logic, is presented. The original version by Lego uses the reflected light to distinguish between black the line and white the floor. When the sensor is on the white surface, the right motor is activated and the robot turns left. In this way, the robot follows the line. The approach is very simple and effective. However, as the robot only distingushes between black and white, the resulting movement looks as if it would be drunk.

The idea behind the new version is, not only to distinguish between black and white, but to consider various degrees of grey. If the sensor is exactly on the boundary, it will see a colour that is between black and white. The more the sensor gets on the line, the blacker the perceived colour is. On the other hand, the more the sensor gets on the white surface, the whiter the perceived colour is.

This is called Fuzzy Logic as we do not consider absolute states Boolean Logic, here "Black and White" but different degrees of those states Whiter, Blacker. Now we are not limited anymore to turn only left and right, but can turn more right blacker colour or more left whiter colour. In this way, if exactly on the colour boundary, the robot runs straight ahead.

The program consists of three loops that run at the same time. The first loop reads the current reflected light value and stores it in the variable called "Number 1". The second and third loop control the left and right motors. The reflected light sensor gives a value between 0 and A typical value for a black surface is around 20 and for a white surface something around These values depend of on the ambient right conditions and the distance of the sensor from the surface.

The motor power itself as well is a value between 0 and To produce the motor commands as described in the schema, the following calculations have to be done:. If you program your NXT with the above program, and the robot does not run as expected, check the following:. Original Line Follower Courtesy of Davidin2.