This project has been in my brain for a while now, so it seemed appropriate to try. It is basically a metal frame with wheels, and a push-lawnmower hanging from the metal frame. Attach 2 big electric motors, a car battery, and some home-brewed electronics, and you have this page.
The main materials so far:
1. (2) 300w wheelchair motors (Ebay = $75 total)
2. (6) 3' pieces of angle iron (Home Depot)
3. a bunch of bolts (3/8"-1/2" diameter, Home Depot)
4. 10' of roller chain (All Electronics)
5. (2) wheel sprockets and (2) drive sprockets (All Electronics = $8/ea, $2/ea)
6. a car battery
7. an Arduino
8. 2-channel full H-bridge capable of handling at least 25amps/channel at 12vdc.
9. (4) wheels (Harbor Freight Tools = $12 each)
10. 5/8" threaded rod (3' long) (Home Depot)
If you want to view any of the files related to this project, please go to Electronics >> Arduino Code.
Here is a eagle schematic for 1 side of the circuit (the board pictured contains 2 of these):
Look at this chart to see a graphical explanation:
I control the RC transmitter (Tx) ----> Arduino receives signal, translates to PWM value ----> H-bridge receives PWM, drives motors.
This sounds easy, but finding a motor contoller (h-bridge) that can handle 25 amps is either difficult or expensive. The cheapest single H-bridge that would work was the Simple-H controller that handles 25 amps but it is $80 per bridge and I need 2 full bridges = $160! The cheapest dual full h-bridge that I could find was the Sabertooth 2x25 which is nice looking and has the RC interface built in, but it runs $120. The models they use in battlebot wars are around $300!
So, after a lot of research and about $50 worth of parts, I built a dual full h-bridge with an RC interface that can handle over 25amps, hooray for the lawnbot.
Here is a preview of what it should look like.
After a long time, everything was finally ready to test. So a friend came over and helped me get everything connected for the first run. I hooked everything up and turned it on... no smoke. Tried driving it forward and it worked. I had hooked up the motor wires backward on one of the motors, so it was doing a zero-turn donut when I pushed both sticks forward. After connecting the motor wires correctly, I realized that the input lines were also backward when I noticed that the left control stick moved the right wheel... but I was happy enough that it was working to leave that for now. So I drove it up to the mailbox, albeit a bit slow (the battery hadn't been charged in over a month... oops), but it still made it around the front yard once before doing a hard stop down the driveway. Still no smoke. I check the Mosfets to see if they are overheating and they are only slightly warm. So, a few more donuts down by the garage and then I got a bad idea. Why not see if it will carry me? After standing on it I push both sticks forward for just a second and almost fall off. So trying again very slowly and steadily.... POOF! Smoke comes out of the motor driver board. HAHAHA, I mean, oops:
A burned power trace on the back of the PCB. Yeah, so those little traces on the PCB's from Radio Shack are obviously meant for running logic chips and such... not 20amp motors. I am not about to throw away my motor driver board, so I decided to start soldering every trace that carries any sizeable amount of current. Now before I put it back together, I decided to build a convenient platform for the 2 interface boards to sit on, a toggle switch to turn it off easily, and a power block to keep the wires neat. So then it gets mounted back onto the chassis for another test run. Also, I read a bit about capacitors reecently and decided to add a few to each board for kicks.
After reconnecting everything and testing the boards with the Mosfets taken out, it all powers up fine. So turn it off, reinstall mosfets, and now its ready. But this time it wasn't so smooth. I dropped a mosfet to the concrete when I was trying to install it on the board... not thinking much of it until I turned on the power and it started smoking. Ouch. Oh well, I turned on the power again to see what would happen. Everything sat still, all the appropriate lights on... when I tried to run it forward (assuming the other side of the H-bridge would still work), the other motor started to turn, but as I applied power to it, smoke came out from under the driver board again.
Turns out I missed a trace when I was soldering them all up. AAAARGHGH.... Now it is dismantled again and ready for soldering.
So the H-bridge board is probably dead. I can only get 1 motor light to work on each channel... I apparently fried something. So now I'm going to try to etch my own PCB which should be smaller and easier to use. Here is a .jpg of the eagle board file.
I etched the pcb tonight. Here are some pics:
This run only transferred halfway. I am using magazine paper to print onto because I am too impatient to wait on the proper toner transfer paper which has to be ordered on the internet.
I used an iron on high, the copper clad, a green scotch sponge pad to clean the copper (not the steel wool shown... too rough), the print onto the magazine paper, and a piece of wax paper to put on top of the magazine paper. The copper clad gets to sit on a 1"x6" (untreated, you don't want moisture in the wood) so it sits flat and even. Push hard for 3-4 minutes, lifting and moving, making sure to get every spot with the iron. Try not to slide the iron, as it will smear the tracks (which I did, and you will see).
...smeared tracks.
Cleaned up the smeared tracks with a very small flat-head screwdriver by scraping the toner off of where it was not supposed to be touching.
Dipping the boards into the Radio Shack PCB ethchant solution, also bought an air pump and hose to help etch the bottom of the board.
Etched... some copper around the edges wouldn't come off, but it was far enough from the important stuff to just lightly sand off. This turned out nice.
Starting to wipe off the toner with Acetone and a napkin. It comes right off and shows the clean copper underneath.
All done. I feel like this is one of those things I hoped I wouldn't have to do, but am glad that I now have.
All of the parts came in from Digikey and are now soldered into place. I was concerned that since the spacing between the PCB traces was so small, the solder might have trouble pooling across tracks. That didn't happen at all, it stayed right where it was supposed to and everything went very smoothly. After I soldered everything together, I tested it and it worked nicely. The only thing I notice that is not great, was that I tied the motor indicator LED's each into ground from their respective motor terminals, this causes the voltage on each motor terminal to be referenced to ground, instead of the other motor terminal. This causes both indicator led's to light up when any voltage difference is present. This is easily changed in the next pcb etching. For now, I don't care, as long as it works.
Check out the video of the 2nd test drive:
I am now able to drive the frame around without any hassle, thanks to the toggle switch. I have only recharged the battery once since I started all this a few months ago and it hasn't ever dropped below 11 volts. However, while it has plenty of current capacity, the voltage is only running the motors at half of their intended speed. Plus the small gear on the motor mated to the much larger gear on the wheel decreases the RPM that the motor shaft spins at by about one half... so if the motor is spinning at 100 RPM, the wheel is only spinning at 50 RPM (appx.). In turn, the bot is super slow. And the 12 volts isn't quite enough to push the motors up a large hill... it just slows down to a stall.
The only larger than 12v power supply I had on hand was a Ryobi 18v drill battery, so I wired it up and it ran MUCH faster than before, which is awesome. While 18vdc is probably enough to mow the grass on my back yard, I think running it at 24vdc will allow me to run it at 60% most of the time, and when I need to go up a big hill, it will have a little extra power remaining. I also installed a fuse between the battery and boards so I could see how many amps the motors were drawing. It blew a 5amp fuse, then a 10amp going up a hill. The 15amp held strong at 12v, but blew going up a hill at 18v. A 20amp fuse is golden, seriously. I found a 12v 7Ah lead-acid battery, so I plan on getting another one to match it and running them at 24vdc. The mosfets gates can handle +/-25v, so it will be close to the threshold. But I'm gonna try it.
I also have my new design nearly finished. It is a multiple mosfet dual full h-bridge that is an integrated Arduino shield and some R/C receivers like mine can plug directly onto it. So you plug your power to the board from batteries, then the 2 motors, set some jumpers to route the signals to the desired Arduino pins, and plug the Arduino and R/C receiver onto the h-bridge (or use servo plug wires for r/c rx). Unlike the previous h-bridge board that only had 4 mosfets for each bridge, this board can be populated with up to 16 mosfets for each bridge (32 total mosfets on the board), and also has clearance for tab-soldered heatsinks. These mosfets will be driven by 2 mosfet driver chips per bridge. The voltage max will be 25 volts and the current max should be around 25 amps continuous (like for an hour mowing the whole yard). I will post pictures when I get this one transferred to copper.
Here is a pic of the eagle .brd file:
I decided not to use the above design for a motor driver board because it was a bit too complex for me to want to try it yet. So I designed another h-bridge with 3 mosfets in each leg instead of the 4 that were going to be in the above board. This is still 3x as many as were in the first driver board, so it gets rid of heat much better. This design is basically a beefed up version of the first driver board.
It uses 2n7000 n-channel mosfets to switch the P-channel power mosfets on the high-side, and the N-channel power mosfets are logic level and driven straight from the microcontroller (which hasn't caused any problems yet). I used a bussed resistor network chip to deliver an equal signal current to each mosfet gate. There are pull-up/down on each mosfet gate to protect them from floating. I also dropped the direction lights on the motor terminals to save space. Everything is crammed in there, but it all fits and nothing is touching that shouldn't be. Here are the .sch and .brd files for Eagle and a few pics:
I created an Instructable for instructables.com on the Lawnbot400 detailing how I put it together and showing how one might build an R/C mower like it. I posted it on a Friday night and it was featured on the website an hour later. The next morning I got a call from a friend that said it was featured on Hackaday.com which was cool. It was very well-received by everyone on the web so I entered it into an Arduino contest on instructables.com.
The thing everyone kept complaining about was the lack of a good Failsafe in case the mower got out of control or out of range. So I wrote a little more code and added another Atmega168 microcontroller that is used to turn ON/OFF a 60amp relay that controls the power to the motor-controller.
I decided against using Interrupts in this code, because they trigger every 20ms on a Servo signal, which is about 50 times per second. This is a lot to process and sometimes has unwanted signals coming in from the R/C receiver due to interference. These unwanted signals are no problem for the driving of the motors, because the motor control lines are using PWM on solid-state Mosfets which were made for fast switching, if the bad signal causes a single dropped "frame" (or 1 update out of the 50 each second..) it is not even noticeable. However, while controlling the motor power Relay, a dropped frame will cause the relay to switch OFF for 1 frame, which takes the Relay a second to fully switch from ON to OFF and back again. So this is really bad when a random unwanted signal is killing all power to the motordriver for a second here and there.
What to do? Well, back when I started working on decoding PPM servo signals with the Arduino, the easiest way to do it was to use a method called PulseIn, which when called, waited for a pulse to start and recorded it's length and stored the value to a variable. This pulse length can then be decoded to a directional PWM value within the code. The neat thing is that PulseIn can be used on any pin. The bad part is that it takes a lot of processing power to run a pulseIn. It was not practical to use for speed control (where high-frequency updates provide very smooth acceleration), because the high-frequency updates slow the code down to a crawl and speed control is very very choppy.
But, if you use PulseIn sparingly, you can call it whenever or wherever you want in the code and collect a sample of that channel's reading any time you want. So I set my code to call PulseIn every 500ms (or twice every second) which still allows plenty of time in the code to run the other functions. Also, this keeps the update period for that channel within safe operating conditions. For example, if I end up out of range, it will only take 1/2 second before the code updates, realizes there is no signal when it tries to PulseIn on that channel, and shuts the power off to the motor-controller which will render the Lawnbot400 motionless until a proper signal is received again.
The beauty of using a polling method is that I only collect a servo reading when I need to and if there is no signal available when I call for it, the microcontroller shuts the motor power off. I can also switch the motor power ON or OFF manually as I wish. Also if the remote is turned off, the motor power is killed. I think this will suffice.
