Yesterday I finished my Line Follower Robot on Arduino.
As the main controller I took an Arduino Uno board
I have choosen this board because of the multiple shields I can connect to it. One of them is l298p Motor Shield for driving my DC motors:
As the motors I've took the cheapest ones with the 1:25 reductor because I didn't really care how fast my robot will be, I needed just principle working one.
3-12 V and 120 rounds per second.
The other thing I needed is the optosensor which sees the line on the floor.
I've choosen Pololu - QTR-1A Reflectance Sensor
Again, because it's cheap and easy.
To connect all together I took one more shield and it was IO Expansion Shield For Arduino[V7].
And, of course, I needed some board to put everything on it. I've decided to make it by myself by laser cutting from the piece of wood (was not the best idea as I researched later).
There is what I've done:
I put the arduino board on my piece of wood, then connected a motor shield. Connecting my motors took some time because I had to be sure that the Motor 1 is the right one (if I look at the picture I've published), the Motor 2 at the left and both rolling forward (backward if I look this picture). For that experiments I wrote simple example with Arduino IDE which I previously installed on my computer.
This code you can find here.
Then I made a sensor test simple application to know what my sensors return.
I put my sensors on A4 and A5 pins on my top shield watching when I have Ground (squared pin), Vin (connected to 5 v) and Vout (A4 and A5).
I figured out that when it's totally dark (when I push the sensot with my finger it returns 1024 and when it's bright (when I show sensor my monitor white background or my daylight lamp) it's around 10.
That's why I used those values for my calibration function which I wrote to make my robot know how light is my white floor and how dark is the line. I set previos values for light the blackest one and the lightest one for black. Then I moved the robot in my program and said it to use any "lighter" value for light and any "darker" for black.
To make my robot to see the line I wrote a Proportional Regulator using my sensor values and my middle gray values.
k there is a proportional coefficient which I guessed (firstly I've tried some more values and watched how it works).
Here is the full code for my robot.
And here is it :)
As the main controller I took an Arduino Uno board
I have choosen this board because of the multiple shields I can connect to it. One of them is l298p Motor Shield for driving my DC motors:
As the motors I've took the cheapest ones with the 1:25 reductor because I didn't really care how fast my robot will be, I needed just principle working one.
3-12 V and 120 rounds per second.
The other thing I needed is the optosensor which sees the line on the floor.
I've choosen Pololu - QTR-1A Reflectance Sensor
Again, because it's cheap and easy.
To connect all together I took one more shield and it was IO Expansion Shield For Arduino[V7].
And, of course, I needed some board to put everything on it. I've decided to make it by myself by laser cutting from the piece of wood (was not the best idea as I researched later).
There is what I've done:
I put the arduino board on my piece of wood, then connected a motor shield. Connecting my motors took some time because I had to be sure that the Motor 1 is the right one (if I look at the picture I've published), the Motor 2 at the left and both rolling forward (backward if I look this picture). For that experiments I wrote simple example with Arduino IDE which I previously installed on my computer.
This code you can find here.
Then I made a sensor test simple application to know what my sensors return.
I put my sensors on A4 and A5 pins on my top shield watching when I have Ground (squared pin), Vin (connected to 5 v) and Vout (A4 and A5).
I figured out that when it's totally dark (when I push the sensot with my finger it returns 1024 and when it's bright (when I show sensor my monitor white background or my daylight lamp) it's around 10.
That's why I used those values for my calibration function which I wrote to make my robot know how light is my white floor and how dark is the line. I set previos values for light the blackest one and the lightest one for black. Then I moved the robot in my program and said it to use any "lighter" value for light and any "darker" for black.
To make my robot to see the line I wrote a Proportional Regulator using my sensor values and my middle gray values.
k there is a proportional coefficient which I guessed (firstly I've tried some more values and watched how it works).
Here is the full code for my robot.
And here is it :)
No comments:
Post a Comment