Autonomous Loader Project, MREN 103
A small scale, ItsyBitsy microcontroller powered loader capable of autonomous line-following and object moving
Introduction
This project was completed inside of the first-year, second-semester Queen's mechatronics design course class, MREN 103. My classmate Ethan and I were given a frame of a loader at the start of the second half of the semester and were led through how to develop the hardware and software of the vehicle in labs. Our final task of the semester was to demonstrate that our loader could navigate a track and carry small plastic pieces with a closed-loop algorithm.
Development Process
We started with the frame of the loader, which includes an ItsyBitsy M0 Microcontroller, a breadboard, a 150mAh battery, two servo motors that drive wheels, two servos that drive the bucket movement mechanism, an infrared range sensor, two line-following infrared sensors and some other components. It looked like this:
We started out by trying to navigate the loader in a straight forwards and backwards line. This proved to be a challenging task because the servo motors reacted differently to the analog signals from the microcontroller; when we gave the same analog pulses to both servos one would operate at a different speed than the other. Luckily we were able to correct for this by making one analog pulse a little bit smaller than the other to effectively calibrate the wheel rotation speeds.
Once we had the straight line driving figured out without line following, it was time to work with the QRE113GR infrared sensor to implement line following. We figured out that the infrared sensor will give a very low analog voltage (0.2V) reading if it is over a white surface, and a higher reading (2.8V) if it was over a black surface. We had two IR sensors to work with, and developed a simple algorithm that drives straight if both readings are low (IR sensors are straddling the line), turns left if the left sensor is high and the right sensor is low (loader is on the left side of the line) and turns right if the right sensor is low and the left sensor is high. We also figured out that the sensors get the greatest current readings when they are at a distance of about 0.7mm, so we had to make sure that the standoffs holding the blue IR sensor PCB were adjusted to be as close to 0.7mm as we could get. The below graph shows the current readings as a function of distance from their objects.
Next, we calibrated the Sharpe infrared sensor which is mounted on the front of the loader to help make sure that the loader doesn't crash into anything it isn't supposed to.
We gathered analog readings from the Sharp as a function of distance to get a ballpark of how sensitive the response was from the sensor. We used this to get an idea of what voltage signal threshold would be best to allow the loader to get close enough to objects without hitting them. We decided that we wanted around 10cm of stopping safety and a threshold of 2400-2600mV was sufficient in achieving this task.
With all the sensors figured out, it was time to develop a linkage mechanism to control the bucket so the loader could lift stuff. We used Linkage, which is a pretty primitive yet effective application that allows you to design and simulate linkages. We sketched up a simple design and simulated it in the software. The photos below show the highest and lowest points of the bucket in the mechanism.
And below, you can see the bucket attached to the bot. A curl link was also added to the bucket to make dropping things a little more convenient.
Final Demonstration
With line following, bucket actuation, and IR sensors calibrated the last thing to do was compile the closed-loop procedure we were instructed to follow into one big Arduino document. While I can't share the actual code on here, I can show the loader traversing the track with no human controls.
Video can’t be displayed
This video is not available.
Takeaways
Power Matters (A Lot!) - We noticed that the speed and responsiveness of the servos and sensors decreased over time. The small LiPo batteries we were using often dropped in voltage pretty quickly, leading to critical performance delays. When designing any battery powered robotic system it is important to ensure that the batteries that are being used will last long enough, and more importantly output maximum wattage for as long as possible during its lifespan
Closed Loop is Hard - Closed loop control of any type is difficult because the algorithm has to be ready for any possible situation that it can be thrown into. In our case, sometimes the closed loop control would fail because the robot would sense something that would lead it to think that it was in a different part of the procedure than it actually was, and consequently exhibit the incorrect behaviour.
PID - The line following for this project would have been an awesome application for PID; if only we had known about it then!