Arduino R/C Lawnmower (painted)

 by johndavid400
Contest WinnerFeatured
41.jpg
lb400_dumptruck.JPG
lb400_dumptruck2.JPG
lb400_dumptruck3.JPG
IMG_6974.JPG
IMG_6941.JPG
IMG_6940.JPG
IMG_6943.JPG
IMG_6973.JPG
36.jpg
lb400_8.jpg
lb400_11.jpg
39.jpg
40.jpg
42.jpg
43.jpg
What this is:

This instructable will show you how to make your Arduino into an R/C interface that you can use for just about anything requiring remote control. I will also show you how I built an R/C lawnmower using my Arduino, a cheap R/C transmitter and receiver pair, and a couple of electric-wheelchair motors from Ebay.  I have used this interface to control anything from basic LED's to Bipolar stepper motors, mini-robots, lifeless R/C cars from the thrift store, and even a 100lb lawnmower (all with appropriate motor controllers). It is very flexible and easy to change and very simple to set up.

See a slightly different version of the Lawnbot400 in my new book "Arduino Robotics" , as well as a DIY Segway and several other bots.

Check it out in MAKE magazine in the April 2010 issue (#22) or here:


UPDATE 3-24-10

New wheel-barrow bucket mounted on top with hinges so it can dump its contents.


UPDATE 3-10-10: NEW CODE

And new video of the Lawnbot400 moving a bunch of dirt from my truck to the flower beds across the yard, also I updated the code again.


.

I added some new code to the project that is safer, including a manual kill-switch and a Failsafe switch.

To implement the Failsafe, I used another Atmega168 (or an Arduino), to control a normally-open 60amp power relay. The relay disconnects the power to the motor-controller unless receiving a "good" signal from the 2nd microcontroller. This signal is updated 2 times every second and is either ON or OFF. If the bot gets out of range, it loses power to the motors. If I flip the kill-switch on the Transmitter, it loses power to the motors. This is also a handy way to disable it remotely if anything were to go near it that wasn't supposed to. The updated code for both microcontrollers is on the CODE page.
 
In addition to the failsafe, I changed the way the code reads the PPM signals to make it more reliable. Also, I realized that I was only able to run the bot at 80% speed with the old code, so now it is quite a bit faster and has more power (it can carry me across the yard @ 155lb).

Check out this new video of me riding the Lawnbot400, my wife driving it over a bunch of branches, then me making do some wheelies. Don't worry, the mower was turned off this time since the grass didn't need cutting, we were just having fun.



Disclaimer:
DANGER!!! This is a VERY dangerous piece of equipment if not handled appropriately. Since all the electronics have been home-built and the Arduino code is new, you MUST be very careful while operating anything heavy with this code. I have had 1 or 2 times during testing - and before adding a secondary failsafe - that the main Arduino jammed up and I temporarily lost control of the mower for a few seconds!!!! Though I have added several filters to discard unwanted signals and I rarely have any issues, an un-manned lawnmower IS STILL A POTENTIAL DEATH TRAP and I assume no responsibility for anything that happens as a result of your use of this code or this tutorial. This is meant as a guide for people who not only have the ability to build such a contraption, but the responsibiltity to operate it safely as well. Any suggestions or ideas on how to make this a safer project is always gladly accepted. Having said that, it's also awesome.

Background:

Most R/C equipment comes packaged for a single specific use, which makes it easy to use but is very limited in what you can do with it. So using the Arduino as an interpreter between the R/C system and the motor driver, I can use any motor controller that I want (depending on the size of the motor and power required), reprogramming the Arduino to supply the required signals. 

What I ended up with:

After successfully hacking a few R/C cars from the thrift store, I got bored driving them around the driveway and I was having a hard time convincing my wife that there was any usefulness in the revived toy car. So I decided it was time to make my biggest chore at home, a whole lot easier and actually put my Arduino to work, and thats how I ended up building an R/C lawnmower.

While designing the lawnmower, I thought it would be cool to learn about the electronics that made it move, so I designed and built my own motor speed controller (or H-bridge) to power the lawnmower. I looked around at every H-bridge design I could find before deciding to go with a Mosfet h-bridge that uses both N-channel and P-channel Mosfets.

I built several different motor driver boards for this project, the first two were on Radio-Shack perf-board and the next 4 were designed using EagleCad and etched to a piece of copper-clad PCB, using the toner-transfer method. The most recent board is the one I use to mow the lawn as it has the ability to stay cool even while operating for long periods of time (30-40 mins straight) at 10-20amps and 24vdc. FWIW, I had to burn up a lot of Mosfets to find this out. If you want to see any of my other motor controllers, go to www.rediculouslygoodlooking.com and check out the Mosfet shield.

Here is what I bought already assembled:
FM R/C transmitter and receiver pair from ebay = $40
Arduino = $30
I already had a used push-mower = $60

Here is what I bought and assembled into the Lawnbot400 (as I call it):
(2) electric-wheelchair motors from ebay = $40 ea
(2) 12v marine deep cycle batteries - Walmart - $60 ea new (used batteries might work)
36" pieces of 2" angle-iron (2) and 1" square-tubing (2) from Home Depot = $8 ea
36" pieces of 1" angle-iron (2) and 1" flat steel bar (2) from Home Depot = $5 ea
(a lot) of nuts, bolts, washers, lock washers 3/8" or 1/2" with drill bit = $20
(2) caster wheels from Harbor Freight Tools = $14 ea
(2) drive wheels from Harbor Freight Tools = $8 ea
(36") 5/8" threaded rod with several 5/8" nuts and washers from Home Depot = $8
(2) sprockets from Allelectronics = $5 ea
#25 roller chain and a few universal links from Allelectronics = $10 for 3'
sprockets from Electronics Goldmine = $1.50 ea
(24) mosfets from Digikey = $1 ea
(there were quite a few small parts for building the H-bridge, they are listed later on)

 
Remove these adsRemove these ads by Signing Up

Step 1: Setting up

typical_txrx.jpg
lb400_10.jpg
1. Get R/C transmitter and receiver (I have tested FM and AM systems and they both work)
2. Upload code to Arduino (it is on the last page)
3. Make sure you are getting a good signal


You will need an R/C radio transmitter(Tx) and receiver(Rx) pair, which is the most expensive part of the project, but can be used for every future project you might have involving R/C.  I went with a 6-channel FM system, but  I have tested a 27mHz AM transmitter/receiver and it works just as well. The beauty of the Arduino is that if you want to adjust the deadband or the motor-speed at turn-on, (unlike commercial ESC's) it is all easy changed in the Arduino IDE.

Once you have your radio, all you need to do is upload the code to your Arduino, plug in the 2 channels that you want to use from your radio receiver into Digital pins 2 and 3 of the Arduino (these are the 2 external interrupt pins on the Arduino) and you are ready to control whatever you want. If you don't have a batter pack for the receiver, you can run jumper wires from the Arduino +5v and GND to the R/C receiever for power, you only need to supply a single channel with GND and +5v (it is not necessary to power every channel).

Upload the code using the Aruino IDE (I am using version 0016 on Ubuntu).

I started by controlling 3 LED's with 1 channel on a breadboard. I wired a red LED to be Forward (digital pin 9), a yellow LED for Reverse(digital pin 5), and a green LED for Neutral (digital pin 12). This allows you to adjust the code to fit the needs of your radio system. You will have smooth 0-100% PWM control of both LED's and the neutral light will turn on when the control stick is centered. If needed, you can widen the deadband for Neutral, but doing so will increase the speed at turn-on (which starts at 0%, so that would likely be desirable). See pictures.

----------------------------------------

The code has 4 PWM outputs for motor control:

channel 1 Forward = Arduino digital pin 9
channel 1 Reverse = Arduino digital pin 5
channel 2 Forward = Arduino digital pin 10
channel 2 Reverse = Arduino digital pin 6

2 outputs for Neutral indicator lights:

channel 1 = digital pin 12
channel 2 = digital pin 13

The 2 INPUTS from the R/C receiver should go to:

channel 1 = digital pin 2
channel 2 = digital pin 3

---------------------------------------

If you are interested to see your readings, turn on your Serial Monitor in the Arduino IDE (set to 9600bps) and you can see the actual real-time pulse readings for each channel, they should read:

full forward = 2000 (2 milliseconds)
center = 1500 (1.5 ms)
full reverse = 1000 (1 ms)

These readings reflect the number of microseconds that the pulse signal from the R/C receiver stays HIGH (or at 5v). The typical Servo signal that comes from an R/C receiver is a pulse whose length varies from approximately 1 ms to 2 ms with 1.5 ms being Neutral (which should also be the position that the control stick returns to when you let it go). The transmitter reads the position of the control stick and sends that pulse length about once every 20milliseconds. So it is constantly updating for precise control (for more info, look up PPM on wikipedia).  If you push the transmitter control stick forward, the reading should go up to 2000, if you push it backward it should go down to 1000. You can also use a voltage meter at this point to see that Digital Pins 5, 6, 9, & 10 will be changing from 0-5v depending on the position of the control sticks on the R/C transmitter.

If you care to know, the code uses the Arduino's 2 external interrupts to capture when the Rx signal pin changes states (goes from HIGH to LOW or vice versa), when it does at the beginning of each signal, it calls the interrupt function which reads the digital state of the pin and if HIGH, it records the microseconds value on the Arduino system timer0. It then returns to the loop until the pin goes LOW, at which point it subtracts the previously recorded microsecond value from the new current microsecond value to determine how long the pulse stayed HIGH (which tells us the position of the Transmitter control stick). It then does that over and over really fast.

I have the values constrained from 600-2400 in the Arduino code to keep things simple. Once it receives the signal and constrains it, it maps that value to be proportionally between 0 and 511, where 255 will be Neutral. The code then determines when the value changes and uses a function to determine the appropriate 0-255 PWM value in the appropriate direction and each direction has it's own PWM output pin to control the H-bridge.

On a side note:

To make things easier, I built an Arduino-based breakout board using Radio-Shack perf-board, a 28pin DIP socket, a 16mhz oscillator, and a bit of wire. I also added a set of female-headers in such a way that I can plug my R/C receiver directly onto the breakout board. For secure connections while mowing grass, I added screw-terminals on each Output pin and each of the 6 channels from the receiver. It also has a built in 5v regulator to power both the Atmega168 from the Arduino and the R/C receiver (which gets power when you plug it onto the breakout board). So you just route jumper wires from the channels you want to use on the receiver, to the Atmega digital pins 2 and 3. I also added 2 LED lights that are hard wired to the digital pins 12 and 13 for the Neutral lights for each channel so I can easily see when I am in neutral.

Since this bot is a Tank steer setup with 1 drive motor on each wheel, the coding is very straightforward where the left stick controls the left motor and the right stick controls the right motor. Both sticks forward means lawnmower goes straight forward, both backward and it goes in reverse. If you push the left forward and the right backward, it does a zero-turn circle. As you can imagine, mowing the grass is really fun now.



1-40 of 317Next »
bricabracwizard says: Apr 23, 2013. 8:55 PM
I have ordered your book 'Arduino Robotics' and am looking forward to creating some of your robots.
ramsesvp says: Mar 26, 2013. 2:24 AM
Hi. Great instructable! Especially the 3x8 HBridge! I am going to use that one for my arduino powered dalek.

I ordered the parts list first from this instructable. Then i checked out your github for the files. (STUPID me! First check all the files and then order your stuff). It turned out that the parts list here and the .sch and .brd files don't fit together. The V3 version only has 1 elco in the middle, instead of the 4 on the rest of the pictures. Do you perhaps have the originals also somehwere that match the partlist here :-).
Thanks
ramses
SteveJobs 2.0 says: Mar 24, 2013. 2:17 PM
Does it mow grass?
softenersreviews says: Mar 2, 2013. 4:10 AM
I challenge you. Show me when it's done!
WastedBabies says: Dec 16, 2012. 9:41 AM
One day....
brcoenen says: Oct 30, 2012. 2:04 PM
Hey John, sorry to ask again, am trying to get ahold of a schematic of the trasmitter board, and it seems that none of the links in the comments are working anymore. I need some idea on how to put it together and whats on it. Would love to see them, am disabled and am facsinated with this idea. Have all the time in the world to play with and build stuff. Ty in advanced.
brcoenen in reply to brcoenenOct 31, 2012. 7:56 AM
or anyone that might allready have them.
SamfordValley says: Apr 17, 2012. 7:19 PM
I'm going to build something similar to this, but I'm going to make it so not only can I suspend the mower, but mount it on top for longer cut on rocky terrain.

I don't like the sprocket and chain system though, but I haven't done enough research or know for sure I can do it any other way. I'm worried the chain is too complex and something weeds and twigs will get caught in.

The main problem I'm having is I can't find these wheelchair motors for a reasonable price. I live in Australia and there don't seem to be any local cheap ebay auctions for these, and shipping on these suckers from the USA is $100-$200. I can't even find a cheap old wheelchair.

Is there a more... retail... kind of product I can use? Something like a servo/actuator I can order? I have no idea what I'd need to look for in terms of torque though. What sort of specs would I need to ensure in such a product to make it work with this project?

I need it to go up steep hills (30 degrees?) in long grass on rough ground. I'm already getting hardier wheels, larger drive wheels, and I found a company in Australia called Fallshaw that makes puncture-proof semi-pneumatic castors (though I can't find a price!), I will check out one of their stockists soon.

Because I need to mow my rocky terrain sooner rather than later, I might build the frame and use it like a push mower until I can get the motors and retrofit the electronics.

Any suggestions on alternatives to wheelchair motors would be appreciated.
nathanielg in reply to SamfordValleyMay 26, 2012. 9:09 PM
i used e300 razor scooter motors they are 280w each (there are larger sizes of motors up to 500w that i have seen so far) and the ones i got were off ebay and i only paid about $65 for the pair they are working well so far i have not had any trouble with them and the sprocket size on them is #25. if you are comfortable with drilling your own holes there is #25 sprockets on amazon for pretty cheap they also have #25 size chain (10ft for $12). Hope this helped
lstanczyk in reply to nathanielgAug 6, 2012. 2:19 PM
with those razor motors would i still be able to move dirt in an wheelbarrow like attachment?
nathanielg in reply to lstanczykAug 8, 2012. 10:19 PM
i have a 72 tooth sprocket on my 10 inch wheels (still goes fast with about an aproxamatly 5:1 ratio, but that is besides the point ) i put a wagon behind it and it was able to pull me (160 lbs. ) with ease and it struggled a little (like it might not do hills) with me and my 2 cousins in it ( about 350 lbs.), but if you change the gear ratio to a higher ratio then mine then it should be able to pull alot more then what i did, mine is too fast even with that gear ratio so i'm thinking about changing mine, but if you are using a 72 tooth sprocket on the wheels it should be able to pull about 200-300 pounds without it having much trouble but once you go over about 350 pounds then it will struggle. Make sure you are using 24v (for the torque) , and dont hit rocks with it (i did and i was sorry for about 2 hours of work [with the blade not the mower itsself] ) :)

If you have any more questions feel free to ask me, i would upload a video but i finished it then pulled out all the electronics in the back pannel to install an alternator.
osstekz in reply to nathanielgOct 7, 2012. 10:05 PM
Do you have any pictures/videos of the design using E300 motors?
nathanielg in reply to osstekzOct 16, 2012. 5:49 PM
email?
nathanielg in reply to osstekzOct 16, 2012. 5:45 PM
( sorry i was working on the mower at my grandparents and i did not see the message) yes i do have a video of the but it is not the clearest :) but i will send it to you
SamfordValley in reply to nathanielgMay 27, 2012. 4:40 PM
You must have gotten lucky, the cheapest on eBay right now is $157 for the pair.
nathanielg in reply to SamfordValleyJun 2, 2012. 1:14 PM
look at motor99motor his ebay page has the E300 motors for 26.90 a piece, that is who i ordered them from and they got to my house in a buisness week, Good luck
SamfordValley in reply to nathanielgJun 2, 2012. 8:18 PM
With shipping they're $124 for the pair, he knocks $30 off shipping for buying two. I guess I'll go with those, thanks.
nathanielg in reply to SamfordValleyJun 9, 2012. 9:13 PM
what wattage of motor did you get?
SamfordValley in reply to nathanielgJun 26, 2012. 5:50 PM
280W
brancilo in reply to SamfordValleyApr 24, 2012. 1:30 PM
I was lucky motors of the wheelchair gave me one for free otherwise they are expensive but the best solution, as an alternative solution can be taken from the truck to 24v, scooter, such as John, but the best of the wheelchair
I was denied the money I worked 2 years but the project eventually end only needs to be persistent.
niak32 in reply to SamfordValleyApr 22, 2012. 3:19 PM
I'm also in Australia close to Ballina NSW, I hounded a local scooter shop about an electric wheel char they had on consignment for $380, eventually got it for $150.
If there are old people living near by (lol) there should be a scooter shop which will have parts. Batteries I got for $5 each (deep cycle) as they replace both batteries at once and one is normally "still ok".
Hope this helps
pepelepew says: Oct 6, 2012. 5:49 PM
Hi y'all!
I'm currently sourcing parts for this bot (following your awesome book's blueprints :) , thing is I cant get any wheelchairs motors for a decent price.

Then there are quite a few electric scooter motors going around, some even have gear reduction (http://cpc.cx/5Jm), so i was wondering if those would be ok to use...
Also regarding the frame, no 2" angle iron around, biggest angle iron i can get at fair price is 4cm (1.57").

Any thought about these issues?
viperguy says: Oct 1, 2012. 1:39 PM
What would you charge to build the frame with all components except the mower?

viperguy@suddenlink.net
johndavid400 (author) in reply to viperguyOct 1, 2012. 2:11 PM
Hi Viper,

I would have to source the parts first and it would depend on that. Also, shipping would be expensive if I pack a box full of angle-iron and heavy duty motors to ship... what state do you live in?

Ballpark figure... I would probably have to charge around $600 or so to build the frame (sans mower and batteries), though for the next two months or so, time will be tight for me... so it would probably wouldn't be complete until around the first of next year.

On the other hand, I am happy to offer (free) help with building problems and parts sourcing, should you want to build it yourself.

Cheers,
JD
lstanczyk says: Sep 10, 2012. 8:36 AM
I was thinking about having a relay on the spark plug wire of the mower engine what amperage of the relay do you think i need?

Another thought would be an electric start on the mower.

After i finish the build i am thinking of making a charging station. i was thinking of magnetic terminals any other ideas?
SamfordValley says: Jun 26, 2012. 6:03 PM
Has anyone considered putting suspension in or anything like that?
I have completed my frame and mounted the mower, but haven't added the motors/electronics yet.
Anyways I find it very hard to push around (just with the mower handle, which i haven't removed yet), as soon as it hits a rock or depression it becomes a pain to push. I guess I'll slowly smooth out the terrain as time goes on, but it would be good to give it a bit more 'give' on those parts, since it's a solid unflexible frame. I'm thinking of finding some springs and adding them around the bolts between the front casters and the frame. Not much, but enough to let it bump the wheel up slightly when it hits something. This would of course raise the front a little bit - if that becomes a problem I'll have to re-mount the back wheels, but I'm thinking having the front tilted up might even make it easier to plow across lantana.
Adding the continuous caterpillar tracks some people are working on might also be an option - but I'd like to make it so I can switch between the tracks and the wheels easily.
I realise that the motors will be applying torque differently than me pushing the mower handle, but I thought I'd throw it out there if anyone wants to brainstorm this feature.
tma73 says: May 12, 2012. 11:35 AM
Excellent job on your Lawnbot! :D
Thanks for also posting the code you used. I'm putting together a bot using parts from a wheelchair.
Also using a Spektrum Tx & Rx to drive it for now (using a Sabertooth2X25 motor driver).
I noticed in your code you have it setup for independent steering. Was wondering by ommitting the 'b' in motor 1 & 2 I could run it using differential steering.
Thanks,
Thomas
nathanielg in reply to tma73May 26, 2012. 9:01 PM
the sabertooth can work directly from the signals coming from the rc reciever so unless you want a remote kill switch or accessories on the mower you will not even need the arduino
Jurko says: May 17, 2012. 8:20 AM
I need fuse specifications of the picture on Make magazine.....4A, 2A, 30A I don't know????? help please!!
Jurko says: May 6, 2012. 1:56 AM
Hello! I started this project with a little modifications.....I added tracks (tank) ((http://amando-abreu.webs.com/diytanktracks.htm)) and frame without tracks are about 50kg. I wounder if the motors will handle this weight with lawnmover and bateries...I have hilly yard so thats are tracks for...

I add some data fo my robot:
-Length: 120cm
-weight: about 100kg
-Width: 70cm (100cm with a tracks)
-height 20cm

I will post some pictures of progress soon as possible!!
SamfordValley in reply to JurkoMay 11, 2012. 10:08 PM
I'd love to see some pictures, I'm building a larger one myself, don't think it's as large and heavy as that though, it is larger than the LawnBot400 but might not even be as heavy. I will try to get some measurements and photos too, I've just finished the frame.
Jurko in reply to JurkoMay 8, 2012. 2:38 PM
Hy! I have question. If I read right on board triple8 4inputs are listed in couples 5-10 L and 6-9 R? and thats it.....and I have my edition about triple8...little modifications on a little bigger plate and larger holes.....contact me and I will send U (anzejurkosek@gmail.com)
litehouse43 says: May 10, 2012. 9:07 AM
Is there any "method to the madness" of picking wheelchair motors? I have found quite a few different types and also ran across brushed DC motors that appear to be very similar. I plan on using the sabertooth motor controller but have not really identified what I should be looking for in the motors. Am I just looking for anything high torque and low RPM?
ajurkošek says: May 6, 2012. 1:47 AM
(removed by author or community request)
brancilo says: Apr 24, 2012. 12:59 PM
hello
I finished my project
http://www.youtube.com/watch?v=7Diwy08YR9Y

SamfordValley in reply to branciloMay 1, 2012. 7:13 PM
Very nice!
brancilo in reply to SamfordValleyMay 2, 2012. 1:27 AM
Thank you :-))
brancilo says: Apr 2, 2012. 3:25 AM
Hi me again,

Can you give me the code for the arduino to duty cycle is less than 100% and the maximum without the relay, just an ordinary convert the signal from RC receiver in 4 PwM signal of 0-90% duty cycle, and where if necessary after I change the duty cycle?

Thanks a lot and I apologize for the inconvenience
rcflyeriam says: Nov 20, 2009. 3:59 AM
I have noticed that the your electronics are the highest part of the mower.  Maybe adding some sort of cage or box around it to keep bushes and shrubs from catching it and breaking things? 

Got to love the RC stuff, without them, where would we be.  Keep up the good work and happy flying .... ooooops, mowing.
johndavid400 (author) in reply to rcflyeriamNov 21, 2009. 8:10 PM
I took it out today to my friends' 2acre lot and made some trails. I only wish I had a full video as it was doing wheelies and completely cleared out a relatively wooded area in about 3 minutes. It even took out some 1" trees without complaining.  It kind of climbs trees when you run it into them... which is awesome. I had to re-start the mower a few times when I ran it over some heavy brush, and the cooling fan actually got a stick stuck in the fan which almost overheated the mosfets!! anyways, it apparently works as a bush hog of sorts also. I will be sure and video the whole mess tomorrow.
1-40 of 317Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!