Go Down

Topic: Interrupt (again... sorry...) (Read 1 time) previous topic - next topic


Aug 22, 2009, 08:59 pm Last Edit: Aug 22, 2009, 09:02 pm by dev_000 Reason: 1
I am sorry to start up this topic again...
I am doing basic line follower. so i need to continously take input 4m input sensors and process it and use it to change direction and speed of motors. and I also need to chk continously 4m an another sensor to start or stop the vehicle.
so can I get some help in programmin this?? I mean i have to use multi threading rite? so Ihave to use Interrupt?  but I am not understanding how to do this. any good examples to understnd this? or is there something else i can do to implement the things mentioned above? Interrupt page in arduino help hasnt helped much.
I havent started coding yet thought to get a better idea abt this before starting...
I have to add a couple of delay functions also... but need to process some data during that period also....
plz someone can help??
thanx in advance... :)


Almost none of our line followers in the WCRS use interrupts.

Basically, you have a processor running at 16MHz, and as such you can check all of your sensors quickly enough inside loops that it is not mission critical to grab an interrupt.

We also typically use the QRD1114 sensor to detect the line, and we read it on the analog inputs so that the white/black levels can be calibrated in software.

You almost never truly need the delay function.. have a look at the blink without delay example.

Start this project by building everything except motor control.  We'll usually throw a couple of LED's on the motor driver at first to make sure we get bugs out of the system.

You'll be able to guide it by hand and examine behavior from your sensors, and watch output on the LEDs.

Get that to behave properly, and then add the motors into the mix.  From that point on, you're tweaking not debugging ;)


thanx....  :)
u seem to be pro in robotics. I am just a newbie just gettin up and runnin...  :) are u sure that i wont be needing interrupts? I am using 5 sensors and how do i determine clock cycle? I am not sure if its 8Mhz or 16 Mhz. I am using an old Atmega 8 arduino board. since u might have programmed many line followers will the size of usual line follower exceed 8Kb? coz i got a memory of only 8kb in atmega 8.  :-?
any other useful info or tips u may suggest to a newbie like me?  ;)
any useful links?


Aug 25, 2009, 07:27 am Last Edit: Aug 25, 2009, 07:30 am by brutus1975 Reason: 1
8K should be lots of room.

even at 8Mhz, you have loads of time.

We have 'bots using ATMega8L's using Internal 1 Mhz clock and 5 line sensors with no issue.

1 MHz = 1million instructions per second.. even if you end up with a 1000th of that due to your code, that still means 1000 loops per second.  8 Mhz.. fah-get-about-it.

That is a ton of checking, and typically you'll end up making a decision and then ignoring input for about 50-100ms otherwise you end up overreacting to sensor input.  (read: we usually have to dumb down the bot to make it react smoother)

A Google search of "Arduino based line follower" is recommended.

Also check and read through THIS site.

Consider joining a local robotics club such as the WCRS


thanx 4 the info... :D btw i got a 16Mhz clock... so i guess that should be enough.... :D
gonna start coding this week.... will update soon....
thanx again... :)

Go Up