Making a Dumb Lawnmover Robot Smarter
by browsem in Circuits > Robots
859 Views, 3 Favorites, 0 Comments
Making a Dumb Lawnmover Robot Smarter
So i have a lovely, but stupid lawn mower robot (The picture is from www.harald-nyborg.dk).
This robot is supposed to cut my lawn, but my lawn is too big and complex for it to really get into the corners.
Not shown on my drawings are a multitude of trees and a swing set and so on and so forth. The result is, the robot spends WAY to much time, running over already mowed open sections, and too little time mowing the hard parts.
So i decided to add some external intelligence.
23-04-2020 EDIT: the sensor didn't quite work, so i changed a couple of things
Supplies
2 outdoor 2 way Switches
OR
1 old usb router
1 usb relay card
1 digispark
1 usb hub
1 watertight electronics box
23-04-2020 EDIT:
OR
1 old usb router
1 usb relay card
1 usb2serial tll thinghy
1 usb hub
1 watertight electronics box
1 Dfrobot URM 37 v3.2 ultrasonic sensor ( you could probably use any sensor=)
kmod-usb-serial-cp210x
Step 1: Manuel Multi Area Cutting
The picture shows how i went from one cutting area, to 2 areas.
My robot will autostart every 2. day, so as long as i remembered to change it from one area to the other, this worked fine.
I used 2 manual switches, like the ones you would use in a hall or stairway.
This worked, except the ones i used were of too poor qualty, and therefor i got bugs crawling into them, messing them up
Step 2: the Automatic Solution
So i decided to do something automatic.
I got a used Netgear R6100 router, i got this one because it has wifi, usb, and enough memory to make experimenting about experimenting, instead of making it about cramming OpenWrt and friends on to it.
I got an ebays best usb 2.0 hub and a 12v relay card.
Then i had a digispark from an earlier project. 23-04-2020 EDIT: used a usb2seriel thinghy instead
i wired the relays instead of the switches. i used relay 3 and 4
Then i installed OpenWrt and added Crelay, picocom and coreutils-stty to it.
23-04-2020 EDIT: added xxk, kmod-usb-serial-cp210x as well
Plugged 12V into the router and the relay board.
23-04-2020 EDIT: used an Urm 37 v3.2 instead of the rest of this page
Then i learned something "fun". the relay boad will try to power on the usb hub, thereby hindering the digispark from rebooting correctly. So i cut the power wire in the usb cable from the relay card and the usb hub.
The then i plugged the digispark and the usb relay card into the usb 2.0 hub, and the hub into the router.
Well to be fair, i programmed the digispark before adding it to the router
In the digispark, i added a button, that i wired between P1 and Gnd.
This button i placed, so the robot will activate it, once its in its garage charging.
i had to add a spring to the activation, to get a good solid engagement.
Step 3: Software
The File contains an arduino ide program for the digispark.
Its placed in root/LawnSelector.
This file needs a couple of digispark libs, like digiCDC and the digispark boards added to the arduino ide.
Then there the /root/GrassCtr/* files.
These are the files that actually do the work.
Kreds1 changes the relays to area1
Kreds2 changes the relays to area2
KredsStatus askes the USB relay, what area is active
23-04-2020 EDIT: Use UltraSoundSeriel instead of read digispark.
ReadDigiSpark, reads the news every tuesday.. Wait. Reads the input state of the digispark
GrassCtl does the thinking.
Heres what it does.
If the robot is IN for more than 10 hours, it decides the robot is in for the night, and this activates a flipflop, that makes it start in each area every second time. The reason for this is, my robot starts by cutting the entire edge, and in this way, it cuts the edges every other day.
Then once the robot is mowing, the sensor will tell that the robot is out.
Every time the robot returns for battery charging ( defined as being in for more than 20 minutes) the area will be changed to the other area.
please note. The software is a god awful mess, but it works, so onward and upwards
Downloads
Step 4: Activating the Software
To run the software, we need to do something.
I added it to a cronJob
*/5 * * * * /root/GrassCtrl/GrassCtl
to the file
/etc/crontabs/root
Then, in order to turn on cronjobs i did
/etc/init.d/cron enable
As best i can tell, the robot will now change between starting mowing area 1 or 2, and will change whats mowed everytime it has been in recharging the batteries.
And yes, now it gets everthing