Shop OBEX P1 Docs P2 Docs Learn Events
laggy movement — Parallax Forums

laggy movement

husiocsihusiocsi Posts: 7
edited 2013-01-22 09:56 in Robotics
Hi!

I'm using a Boe-Bot with BS2. I would like to do a line follower robot, but i got a problem. I use QRD1114 sensors, to recognize the line (i've made the correct circuit). Then i wrote a small and simple program, for the first trying.
I store the sensor's value, and make if statments, to control the motors. My problem is, the movement of the robot is very laggy. Like, i can see each circle of the program. It's movement isn't continuos.
Then is looked after on youtube, and found this: http://www.rabsoft.co.uk/robot.html (on the left, click to the Line follow 3 QTRs) The video shows that the movement is continuos. So i downloaded this program, and I wrote it to my configuration, but it wasn't working. My robot's move was very laggy again.
So, can you help me, how can i fix this problem?

Thanks!

Comments

  • ercoerco Posts: 20,255
    edited 2012-12-25 21:56
    Can you show us a video of your robot and how it's working? That would help.
  • husiocsihusiocsi Posts: 7
    edited 2012-12-26 16:25
    erco wrote: »
    Can you show us a video of your robot and how it's working? That would help.

    Here is the video: https://www.dropbox.com/s/t332516zkeiy9z4/VID_20121227_001325.mp4

    I attach my code (i know it's not so complicated and got faults)

    Maybe the light condition is too bad? If i put a lamp closer to the path, the movement is faster. I use 0.01uF capacitor.
  • W9GFOW9GFO Posts: 4,010
    edited 2012-12-26 17:05
    Try commenting out the DEBUG statement and see if that helps.
  • ercoerco Posts: 20,255
    edited 2012-12-26 21:15
    W9GFO wrote: »
    Try commenting out the DEBUG statement and see if that helps.

    +1
  • husiocsihusiocsi Posts: 7
    edited 2012-12-27 02:43
    erco wrote: »
    +1

    It doesn't help :(
  • agfaagfa Posts: 295
    edited 2012-12-27 16:52
    The RabSoft bot is using a ServoPal. If you're not using the ServoPal that might explain the difference. The ServoPal provides continuous servo pulses based on the last pulse provided by the microcontoller.

    agfa
  • ercoerco Posts: 20,255
    edited 2012-12-27 20:43
    Your QRD1144 sensors are photodarlingtons, but it looks like you're RCtiming them as you would a photocell (which isn't the same) against a cap of what value? Where did you get your circuit from? Show us the circuit. If you're using a too-high-value cap, that will slow down everything.

    IMO you're better off using your sensors as high/low digital sensors (requires proper resistor and contrast values) instead of analog sensors. Much faster read for 3 sensors.
  • husiocsihusiocsi Posts: 7
    edited 2013-01-02 06:09
    agfa wrote: »
    The RabSoft bot is using a ServoPal. If you're not using the ServoPal that might explain the difference. The ServoPal provides continuous servo pulses based on the last pulse provided by the microcontoller.

    agfa

    I don't use ServoPal. I didn't notice, that he uses it.
    erco wrote: »
    Your QRD1144 sensors are photodarlingtons, but it looks like you're RCtiming them as you would a photocell (which isn't the same) against a cap of what value? Where did you get your circuit from? Show us the circuit. If you're using a too-high-value cap, that will slow down everything.

    IMO you're better off using your sensors as high/low digital sensors (requires proper resistor and contrast values) instead of analog sensors. Much faster read for 3 sensors.

    One of my friend created the circuit, but it is the same like this: (except we got 4 QRD1114) http://profmason.com/wp-content/uploads/2007/02/qtilinefollow.pdf
    The values of the resistors and capacitors are the same, like in the pdf.
    I tried to put the 10kOhm resistance, between the white and red outlet (to convert it into digital) but it didn't work. So I use it without the 10kOhm resistance, and use RCtiming.

    If i put a lamp close to the QRD1114 sensors, the movement becomes faster. Maybe the 0.01uF capacitor is too big, and it takes too much time to discharge it (in normal light conditions)? But if QRD1114's phototranzistor detect much more light, it's resistance become less, so discharge the capacitor takes lesser time?
  • ercoerco Posts: 20,255
    edited 2013-01-02 09:17
    I'd say stick with digital. If the 10K resistor didn't work for you, experiment to find a different value which does work. Try a 100K or 1 megohm pot as a variable resistor and measure the voltage at the red wire.

    Also, since you are using bare QRD1114 sensors, you are not married to that particular QTI circuit you reference. You can optimize it for digital read and your particular conditions. You can change the IR LED's series resistor, and you could also change the phototransistor so that it's on the "top" of the voltage divider instead of the bottom, if that gives you a larger voltage range for your line/lighting conditions.
  • ercoerco Posts: 20,255
    edited 2013-01-02 10:26
    I don't have any QRD1114 sensors, but when I get a chance, I'll test these 69-cent sensors I have at home and report back. I'm convinced that nearly any decent GP optoreflector can be used for a simple digital line sensor.

    http://www.goldmine-elec-products.com/prodinfo.asp?number=G18740

    It's just a matter of getting the right resistor values for your particular line conditions, as I noted here: http://forums.parallax.com/showthread.php?144156-CONTEST-Hack-The-Halls!&p=1152269&viewfull=1#post1152269 The sensor outputs an analog signal in response to the amount of reflected IR, and you adjust that range to suit the Stamp's transition voltage (~1.4V) between high & low. This method uses the Stamp as a free comparator.
  • husiocsihusiocsi Posts: 7
    edited 2013-01-18 13:56
    I tried it with 10,20,40kOhm resistors, but i always measure ~5V on the red wire. The measured value doesn't change, when i change the light condition.
  • ercoerco Posts: 20,255
    edited 2013-01-18 19:23
    husiocsi wrote: »
    I tried it with 10,20,40kOhm resistors, but i always measure ~5V on the red wire. The measured value doesn't change, when i change the light condition.

    Something's wrong. Polarity or maybe you have the LED pins instead of the ptx. Take a bare QRD1114 sensor and use a multimeter in ohms mode (200K or so) to find the two pins that give you a variable resistance in response to light (point sensor at a light bulb). Then report back.

    Specs at http://www.sparkfun.com/datasheets/BOT/QRD1114.pdf

    BTW, any chance you blew your LED with too much current (5V without resistor)?
  • husiocsihusiocsi Posts: 7
    edited 2013-01-20 07:14
    In normal light conditions it's resistance is ~40kOhm. When pointing directly to the lamp, it's ~15kOhm. I don't think i blew the LED. I tired an other wiring (http://letsmakerobots.com/node/19030) and here it always gives 0.
  • husiocsihusiocsi Posts: 7
    edited 2013-01-22 09:47
    I solved the problem, thanks for helping!!! :)

    I have to rebuild the circuit, because the guy who created it switched the polarty of the transistor. When i got the circuit, and checked it, i didn't realize this.
    The movement during line following becomes continous.
  • ercoerco Posts: 20,255
    edited 2013-01-22 09:56
    Excellent, congrats and way to hang in there and troubleshoot the problem. Please share some video of your improved line follower when you can.
Sign In or Register to comment.