Introduction
The first article in this series covered the basic design concepts, materials involved in the construction of the rover and some insight on the various hardware components and there placement on the chassis. If you haven't had the chance to read the article it can be found here and while not a prerequisite it may be a benefit to those that are new to the subject.
In this the second installment in the Autonomous Rover series we are going to take a look at the assembled chassis with everything on board that allows it to move around autonomously but with very little smarts. Much like the beloved Mr. Magoo in years past the rover navigates around until it runs into something wherein the Dagu boards current sensing unit detects that the motor(s) are in a stalled state at which point the rover backs up a short distance, turns counter clockwise approximately 90 degrees then
wanders on until it bumps into something else.
For some reason the video doesn't come up as a video but as a download but it plays so I've put in a bug report and until then just click the link and the video comes up in another tab and plays?
Play Robbie_II_mp4.SWF
While this pinball logic is not optimal it is a step in the right direction and provides a way to hone our skills at learning to navigate the rover. In upcoming articles we will get into steering and detection logic which it turns out are very complex subjects and entire books are dedicated to the subject. This phase of the project however allows us to fine tune any mechanical problems and solve any tracking problems that keep the rover from going in a straight line when all 4 wheels are engaged and turning in the same direction.
In each ensuing article of this series we'll be experimenting with different sensors to help the little rover accomplish various tasks such as line following, pre-collision detection and avoidance, etc.. My main criteria in the design and implementation of the rover's hardware is to keep the cost down by fabricating many of the sensors and additional peripherals myself. This will also allow us to learn about the electronics and fabrication methods involved along the way and that's one of the objectives of building the rover as opposed to buying it pre-assembled. However if learning electronics is not on your list of things to do then the pre-assembled sensors can be purchased at most any of the parts stores listed in the Online Stores section.
The Chassis
In the 1st article I showed in the CAD drawing that the batteries should be placed on the bottom tier and the micro controllers would occupy the top tier but when I actually started to assemble the boards I added a cage around the motor battery and found that the logic battery board would no longer fit comfortably on the bottom tier. So I made a small design change and put the logic battery on top with the computer boards, this made it a lot easier to take the battery in and out when it needed recharging anyway. By rearranging the computer boards on the top tier I was able to make space for it. This also gave me the space on the bottom tier to add sensors to the front of the rover if I want to say add photo sensors for line following or whisker sensors for collision detection, etc..
Assembling the 1st tier was relatively problem free once I got the battery thing straightened out. I had standoffs for the DAGU board and the cage around the battery I built out of left over pieces of the PVC but when it came time to attach the top tier to the base I didn't have standoffs tall enough so I started looking online and found some but with shipping the price was ridiculous so I got the engineers hat out and started thinking of a way I could make my own standoffs and came up with what I thought was a pretty decent idea. For each pillar I cut 3 pieces of PVC 2 inches long and about 1/2 inches wide and glued them together. After they had dried I used a 1/4" Forstner bit and drilled holes on one side about 1/3 of the way down from either end and then a smaller hole on each end that intersected with the larger holes on the side. It's a little hard to explain but the image below will hopefully clear up some of the confusion.
As the image above illustrates by using 2 #4-40 screws approximately 1" long and matching nut that I was able to tighten both screws both very firmly. By using 4 of these pillars it made the top tier very stable and rigid. This scheme also makes it fairly easy to remove the top tier when something needs to be done to the bottom tier.
Problems encountered
When I got the rover assembled I had it on blocks to make sure everything was assembled correctly and would run as expected. Everything checked out and I was excited to get it to the floor and do some real navigating (cat chasing). The rover ran as expected but because of the way I attached the motors to the chassis the rover wouldn't track in a straight line so I had to stop occasionally and readjust the alignment
of the motor(s). It ran for about 10 minutes then one of the motors locked up solid and upon investigation found that the gears were loaded with enough cat hair to make a small fur ball in the gear area thus causing the gears to jam. We've got 4 cats of which 2 are long haired so running on the carpet didn't turn out to be such a good idea and will need to find a way to encapsulate the gears so that debris will not enter the gear area. Maybe a piece of tape?, not sure yet I will address the problem later as I have to get another pair of brackets for the motors to hopefully solve the alignment problem.
Another problem I hadn't thought of when designing the rover is how I to wire the motor battery such that it will be easy to get to when recharging is necessary. While I'm addressing that problem I also will add a switch to control power being applied to the Dagu board. In the users manual it states that logic power should be applied to the board before the motor power so there will be a sequence that I will go through when applying and removing power.
I also need to add a push button switch so that the rover, after applying power will not move until a switch is pressed. As it is now I have to hold the rover apply the power then put it down. I hadn't really thought about this during design phase and will add it in the next version. Hey it's a learning process right...OJT!
Hind signt is 20/20
When I bought the motors for the rover I really had no idea of what I would be doing with it so criteria for the purchase was that it be; small, light, high powered thus geared and of a general speed that I could adapt for most purposes. But after some initial runs I found that the motors I chose where a little fast at 360rpm with a 42mm wheel size even though I am using Pulse Width Modulation (PWM) to control the voltage that drives the motors. Looking at a calculation from the first article the speed of the vehicle can be calculated using the formula;
speed = Wheel Circumference * RPM
42mm = 1.65354 inches
Wheel Circumference = 5.19
speed = 5.19 * 320 RPM = 1661.48 Inches/min. or 27 inches/sec
As can be seen this is pretty quick, about right for terrorizing our 4 cats but to fast for doing anything meaningful. But as I mentioned I'm using PWM to control the voltage so we can calculate the rpm by using the duty cycle being used.
rpm = speed x duty cycle%
therefore if we have a 50% duty cycle our new rpm would be;
rpm = 320 x .5 = 160rpm
then we can calculate our new speed based on this new rpm value;
speed = 5.19 * 160rpm = 830.4 inches/min = 13.84 inches/sec
This is all well and good and you might ask why I'm whining about the motors being to fast? Well there is no free lunch as we decrease the voltage delivered to the motors the torque decreases proportionally. This isn't very restrictive if we are running on a flat hard surface, but if we move to carpet or an inclined surface
then we will start having problems. Additionally I am using a feature on the Dagu board that senses the current used by the motors but the range is very narrow making it difficult to program and even harder when the vehicle traverses different surfaces and the voltage varies.
So the upshot of all this is that when you need to have a general idea of what you want to do with your rover before purchasing the motors. In hindsight I should have purchased motors with a slower rpm, say around 100rpm but with the same torque.
Lessons learned in this phase
The Expanded Rigid PVC turned out to be a good choice for the chassis as it's easy to work, can be cut with a razor knife, seems to be fairly rugged and PVC cement welds the parts together very well. I tried using a glue gun to weld some of the pieces together and all I can say is don't waste your time it doesn't hold very well, is hard to control and sets up almost instantaneously. PVC cement on the other hand, can be bought in the plumbing section of most any hardware store, bonds very well and sets up within a few minutes allowing a short working window.
The Dagu board was a good buy at $22 it does a good job at controlling the motors without any problems, the sensing works well, a little sensitive but workable and the price is right. I have not got the encoders installed on the wheels yet but I will do that in the next phase and report on it then. I believe the encoders will make differential steering calculations easier. I will also report my findings when that time comes.
The wheels are made of a semi-soft rubber type material and have good grip on the hard surfaces where the rover runs. The width of the tires makes it a little hard to turn but can be overcome.
The battery pack I bought for the motors have enough power to run the rover for quite a while. On my trial runs I probably ran the rover a total of 1hr and the rover ran like a scalded dog without any problems. I got the battery pack from
BatterySpace.com for $15, I also purchase the charger with it for an additional $15. The cell phone battery I'm using for the logic is working out very nicely but the way I have it set up it sometimes pops out of the holder so I will have to put a hold down on it to keep it seated in the holder.
Firmware
I made some minor changes to the firmware I released in the first article by adding a layer on top of the basic Dagu control class. The Dagu control class controlled each motor channel individually and the layer I added functionality to control the rover as an entity that uses all parts collectively to navigate. This class is very crude right now and we will be adding a lot of complexity and functionality to it in the future.
A portion of the CDaguHAL layer is shown in the code segment that follows. Right now it is very crude and needs a lot of work but as time goes by and I learn to control the rover better the level of sophistication will grow and the functionality will likewise increase as the need arises.
void CDaguHAL::SetState(ChannelState left, ChannelState rt)
{
CDaguMC::SetState(0, left);
CDaguMC::SetState(1, rt);
CDaguMC::SetState(2, left);
CDaguMC::SetState(3, rt);
}
void CDaguHAL::SetDirection(ChannelDirection left, ChannelDirection rt)
{
CDaguMC::SetDirection(0, left);
CDaguMC::SetDirection(1, rt);
CDaguMC::SetDirection(2, left);
CDaguMC::SetDirection(3, rt);
}
void CDaguHAL::SetSpeed(uint8_t left, uint8_t rt)
{
CDaguMC::SetSpeed(0, (uint16_t)left);
CDaguMC::SetSpeed(1, (uint16_t)rt);
CDaguMC::SetSpeed(2, (uint8_t)left);
CDaguMC::SetSpeed(3, (uint8_t)rt);
}
Development Environment
Thought I'd throw in a shot of my work space. It needs a little work mainly drawers and more shelving on the electronics work bench but sold all my woodworking tools when I retired so until I can replace at least some of them it will just have to do.
Conclusion
All in all I'm pretty pleased with the results of the first phase of the project and look forward to each phase going forward. It has certainly been a learning experience and I hope that what I've learned is a benefit to those that are attempting the same.
I've made a lot of progress but I'm remodeling the house I'm living in and had a lot of other distractions and interests that divide my time so I'm not working on this as much as I'd like but I hope to able to devote more time to it now that the remodeling is winding down.
Online Stores
Mouser.com, has everything but I find it hard to find things easily as they have such a large inventory.
Digikey.com, like mouser they have a huge inventory.
Adafruit.com, they not only have a wide variety of hardware but many tutorials, videos and firmware available.
Jameco.com, a little smattering of everything geared to tinkerer.
BGMicro.com, more of a surplus house and cheaper if you can find what you're looking for or make what you find work!
Pololu.com, this is where I got the motors and wheels