hits counter

Robomower Part 9: Turning on the mower attachment.

This is the home stretch! The robot moves, it has a lawn mowing attachment hanging beneath it, and if I go out and actually hook the wires from the mower motors to the bot’s batteries, it will actually mow the lawn. Trouble is, since it’s an electric mower, I really want to be able to engage and disengage the spinning blade remotely. So far, this has been the tough part. If you’ve followed the build log, you’ve seen that I have actually used a lot of off-the-shelf robotics parts. I am really hoping to do some actual programming and some electronic design, so that I can at least feel like part of it is completely home-grown. This desire got a nice boost when I went looking for an RC relay switch that could handle a load this big. I did manage to find some designs that looked like they were up to the challenge, but they seemed expensive for what they were. At the time I was looking they were out of stock, and it wasn’t at all clear when they might be available again.

Anyway, I decided that I’d be doing some of my own building. I have really been excited lately by the open-source Arduino micro-controller board and its many compatible projects, and I was just itching to get one into the robot somewhere. It seemed like a good place would be in between the RC receiver and the mower motor relay. Like most RC receivers, the BR6000 outputs a timed signal pulse to control servos, or in this case, a micro-controller board. I wanted to control the mower motor with the DX5e’s right-hand joystick. The right stick fore-and-aft controls the right motor, and I want the same stick, when pushed all the way to the right to activate the mower motor. The stick is spring-centered, so if I were to let go of the right stick, it would center itself along both axes, thus stopping the right wheel motor and opening the mower motor relay. Another level of fail safe! The fun part was going to be converting the timed pulse signal into a digital high/low to control the mower motor relay. Arduino time! One of the great things about open-source hardware in general, and the Arduino in particular, is the enormous amount of creativity that has gone into the great number of versions of this board that are out there. I decided to run with the RBBB (Really Bare Bones Board) by Modern Device This is tiny little Arduino compatible that had everything I was looking for: Very small size (and capable of becoming even smaller!), fully compatible with the Arduino IDE, and available as a bare PCB (I get to build it, yay!). This was the ticket! The board went together very easily, and after I cut off the power supply section, I was left with a board just a little bigger than a thumb drive. The light came on, and all was looking good until I tried to program the board. Sadly, it took me about three hours of pulling my hair out to conclude that my FTDI Basic was in fact defective. On a side note, that troubleshooting session did lead me down some very interesting paths. I found this neat little site with some instructions for setting up an Arduino on a breadboard. Having a grand total of three Arduino compatible boards at one time made for a very efficient process of elimination. Once that was determined, I switched to my “real” Arduino to create the software (“Sketch” in Arduinospeak). Being unwilling to believe that the problem I was trying to solve was so trivial turned what should have been 5 minutes worth of work into about 25. Even so, the resulting script is embarrassingly simple.

Basically, the data coming off the receiver is, as I have described, a timed pulse. With the stick all the way to the left, the pulse is at its shortest. Likewise, the pulse gets longer as the stick moves to the right. Using the continuous loop structure that is inherent to programming the Arduino, I simply take the time the pulse is at a logical HIGH, and if it is above a threshold, I assign one of the board’s output pins to send a logical HIGH, which will (through a transistor) close the mower motor relay. When the pulse drops below the threshold, the pin sends a logical LOW, opening the relay. Simple stuff!

//Channel is pin 2.

int inpin= 2; // Like I said, pin 2 is the input.
byte puls = HIGH; //We'll get some pulses, default to HIGH.
int outpin = 4; // Output pin is 4.
int time; // For pulse lengths.

void setup()
{
pinMode(inpin, INPUT);
pinMode(outpin, OUTPUT);
Serial.begin(9600); //Start serial at 9600 bps.
}

void loop()
{
time=pulseIn(inpin, HIGH); //read level of input pin.
Serial.print ("pulse= "); // Output the pulse length to the serial monitor
Serial.println (time);    // See above....  (I should probably reove this after debugging)
delay(200);              //Slow it down...
if(time >= 1700)       // On my controller, this corresponds to almost full deflection to the right.
{
digitalWrite(outpin, HIGH);  // Turn on the mower (right now it's an LED 8-)
}
else{
digitalWrite(outpin, LOW);   //When the pulse length gets below 1700 shut it off.
}

}

I was also going to need a regulated 5 volt power supply. The Sabertooth motor controller includes a 5 volt output, but it is limited to 100 miliamps, and I was going to need more than that. I built the supply around the 7805 voltage regulator chip, using the simplest of the circuits shown in the data sheet (the 7805 and two capacitors was the whole shopping list). Now I had (nominally) a full amp to play with, more than enough to power the RBBB, the BR6000 and the relay.

The relay turned out to be somewhat difficult to locate. As it turns out, relays with 5 volt coils that can handle more than 20 amps at 24VDC across the contacts turn out to be very rare birds. I was able to locate some, but alas, the $25.00 minimum order meant that I will be looking for projects for a while 8-). Meantime, if anyone needs one, drop me a line, I have some extras 8-).

Today I sat down with the relay, the breadboard and a nice latte and went to work. Since the relay needs around 220 mA to close, the Arduino wasn’t going to be able to do it alone. I used a TIP120 Darlington transistor to direct 5v from the power supply to the relay coil. For those who may be attempting this, make sure to use a current-limiting resistor between the logic (Arduino) and the base of the transistor. Also, since the 120 is an NPN type, connect the collector to ground, and the emitter to one side of the relay coil. Connect the other side of the relay coil to 5v, and you’re ready to go. Once again, I pulled out a lot of hair before realizing that the batteries powering this whole thing were getting old, and, as it turns out, too weak to snap the relay. This whole project is about living and learning. Eventually, it all worked!

The next step was to move all the components off of the breadboard onto a prototyping board, wire them up, and install them onto the robot. This requires a little bit of caution, as the soldering and wiring happen on the underside of the prototyping board. This is different from the breadboard, of course, where everything is inserted with reference to the top. Just make sure you’re connecting all the pins you think you are connecting!

The soldering job went fairly smoothly over the course of a couple of evenings, and the finished board tests just fine.

Mower Motor Controller, front view

The mower motor controller (front).

Mower motor controller, back view

The sloppy side of the mower motor controller.

Installation and video evidence of actual lawnmowing are coming soon!

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>