nycjilo.blogg.se

Line follower arduino while loop
Line follower arduino while loop









  1. Line follower arduino while loop driver#
  2. Line follower arduino while loop code#

The program identifies the position of the sensor module by comparing the sensor readings with the reference point that is 945. The median of these two values is 945 and it is set as the reference point for the program to check the orientation of the sensor module. The digital equivalent of 4.4V will be 900 and that of 4.84V will be 990 as per the above scheme. int leftInput = A3 įrom the above table you can see that the voltage across a particular LDR will be 4.4V when it on white and 4.84V when it is on black.

Line follower arduino while loop code#

For example if 3V is applied to A3, the following code will return 3/(5/1023) which is equal to 613 in the variable leftValue. This range can be converted into a digital value between using analogRead () command. The voltage range that can be applied to a particular analog input of the arduino is 0 to 5V. Output of the right sensor is connected to the analog input A4 of the arduino and output of the left sensor is connected to the analog input A3 of the arduino. This is done by reading the left and right sensor outputs and switching the left and right motors appropriately. The arduino board has to be programmed to keep the robot in correct path. Right and left sensor outputs observed while testing the above circuit is shown in the table below. The voltages dropped across the right and left LDRs (nodes marked R and L in the above circuit) are given as input to the analog input pins A4 and A3 of the Arduino board. As a result the resistance of the LDR shoots up and the voltage dropped across it will be high. When the robot is drifted to one side, the sensor in the opposite side falls over the black line and the intensity of light reflected back to the corresponding LDR will be low. So the voltage dropped across the LDR will be low. In this condition sufficient amount of light gets reflected back to the LDRs and so their resistance will be low. When the sensor is correctly aligned, both LED/LDR pairs will over the white surface. Resistors R6, R8, R3,and R5 forms individual voltage divider networks in conjunction with the corresponding LDRs. Resistors R1 and R2 limits the current through the LEDs. The circuit diagram of the sensor is shown in the figure below.

line follower arduino while loop line follower arduino while loop

The resistance of an LDR is inversely proportional to the intensity of the light falling on it. The sensor consists of two LED/LDR pairs with appropriate current limiting resistors.

Line follower arduino while loop driver#

The entire hardware of this simple line follower robot using arduino can be divided into three parts The sensor, Arduino board and the motor driver circuit. Any way the same project can be used to follow the opposite configuration with appropriate changes in the software. This line follower robot is basically designed to follow a black line on a white surface. Line Follower Robot using Arduino – DIY Electronic ProjectĪ line follower robot using 8051 microcontroller is already published in CircuitsToday and this time the same project is rebuilt using arduino. A line follower robot is a very basic project to start with, when you are learning a new micro controller like 8051 or AVR or PIC. In this arduino project, we are detailing a line follower robot using arduino, a couple of LDR sensor pair, and two motors.











Line follower arduino while loop