Arduino R/C Lawnmower (painted)

Arduino R/C Lawnmower (painted)
«
  • 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
  • 44.jpg
  • lb400_16.jpg
  • 35.jpg
  • 36.jpg
  • lb400_8.jpg
  • lb400_11.jpg
  • 39.jpg
  • 40.jpg
  • 42.jpg
  • 43.jpg
  • lb400_1.jpg
  • last photo ←
»
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 1Setting up

Setting up
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.



« Previous StepDownload PDFView All StepsNext Step »
256 comments
1-40 of 256next »
Jan 3, 2012. 5:21 PMDavid97 says:
I bought your book for christmas "Arduino Robotics" thanks alot, highley recomended. Great book.
Jan 20, 2012. 6:55 PMDavid97 says:
Sorry for taking soo long to reply I was on holiday. Olny 1 question. I have these servos with no built in controller. So would modifying the servos like done in linus method 1 work for the bugbot?

Thanks. David.
Feb 1, 2012. 5:10 PMDavid97 says:
Thanks
Jan 22, 2012. 2:38 PMbrancilo says:
Hello, I have one question for me because that does not buy that ardunio has given a new UNO is the same as you what you used, and another issue where the signals from RC receiver connected to ardunio? I have a two-channel c4-k sm GRAUPNER. Thank you
Jan 5, 2012. 10:36 AMundie3423 says:
I am wanting to build a larger mower, 42" deck and have a question.Is it not possible to eleminate the wheel chair joy stick and hook up your reciever to the motor controllers that came on the chair. The motor controllers are able to take any punishment you give them. I know absolutley nothing about electronics, but i see once in a while in some articles they use the origional controllers and plug the wires into some sort of interface, and dont use seperate controllers.
Thanks Undie.
Dec 28, 2011. 11:01 PMgamemasterful says:
Besides using a lawnmower like a roomba (which is in most cases probably very unsafe.) this is probably the most awesome lawnmower idea ever.

I was wondering though, what are the main "version" differences between :instructables, Arduino Robotics book, and Make Magazine article? Just curious.
Dec 22, 2011. 9:41 AMundie3423 says:
It wont take you long to figure out im electronic stupid. I am looking for a way to interface an rc tx-rx directly to the controll board on a wheel chair circuit,",just replace joystick". I have been reading you tutorial and am completely lost. I want to run two drive motors wired together just for foreward and rev, and a third motor to steer with. i am going to articulate the mower, so i can remove deck if i want to put snow blower or small blade on. A local repair shop gave me two chairs, one has a good working controller. Any help will be appreciated.
Thanks ... Undie
Nov 30, 2011. 9:07 AMwazeem1 says:
hi john,

i want to design a motor drive circuit for driving 2, 5A 22v DC motors. Motors will be used in an electric wheel chair, i also want to control the speed of motors with PWM. Can you provide me with any help
Nov 28, 2011. 10:24 AMgeckomage says:
you ever considered welding a frame? i welded a nice pretty aluminum 1" square tube frame for my robotics teams latest robot :D
Nov 8, 2011. 6:03 PMjhx86 says:
great concept, i think you should use a 6.5hp motor and get one with the selfpropelled pulley and hook it up to an alternator to charge the batteries as your mowing. you could also add some head lights and a camera so you dont have to follow it all over the place.
Nov 2, 2011. 10:21 AMpat_loonytoon says:
So project total is around $500?
Nov 1, 2011. 6:58 PMfacilitator476 says:
After seeing the Joyride video I want to build this thing with a speaker system and have it follow me around.
Sep 20, 2011. 5:09 AMJayvis Vineet Gonsalves says:
Could you please give me H Bridge circuit schematic for driving 2 5A 12v DC Motors
Sep 25, 2011. 2:24 AMJayvis Vineet Gonsalves says:
Hi John, the robot will be about 25-30 Kgs. It runs on four 12v Electric Motors. I will also be using one more similar motor for the weapon system. I want to supply about 5-6A of current to them. Apart from this, I do not much about the motors. Here is the pic of them. ( Just to get an idea of the size of the motors, the tile in the pic is of 1sq foot.)
100_0114.JPG
Oct 11, 2011. 5:02 AMJayvis Vineet Gonsalves says:
Yes John, those motors are ungeared. And could I get a link to the other H-Bridge circuit?
Oct 14, 2011. 4:07 AMJayvis Vineet Gonsalves says:
Thank you John for your help. I also wanted to ask what batteries are you using in the RC Lawnmover and how long does it run on each charge?
Oct 15, 2011. 9:02 AMJayvis Vineet Gonsalves says:
Thanx John.
Oct 1, 2011. 2:59 PMnolan5683 says:
Dear John,

Can I get the transmitter/receiver board diagram please.

Thanks,
Nolan
May 18, 2011. 6:25 AMjcksparr0w says:
what are the wheel sizes?
Sep 27, 2011. 12:34 PMjcksparr0w says:
thanks
Sep 24, 2011. 9:34 AMnolan5683 says:
John,

Could you please upload an eagle file (not just a .jpg image please) of both the h bridge diagram and the transmitter/receiver board diagram.

thank a lot
Nolan
Sep 24, 2011. 9:53 PMnolan5683 says:
Thanks!

i also need the transmitter/receiver board diagram please.

Nolan
Sep 5, 2011. 9:27 AMCswick_S-117 says:
This is awesome. Brings back fond memories of "Honey I shrunk the kids"

I always wanted a remote-control lawnmower.
Aug 29, 2011. 2:20 PMhightekrednek2396 says:
I'm gonna try this but i think ill add tank treads like in one of the other instructibles i saw then it would be better for my terrain.
Aug 5, 2011. 5:43 PMmrdakota says:
For the battery on mine, I'm using a 24v 44Ah from a onboard APU jet aircraft for starting the jet turbines in flight. I scored two of these from a friend that had to replace these (never used) every 3 years as a recertification requirement. New they cost $2800 each!
Aug 1, 2011. 12:14 AMmrdakota says:
Mine is coming along nicely, waiting for the digikey stuff.
I wanted study the video operation and noticed that it would be nice to see how you are operating the transmitter.
Have you modified the left stick(mode2)to be spring loaded to center?
I plan on using my old JR 9503 computer radio and playing with some of the mixing functions to ease the operational functions.
Keith
In far northeastern IL
Aug 5, 2011. 5:32 PMmrdakota says:
I ended up using the twin engine feature in the radio for the two channels. Then steer the two with differential mixed from the right aileron stick, that way I'm able to set a forward speed on the throttle and steer with just the right stick.
I've got reverse disabled until a activate a toggle switch too. This is working on the breadboard, until I get the motor driver circuit done I won't know for sure.
I'm having difficulty etching the 2oz. copper and I had to stretch out the pcb layout for heatsinks, as they were too close.
Jan 23, 2011. 12:26 PMtycobb48 says:
I know this post is older, but I wanted to chime in. Now that everyone is having so much fun hacking the new Kinect system, it seems that it would be the next logical progression for this project. (although I wouldn't test with the kids in the yard!) Any thoughts?

PS - great instruct - I've got a dead mower in the back and I think I've found my winter project - thank you!
Aug 4, 2011. 10:37 AMalien200049655 says:
It would be nice to see your sketch / code for the arduino. I wnat to do something similar to build a sercurtiy drone, with skid steering, your steering method would be perfect to use tracks or traction belts, lie a tank or a BobCat
1-40 of 256next »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
79
Followers
4
Author:johndavid400
I have always been one to take things apart to figure out how they work, so most of what I own has been dismantled. If it can't be taken apart or hacked, i'd rather not have it. And I like to do thing...
more »