|
Post by 011235813 on Aug 4, 2014 21:21:18 GMT -8
|
|
jody
New Member
Posts: 7
|
Post by jody on Aug 5, 2014 16:29:34 GMT -8
I have tested out the advanced line following code. I was able to get it to work after I changed the AA batteries. The Pi-Bot goes through batteries quite quickly when running the line following program, and obstacle avoidance programs. I am running my 3rd set of AA batteries, and now I need to change out the 9v battery.
|
|
|
Post by Mel on Aug 5, 2014 23:19:25 GMT -8
Hi Jody - Sounds like you are working a lot on your Pi-Bot a good amount of time We are currently working on a rechargeable battery pack for the Pi-Bot which we know is a needed next step.
|
|
jody
New Member
Posts: 7
|
Post by jody on Aug 6, 2014 8:51:32 GMT -8
Hi Jody - Sounds like you are working a lot on your Pi-Bot a good amount of time We are currently working on a rechargeable battery pack for the Pi-Bot which we know is a needed next step.
|
|
jody
New Member
Posts: 7
|
Post by jody on Aug 6, 2014 9:00:06 GMT -8
Having rechargeable batteries is a great idea. Does it make sense that my 9v already needs replacement? I was only working on my Pi-bot for a couple of hours yesterday. Aaron and I really enjoyed testing out the line following code with the piBot. Aaron laid out a complex black line course with several branches, each time the robot was tested it took a different path. I have a short video I can share.
|
|
|
Post by lavanyajawa on Aug 6, 2014 10:05:25 GMT -8
Hi Jody - Consumer batteries are rated for A-h (amp-hours). They are typically given a constant load, and are considered dead when the output voltage reaches about 60% of the specified voltage. That would be 5.4V for a 9V battery. However, 9V battery with a 25mA load is dead when it gets becomes 7V. I would recommend using a multimeter to check your batteries! Also, be sure to disconnect your 9V when you are not using it! We would LOVE to see a video! Please post a link to it
|
|
|
Post by jrd210 on Aug 6, 2014 15:27:16 GMT -8
Thanks to the ladies for fantastic response. I had emailed saying the line following was wobbly and bingo there is a new line following program plus alteration to the manual. May I add the suggestion that with 9v batteries going flat quickly the solution may be from my RC plane experience Get rechargeable Lipo (or better still Life) batteries rated at 7.4 for Lipo or 9.9v for Life. It will take a triple cell (3s) Lipo I am pretty sure as the Arduino can take 12v input but Melissa may have a comment on that, either way RC rechargeables are the way to go. HobbyKing is a great sure but they take a while to get delivered. The new line following is great and the only problem I have is when the line gets a little close to the edge of the board then Pi-Bot goes for a walk and sulks. Thx again for a very rapid response. I hinted at a forum and there is one within days (?Telepathy).
|
|
|
Post by jrd210 on Aug 11, 2014 6:39:55 GMT -8
Running a Turnigy 6.6v Life battery, fits on back nicely, installed a small RC motor switch on top of it. Runs the Pi-Bot fine. It will stay in place as these are safe to recharge in situ. However you do need a LIFE charger and not all Lipo chargers will do LIFE batteries, but for anyone already in RC hobby this might be a good solution to stop wearing out 9v batteries.
|
|
|
Post by jrd210 on Oct 31, 2014 11:30:34 GMT -8
Question on ADV Line Following code, how can I change the speed of the motors within the software code??
|
|
jasea
Junior Member
Posts: 53
|
Post by jasea on Nov 5, 2014 2:55:20 GMT -8
Hi jrd210, I had hoped that someone from the staff would have answered this question for you. I have looked through the code, and this is a good example of why you should always comment your code! The simple answer is to look for a line " fast= 80000. / (float) batVoltage; " towards the forever loop within the Loop() function. This sets the value of fast at about 86. This is then used as a PWM value in the " forward (int speed1, int speed2) " function. The values of speed1 and speed2 should be between 0 (stop) and 255 (full speed). So to change you speed you need to manipulate the speed1 and speed2 variables. I have added some comments to the code and hope that this will help you, but note these are my interpretations and my not reflect the intended design of the original author.
Regards
John
// AdvancedLineFollowing.ino
const int Line1 = 7; // Left Line Sensor const int Line2 = 8; // Center Line Sensor const int Line3 = 10; // Right Sensor
const int In1 = 3; // In1 const int In2 = 5; // In2 const int In3 = 6; // In3 const int In4 = 11; // In4 const int batPin = A0;
#define num 6
void setup() { // initialize the pins pinMode(In1, OUTPUT); pinMode(In2, OUTPUT); pinMode(In3, OUTPUT); pinMode(In4, OUTPUT); pinMode(Line1, INPUT); pinMode(Line2, INPUT); pinMode(Line3, INPUT); Serial.begin(9600); }
void loop() { int rLED[num], cLED[num], lLED[num]; // create Integer arrays int lSum, cSum, rSum; int fast; int speed1; int speed2; float scale1, scale2, scale3; boolean debugPrint; int L1, L2, L3; int batVoltage; for(int i=0; i<num; i++) { rLED=0; // set all variables in array to 0 cLED=1; // set all variables in array to 1 lLED=0; // set all variables in array to 0 } rSum = 0; cSum = 0; lSum = 0; //************ Turn on debuging here **************** debugPrint = true; // debugPrint = false; //*************************************************** delay(100); forward(0, 0); // stop the motors
while(1==1) // do for ever but why have a for ever loop within the loop() routine? { batVoltage = analogRead(batPin); // read battery voltage this should give a value of about 921 for a good 4.5 battery pack L1 = digitalRead(Line1); // read the value of the Left Line Sensor 0 white or 1 black L2 = digitalRead(Line2); // read the value of the Center Line Sensor 0 white or 1 black L3 = digitalRead(Line3); // read the value of the Right Line Sensor 0 white or 1 black
if ((L1 == 1) && (L2 == 1) && (L3 ==1)) // all sensors reading black { speed1 = 0; // Set speed to zero speed2 = 0; // Set speed to zero forward(speed1, speed2); // Stop the PiBot if(debugPrint) { Serial.println("In Lift Mode"); // I guess that this means that the Pi-Bot has been picked up } } else if ((L1 != 0) || (L2 != 0) || (L3 !=0)) // If any of the sensors are reading black i.e. have a value of 1 // all sensors reading black will have been caught by the proceeding if statement { rSum = 0; cSum = 0; // set the Sum values to 0 lSum = 0;
for(int i=0; i<num-1; i++) { rLED=rLED[i+1]; // move values up one variable in the array cLED=cLED[i+1]; // this is to keep track of the last “num” (6) readings lLED=lLED[i+1]; // to be used for setting the speed of the Pi-Bot } rLED[num-1]=L1; // copy the value from the Left line sensory into the last variable of the array cLED[num-1]=L2; // copy the value from the Center line sensory into the last variable of the array lLED[num-1]=L3; // copy the value from the Right line sensory into the last variable of the array for(int i=0; i<num; i++) { rSum = rSum + rLED * (8-i); // for each of the values in the sensor arrays a weighting factor is applied cSum = cSum + cLED * (8-i); // such that the oldest is multiplied 8 and the newest by 3, and then the values are totaled. lSum = lSum + lLED * (8-i); // so for a sensor that is reading black all of the time the value would be 33 } if(debugPrint) { Serial.print("L1: "); Serial.print(L1); Serial.print(", L2: "); Serial.print(L2); Serial.print(", L3: "); Serial.println(L3); Serial.print("rSum: "); Serial.print(rSum); Serial.print(", cSum: "); Serial.print(cSum); Serial.print(", lSum: "); Serial.println(lSum); } scale1= (float) rSum + (float) cSum; // the scalex variables are set using a combination of the sum of sensor variable created above scale2= (float) lSum + (float) cSum; // I do not understand why they are being cast to floats as all variables and their values are scale3= (float) lSum + cSum + rSum; // integers
fast= 80000. / (float) batVoltage; // I do not understand this line // If it supposed to be setting fast to 80000 divided by the result of the analogread // of the battery voltage on pin A0, which returns a value of 0 - 1023 then why cast it as a float? // float? fast is defined as an integer // I think that the variable fast should be about (80000 / 921 ) 86 which is very slow when // used as a PWM value in the analogwrite of the forward() function below if(rSum > lSum) { speed1 = fast; speed2 = scale2/scale1 * fast; } else { speed2 = fast; speed1 = scale1/scale2 * fast; } forward(speed1, speed2); if(debugPrint) { Serial.print("scale1: "); Serial.print(scale1); Serial.print(", scale2: "); Serial.println(scale2); Serial.print("speed1: "); Serial.print(speed1); Serial.print(", speed2: "); Serial.println(speed2); Serial.print("battery Voltage = "); Serial.println(batVoltage); Serial.print("fast = "); Serial.println(speed2); delay(500); } } } }
void reverse(int speed1, int speed2) { analogWrite(In4, speed1); analogWrite(In3, 0); analogWrite(In2, speed2); analogWrite(In1, 0); return; }
void forward (int speed1, int speed2) { analogWrite(In4, 0); analogWrite(In3, speed1); analogWrite(In2, 0); analogWrite(In1, speed2); return; }
void stopNow() { analogWrite(In4, 0); analogWrite(In3, 0); analogWrite(In2, 0); analogWrite(In1, 0); return; }
|
|
|
Post by jrd210 on Nov 5, 2014 5:55:22 GMT -8
Thanks John, I had figured it was the 80,000 but the extra info and range and sketch will be invaluable. Melissa did answer me by email with the 80,000 tipoff. John D.
|
|
|
Post by jrd210 on Nov 5, 2014 6:19:43 GMT -8
On compiling it fails but only because it is missing in about 10 places--easy to correct.
|
|
jasea
Junior Member
Posts: 53
|
Post by jasea on Nov 6, 2014 0:18:20 GMT -8
Hi John D, Oops, I just did a cut and paste and for some reason odd bits were lost. Sorry. John
|
|
|
Post by jrd210 on Mar 4, 2016 12:21:41 GMT -8
John--did some further experimenting with that 80,000 and found the limit to be 100,000 above that speed there is too much data being processed by the IR and it stops it moving but on mine the 100,000 gives a nicer speed. Of course don't forget like I did a couple of times to switch off the debug or it will not go anywhere.
|
|
|
Post by bbzImarve on Mar 31, 2019 12:34:30 GMT -8
В нашей фирме имеется к продаже БИОЛОГИЧЕСКАЯ ЗАГРУЗКА, Резервуары и емкости цилиндрические (РВС, РГС), Пропеллерные мешалки, Термическая сушка осадков сточных вод, Водоприемный колодец, Коалесцентные модули, Флокуляторы, ОДЪЕМНЫЕ УСТРОЙСТВА И МЕТАЛЛОКОНСТРУКЦИИ Ленточный конвейер, ВОДООЧИСТНОЕ ОБОРУДОВАНИЕ Комплексы реагентного хозяйства (КРХ), ПОДЪЕМНЫЕ УСТРОЙСТВА И МЕТАЛЛОКОНСТРУКЦИИ Шнековые конвейеры, ОЧИСТКА ЛИВНЕВЫХ СТОЧНЫХ ВОД Песколовки тангенциальные, НАСОСНОЕ И КОМПРЕССОРНОЕ ОБОРУДОВАНИЕ (Грунфос, КСБ, Вило, КИТ, Взлёт, ТВП) Колодезные насосы, ВОДОПОДГОТОВКУ Установки фильтрации и предподготовки, а также все для автомойки Система очистки воды для автомоек. У нас вы найдете Ремонт очистных сооружений, а также ббз, мы можем произвести Строительство кессона. Бурение артезианских скважин, Геологическое изучение недр, Монтаж водоснабжения. В Сервисе диагностирует скважины, производит Монтаж канализации. дегидратор осадка и еще ббз <a href=https://bbzmsk.ru>блок биологической загрузки ббз 45</a>
|
|