Kamis, 11 November 2010

LINE FOLLOWER


Some thoughts on line following floor sensors

While working on my new robot, Dilbert II, I was trying to figure out a better way to implement line following. Traditional line followers typically use two sensors, one on each side of the line. When the robot veers off to one side or another, the sensor is triggered and changed the direction of the robot. This on-off behavior is clearly seen with line followers that wiggle back and forth while they run down the line. In all my floor sensor projects I used inexpensive photo-reflexive detectors from Digikey, #QRD1114QT-ND
The photo, below, shows the centerline sensors on Dilbert. The two outer sensors are a bit more than ¾” apart so that they straddled the “line” of the 1999 Robothon Line Following Contest.
.
For Dilbert I implemented a seven state line following sensor using some tricky logic: Centered (only the center sensor active), a little to the left or right (center and left or right sensor), Left or Right (left or right sensor only), or a Left/Right a lot (e.g. no sensor active after just the left/right sensor active).
This arrangement worked pretty well: it allowed Dilbert to move pretty fast and correct his path appropriately depending upon how far off line he was. Because of the discrete nature of the feedback signal, Dilbert still had minor control problems and would wiggle down line segments that were straight.
Fall 2000, I started working on the floor sensors for Dilbert II. The new line following contest would include a maze, so not only would Dilbert have to follow the line, he would have to detect branches, etc.
My first attempt at having a finer level of feedback from the line following array was simply a linear array of sensors. This didn’t work out very well for several reasons. First of all, the emitters for adjacent detectors were spilling over and making the signal for the line position very faint. I was using analog readings and the high/low reading of the center detectors was simply not very good. The second reason was that I soldered in the sensors directly onto my breadboard. It turns out that the heat from the soldering iron was affecting the matching between sensors. I would get unpredictable and wildly varying readings from individual sensors.
.
In an attempt to overcome the second problem (one that affected Dilbert as well) I rebuilt the sensor board with sockets. In this experiment I also separated the left and right branch detectors so that they wouldn’t be affected by the emitters of the center sensors. It turned out that by using sockets the sensors “matched” each other very well. In any case, sockets made it much easier to swap out sensors until I had a nicely matched set.However I still had difficulties with the signal from the center sensor: it seemed that the right and left center emitters were flooding the center detector so that it always was seeing “white”.
While fighting with the configuration of the detectors I noticed that the left and right center detectors, alone, separated by ¼”, and oriented so that the emitter (the light portion of each detector) were to the inside, seemed to do a very good job of differentially detecting the center line. That is, when the line was centered, both read low. When the line moved either left or right, the corresponding sensor would register a signal. So, I tried simply subtracting the A/D value of the left sensor from the right sensor. It turned out to work great. With just two sensors and A/D channels I get a very high resolution error signal for feeding into the line following algorithm. The following is a hand drawing illustrating the signal I get from just two sensors.
The only thing left to do was to figure out how to tell when the centerline disappeared, since in the line maze contest one could run into a T intersection. I solved that by putting in the center sensor, again, but moved it forward so it’s emitter wouldn’t interfere with the line following sensors.
In order to maximize the range of offset that I could read, I needed to adjust the distance of the sensors from the floor. Since the sensors are so unfocused to begin with, moving them farther from the floor caused the return signal to get soft. I finally settled on a distance that gave me roughly 1” of total sensing area (+/- ½”) and little dead band in the center. I used my favorite floor sensor hardware to mount the sensors on Dilbert II: 1/16” brass wire. The wire force fits through the holes in the proto board so I can adjust it up and down as needed.
A side benefit of the differential detection method is that I don’t need to calibrate the sensors! The absolute signal is cancelled out and all I see is the difference. The range of differences will vary with the absolute range, but for the conditions I have seen so far, it has not been a problem.
Now, with the hardware in place I was ready to implement a line-tracking algorithm. Simply put, I set a forward velocity in my robot, read the line sensor, scale the output by some factor and differentially added it to the current position, thus turning the robot slightly left or right. So, if the robot was a bit off to the left, I added the output of the sensor routine to the left wheel position and subtracted it from the right.
/*+ -----------------------------------------------------------------
int GetLineTrackInfo(int scale)

Passed: Integer scale factor XX.XX
Returns: 8.8 number from 0.00 to +/- Scale
Note: 10 bit ADC value, hence divisor of 0x3FF
-*/
int GetLineTrackInfo(int scale)
{

return ((long)(ADC_Channel(LEFTLINE) - ADC_Channel(RIGHTLINE)) * scale) / 0x3FF;
}
Since Dilbert II has acceleration control, just setting a velocity doesn’t mean the robot is moving at that speed. So, rather than just stuffing the offset into the wheel position, as I mentioned above, I looked at the actual velocity of the wheels and used that as the scale factor: In the snippet, below, I use the actual velocity of the left wheel, modify it by a factor, and pass that to the line following routine.
// Adjust track based upon actual velocity, not set point velocity, so that
// the robot can get aligned while accelerating...

d = GetLineTrackInfo(Left.Velocity/FloorData.iFloorScale);
AddToPosition(&Left, d); // Bias drive to correct error
AddToPosition(&Right, -d);
Finally, I needed some code to tell when the signal from the center sensors was valid. The simplest thing to do was to use a fixed threshold and the‘OR’ function: If any sensor of the triad detected the line, I returned valid line
// Hysteresis too hard for center group. Just use simple logic:
// if any are high, then just call the group high.

if (ADC_Channel(LEFTLINE) > FloorData.iThresholdLow ||
ADC_Channel(CENTERLINE) > FloorData.iThresholdLow ||
ADC_Channel(RIGHTLINE) > FloorData.iThresholdLow )
Sensor.b.center_present = TRUE;
else
Sensor.b.center_present = FALSE;
The above algorithms implement a variation of the PID algorithm with respect to line following. The error signal from GetLineTrackInfo() is, very roughly, proportional to the distance off center (well, except at the extremes). That makes for the “P” term. Since the error is added to the drive position, errors are accumulated, or integrated: that makes for the “I” term. PI control is very common in simple velocity control systems and it works quite well forDilbert II. When turning to a new line, he is rarely dead on center, yet when forward motion starts, Dilbert practically snaps to attention dead on center of the line and tracks very true afterwards.

SISTEM PENTANAHAN LISTRIK


SYARAT-SYARAT SISTEM PENTANAHAN YANG EFEKTIFARAT – SYARAT SISTEM PENTANAHAN YANG EFEKTIF

  1. Tahanan pentanahan harus memenuhi syarat yang di inginkan untuk suatu keperluan pemakaian
  2. Elektroda yang ditanam dalam tanah harus :
    • Bahan Konduktor yang baik
    • Tahan Korosi
    • Cukup Kuat
  3. Jangan sebagai sumber arus galvanis
  4. Elektroda harus mempunyai kontak yang baik dengan tanah sekelilingnya.
  5. Tahanan pentanahan harus baik untuk berbagai musim dalam setahun.
  6. Biaya pemasangan serendah mungkin.

PENTANAHAN

Tahanan pentanahan suatu elektroda tergantung pada tiga faktor :
  1. Tahanan elektroda itu sendiri dan penghantar yang menghubungkan ke peralatan yang ditanahkan.
  2. Tahan kontak antara elektroda dengan tanah.
  3. Tahanan dari massa tanah sekeliling elektroda.
Namun demikian pada prakteknya tahanan elektroda dapat diabaikan, akan tetapi tahanan kawat penghantar yang menghubungkan keperalatan akan mempunyai impedansi yang tinggi terhadap impuls frekuensi tinggi seperti misal pada saat terjadi lightningdischarge. Untuk menghindarinya, sambungan ini di usahakan dibuat sependek mungkin.
Dari ketiga faktor tersebut diatas yang dominan pengaruhnya adalah tahanan sekeliling elektroda atau dengan kata lain tahanan jenis tanah (ρ).

TAHANAN JENIS TANAH (ρ)

Dari rumus untuk menentukan tahanan tanah dari statu elektroda yang hemispherical R = ρ/2πr terlihat bahwa tahanan pentanahan berbanding lurus dengan besarnya ρ. Untuk berbagai tempat harga ρ ini tidak sama dan tergantung pada beberapa faktor :
  1. sifat geologi tanah
  2. Komposisi zat kimia dalam tanah
  3. Kandungan air tanah
  4. Temperatur tanah
  5. Selain itu faktor perubahan musim juga mempengaruhinya.

Sifat Geologi Tanah

Ini merupakan faktor utama yang menentukan tahanan jenis tanah. Bahan dasar dari pada tanah relatif bersifat bukan penghantar. Tanah liat umumnya mempunyai tahanan jenis terendah, sedang batu-batuan dan quartz bersifat sebagai insulator.
Tabel dibawah ini menunjukkan harga-harga ( ρ ) dari berbagai jenis tanah.
Tabel. 1
No.
JENIS TANAH 

TAHANAN JENIS TANAH( ohm.meter )  

1.
2.
3.
4.
5.
6.
7.
Tanah yang mengandung air garam
Rawa
Tanah liat
Pasir Basah
Batu-batu kerikil basah
Pasir dan batu krikil kering
Batu
5 – 6
30
100
200
500
1000
3000



TEMPERATUR TANAH

Temperatur bumi pada kedalaman 5 feet (= 1,5 m) biasanya stabil terhadap perubahan temperatur permukaan.
Bagi Indonesia daerah tropic perbedaan temperatur selama setahun tidak banyak, sehingga faktor temperatur boleh dikata tidak ada pengaruhnya.

ELEKTRODA PENTANAHAN

Jenis Elektroda pentanahan

Pada dasarnya ada 3 (tiga) jenis elektroda yang digunakan pada sistem pentanahan yaitu :
  1. Elektroda Batang
  2. Elektroda Pelat
  3. Elektroda Pita
Elektroda – elektroda ini dapat digunakan secara tunggal maupun multiple dan juga secara gabungan dari ketiga jenis dalam suatu sistem.
ELEKTRODA BATANG
Elektroda batang terbuat dari batang atau pipa logam yang di tanam vertikal di dalam tanah.
Biasanya dibuat dari bahan tembaga, stainless steel atau galvanised steel. Perlu diperhatikan pula dalam pemilihan bahan agar terhindar dari galvanic couple yang dapat menyebabkan korosi.
Ukuran Elektroda :
diameter 5/8 ” - 3/4 ”
Panjang 4 feet – 8 feet
Elektroda batang ini mampu menyalurkan arus discharge petir maupun untuk pemakaian pentanahan yang lain.
ELEKTRODA PELAT
Bentuk elektroda pelat biasanya empat perseguí atau empat persegi panjang yang tebuat dari tembaga, timah atau pelat baja yang ditanam didalam tanah. Cara penanaman biasanya secara vertical, sebab dengan menanam secara horizontal hasilnya tidak berbeda jauh dengan vertical. Penanaman secara vertical adalah lebih praktis dan ekonomis.
ELEKTRODA PITA
Elektroda pita jenis ini terbuat dari bahan metal berbentuk pita atau juga kawat BCC yang di tanam di dalam tanah secara horizontal sedalam ± 2 feet. Elektroda pita ini bisa dipasang pada struktur tanah yang mempunyai tahanan jenis rendah pada permukaan dan pada daerah yang tidak mengalami kekeringan.
Hal ini cocok untuk daerah – daerah pegunungan dimana harga tahanan jenis tanah makin tinggi dengan kedalaman.

PENGKONDISIAN TANAH

Bagi daerah – daerah yang mempunyai struktur tanah dengan tahanan jenis tanah yang tinggi untuk memperoleh tahanan pentanahan yang diinginkan seringkali sukar diperoleh. Ada tiga cara untuk mengkondisikan tanah agar pada lokasi elektroda ditanam tahanan jenis tanah menjadi rendah, yaitu :
  1. Dengan membuat lubang penanaman elektroda yang lebar dan dimasukkan mengelilingi elektroda tersebut bahan – bahan seperti tanah liat atau cokas.
  2. Mengelilingi elektroda pada statu jarak tertentu diberi zat-zat nimia yang mana akan memperkecil tahanan jenis tanah di sekitarnya. Zat-zat nimia yang biasa di pakai adalah sodium chloride, calsium chloride, magnesium sulfat, dan coper sulfat.
  3. Dengan Bentonite.
    Bubuk bentonita bersifat mengabsorb air, karena itu dengan mencampur bubuk bentonite, garam dapur dan air maka campuran bentonite tersebut dapat menghasilkan tahanan jenis tanah yang rendah. Dengan menanamkan campuran bentonite tersebut disekeliling elektroda maka tahanan pentanahandapat diperkecil 1/10 – 1/15 kali.
    Komposisi campuran bentonite menurut perbandingan :Bentonite : garam dapur : air = 1 : 0,2 : 2