Go Down

Topic: Robot Debugging (Read 616 times) previous topic - next topic

iprogramer7

Hi,

I am programming a line following robot using six digital sensors which give a reading of 1 on black and 0 on white.
The six sensors are placed like this:
l3 l2 l1 r1 r2 r3

1) I have found that sometimes the sensors give invalid readings:
On black will give 0 and on white will give 1

This is the code I used to check the states of the sensors in this case:
(the sensors are initially all on the black line and have a value of ==1 and have now moved to the white area and become ==0)

else if (!(s_l1 == 1 && s_l2 == 1 && s_l3 == 1 && s_r1 == 1))
  {   
    Serial.println(s_r1);
    Serial.println(s_l3);
    Serial.println(s_l2);
    Serial.println(s_l1);
    Serial.println("exit loop");
  }

Theoretically, I should get a 0000 from all four sensors as they have moved to the white area, but I am getting a variety of different readings:
0101,0001,1001,0000,0100 etc

Any idea why this is happening?

2) I have an LED turning on and off once a specific condition is fulfilled. Yesterday it was shining brightly once turned on, but today it's very dim.
There is a battery giving power to the robot, I thought it might be because of the change in charge, but I have charged it fully and still the LED is shining dimly. (Someone suggested it might be short circuiting..?)
Any ideas as to why the brightness level has changed and how I can fix it?

Any help will be greatly appreciated!

PaulS

Quote
Any idea why this is happening?
Without knowing anything about the sensors? Without knowing anything about how they are shielded from ambient light? Without knowing anything about ambient lighting conditions? Without knowing anything about how close the sensors are? Without knowing anything about the reflectivity of the surface the line is on/not on?

No.


TomGeorge

#2
Mar 25, 2016, 08:26 am Last Edit: Mar 25, 2016, 08:27 am by TomGeorge
Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Can you please post a copy of your sketch, using code tags?
They are made with the  </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Can you post some pictures of your line follower please?


Thanks.. Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

Go Up