Purpose:
The purpose of this project was to continue our development
of ever more advanced robots. This was our first autonomous robot that required
making a customized printed circuit board and building an Arduino shield. Unlike our
last project, Line Bot was designed to be completely independent. However a
difference from our last project is that Linus has more of a brain. In stead of
being fed a sequence of premade code and simply preforming the task Linus
has been provided with a method of seeing and based on what he sees,
multiple decisions to accomplish his overall goal. His overall goal being to
follow a drawn line of any shape. Along with giving us another opportunity to
make our own circuit board the Linus project gave us the rare opportunity to
create an Arduino shield. Creating an Arduino shield gives the project an added
level of sophistication and also forces you to find the most effective layout
for your parts.
Parts List:
Photo Gallery:
Top of shield
Bottom of shield
Top of sensor board
Bottom of sensor board
Front view of Linus
Bottom view of Linus
Sensor breadboard
Failed ciurcuit boards
This project was the largest project we have done all year. Because of that, it was divided up into three parts. My ER will be designed in the same way to give the maximum amount of information in the most comprehensive way.
Quantity
|
Part
|
Description
|
1
|
Magician Chassis Kit
|
|
1
|
L293D Motor chip
|
|
5
|
TCRT5000L Sensor
|
|
5
|
150 Ω Resistors
|
|
5
|
1000Ω Resistors
|
|
7
|
Male Pin Headers
|
|
10
|
Female Pin Headers
|
|
1
|
Copper board
|
|
1
|
Arduino shield
|
|
1
|
6-cell battery pack
|
|
6
|
AA batteries
|
|
10+
|
Wires
|
Photo Gallery:
Top of shield
Bottom of shield
Top of sensor board
Bottom of sensor board
Front view of Linus
Bottom view of Linus
Sensor breadboard
Failed ciurcuit boards
This project was the largest project we have done all year. Because of that, it was divided up into three parts. My ER will be designed in the same way to give the maximum amount of information in the most comprehensive way.
Stage 1:
Stage 1 consisted of acquainting ourselves with the TCRT5000L IR Sensors. We will be using a collinear bank of 5 TCRT5000L sensors to ensure Linus stays on the track. After looking at the TCRT5000L datasheet we wired up a test circuit that takes the analog output from each sensor and displays its raw value to the serial monitor. After we were reading one sensor we then wired up the other four and formatted the serial monitor so that we could see all five simultaneously.
The next task in stage 1 was to design a circuit board that will hold 5 TCRT5000L sensors, their corresponding resistors and seven male pin headers. We used EAGLE to design our circuit board, and after developing the schematic and board layout we double-checked everything and our final board design ready to go.
*IMPORTANT*
When printing out your final EAGLE board image remember that you will be mirroring it on your piece of copper. When making a board that will be soldered on the top (like this one) you DO NOT need to mirror it in the EAGLE program. This mistake cost us a number of circuit boards.
Stage 1 consisted of acquainting ourselves with the TCRT5000L IR Sensors. We will be using a collinear bank of 5 TCRT5000L sensors to ensure Linus stays on the track. After looking at the TCRT5000L datasheet we wired up a test circuit that takes the analog output from each sensor and displays its raw value to the serial monitor. After we were reading one sensor we then wired up the other four and formatted the serial monitor so that we could see all five simultaneously.
The next task in stage 1 was to design a circuit board that will hold 5 TCRT5000L sensors, their corresponding resistors and seven male pin headers. We used EAGLE to design our circuit board, and after developing the schematic and board layout we double-checked everything and our final board design ready to go.
*IMPORTANT*
When printing out your final EAGLE board image remember that you will be mirroring it on your piece of copper. When making a board that will be soldered on the top (like this one) you DO NOT need to mirror it in the EAGLE program. This mistake cost us a number of circuit boards.
Stage 2:
Stage 2 was
creating the L293D motor shield and consisted of three subparts. Part 1 was the
hardware side, part 2 was the software side and part three was the creation of
the motor shield.
Part 1:
In order to
make a successful motor shield you need a successful prototype. Part 1 was
creating a prototype circuit that will be capable to run the wheels in a set
sequence using the L293D motor chip. The L293D chip provides us with
bidirectional motor control and will drive currents up to 600mA at voltages
from 4.5V to 36V. In order to complete this task, we were given the L293D datasheet along with the sequence that we had to run. Because we were trying to
finish the project in a set amount of time we were also given a “cheat sheet”
that told us in detail how to wire the chip correctly. When it was wired
correctly it was time to develop the code that will run the sequence.
We first
downloaded this Arduino sketch and filled in the missing statements to satisfy
the desired sequence. The Arduino sketch makes use of an L293D library that we had to write. If you do not know how to write a library click here to go to an Arduino page on how to write one. After writing the library, we put it in the correct folder and ran
the sketch.
*TIP*
My sketch required a little tweaking because the sketch said my
Arduino.h library was missing. If this happens to you, save your sketch folders
to your desktop, delete the Arduino program and reinstall it.
The final
part was to take our prototype and develop a motor shield. For this we used a
Fritzing image as a guideline and simply soldered our prototype into our shield
with the exception of adding a few male and female headers.
Stage 3:
Stage 3 was
the final assembly of Linus and the culmination of a months work. After
assembling our magician chassis, mounting our circuit board, a 6-celled battery
holder, attaching our motor shield and uploading our modified software, Linus
was ready to be tested. An important note is that EVERY TIME before using Linus
it is best to calibrate his sensors. This requires displaying the raw and
adjusted readings from the sensors to the serial monitor and modifying and
minimum and maximum values in the sketch. Finally we made our track and tested
Linus. See the results for yourself.
CODE:
Conclusion:
In conclusion I think that this was the best project we have done to date. It incorporated building circuit boards, creating shields and developing wiring techniques along with allowing us to make specific hardware decisions. It also taught us new skills like making an Arduino library through .h and .cpp files and incorporating them into our sketch. The sketch was also pretty complex and when finished allowed for easy adjustment (specifically for faster calibration). It was also by far the best group project we have done. The people who needed to, put the required work in and we seemed to flow nicely as a group. We also had productive group talks about problems, solutions and adjustments that only lead to good changes. Even though this was our most successful group project, I still feel that people need to monitor the amount of work they are contributing. Just because your part of the project is done does not mean the project is finished. Overall the project in my mind was a success. The fact that we built the circuit and shield from scratch is a huge bonus in my mind and I look forward to all future circuit building.
CODE:
Main Sketch:
We took the code for our LineBot sketch from the Arduino Robotics
book. After downloading and breaking down the code we started testing linus.
The first step was to set up min and max values for each sensor. We did
this by putting each sensor one at a time on the black line and recording its
raw value as its min. Then we put the sensor on pure white paper and recorded
its raw value as its max. Then we set the lower, middle and upper thresholds
that will later dictate the speed of the motors. Now comes the most important
step. The mapping. We took the min and max of each sensor and mapped it from 0
to 255. Because the sensors display a value between 0-1023 we are required map
the values between 0-255 so that we can relate them to the pwm of the wheels.
The second most important piece of code is the constraining of the converted
sensor reading. After converting the sensor values to pwm we need to constrain
the values to be between the lower and upper thresholds. This new value is
called the adjusted value. Linus bases his movement off of the center sensor.
If the center sensor’s adjusted value is less than the lower threshold Linus is
on the black line. To make sure Linus is on the black line, he checks to see if
his sensors on either side are above the middle threshold (reading white). If
they are, then Linus will drive forward. Linus drives based on constantly
checking his sensors in this fashion.
L293D Library:
A library is made up of two files. It is made up of a .h file and
a .cpp file. L293D.h file contains the names of the methods used as well as a
list of the variables. The L293D.cpp file contains the actual code that would
be inside the method and makes use of the variables defined in the L293D.h
file. So without the .h library nothing would have a name, therefor nothing
would exist and without the .cpp file nothing would know what to do, therefor
nothing would happen. If you want to use the library you must create a library folder inside of the main Arduino folder. Then make a folder within the library folder with the name of your library. Finally drag and drop your .h and .cpp files inside the folder with your libraries name. Here is an example, Documents-->Arduino-->libraries-->L293D-->L293D.h L293D.cpp
In conclusion I think that this was the best project we have done to date. It incorporated building circuit boards, creating shields and developing wiring techniques along with allowing us to make specific hardware decisions. It also taught us new skills like making an Arduino library through .h and .cpp files and incorporating them into our sketch. The sketch was also pretty complex and when finished allowed for easy adjustment (specifically for faster calibration). It was also by far the best group project we have done. The people who needed to, put the required work in and we seemed to flow nicely as a group. We also had productive group talks about problems, solutions and adjustments that only lead to good changes. Even though this was our most successful group project, I still feel that people need to monitor the amount of work they are contributing. Just because your part of the project is done does not mean the project is finished. Overall the project in my mind was a success. The fact that we built the circuit and shield from scratch is a huge bonus in my mind and I look forward to all future circuit building.
google-site-verification: googlec2186f523c59381c.html