Geek magazine hacker daily blog

1 year, 10 months ago
It is a short story about assembly of the robot lawn-mower from make-shifts the normal manager, and also about formation of City Elections Commission, singularity denial, a consent with its majesty by Ilon Mask and fight of the person against machines. Fasten belts, we go to the atmosphere of delicate irony and the easy description of development of the robot lawn-mower from ferrous metal to a prototype. The inquisitive reader, welcome under kat!

Robot lawn-mower. From ferrous metal to a prototype

Instead of the preface:


Hello! My name is Vyacheslav Golitsyn, and I am City Elections Commission! It began still at school, I on it was placed by friends from a class physical mat. On changes, furtively in a toilet and round the corner schools we discussed new gadgets and schemes for bugs radio transmitters. I thought just I will be indulged, but then I could not come off any more. Any more never working saw electronics which I was going to repair in the house, during next enchanting razgulya I cruelly killed the Electronics 302 tape recorder. I was punished, but I could not refuse completely the addiction, so I became the secret geek, but even in radio club I for the was not taken and, in clubs it is noticeable little, because of pathos all upside down. When I exchanged the new snow-scooter for the textbook A. Marchenko and the designer of the car radio receiver, I understood that I slide on DNO! I began to be recognized by sight on radio markets and in shops of electronics, I read "Equipment of youth" and mediocre forums on dialup'e at night. I began to wear glasses with simple glasses since and so all called me "four-eyes". Even the father somehow delivered to me 3 in schoolmates. Finally broke when I was thrown by the girl, here I was incurred … I purchased new soldering station, and my account to Aliexpress began to demand blood the increasing part of my modest salary.

Then life was somehow adjusted … a family, children, and already several years I in a tie, but read every day Habr (Giktayms now). I am the manager of very average link, I as all — work at office. I, alas, have no technical education, but when I read the overview of a new gadget, the minicomputer or a payment of automation in consciousness the huge number of ideas already forms where it could be applied (not to offer automation of office toilet). After a short flight of fancy the order and painful waiting of a foreign miracle wonderful usually follows. In time still long-awaited load passes all circles of hell of the sorting centers of the Russian Federation Mail, romanticism gradually from a new sample of the modern genius of technical thought disappears. So there was also with raspberry pi, arduino, a small box with sensors and wires. But here pain developed. A name to it — giving, more precisely a lawn at the dacha.

To mow a lawn — to cut not firewood. And not to drink tea, and not to pass quests, and not behind beer to go. Well you understood...


You ask: why the lawn-mower, summer comes to an end, and winters at us long? Not for nothing in the people speak: "The winter is coming...". Perhaps, the answer — banal laziness or inquisitiveness, it is possible — all together, but to support a lawn in a beautiful type — a task not from simple even at the modest sizes of grounds which are provided at your obedient servant. I decided to combine active desire of knowledge new + raspberry pi model B + arduino + ferrous metal + free will, heroism, professionalism, capitalism, an indifference and cataclysm.

Considered a solution long, considered option of purchase of the ready mower, but came to a conclusion that it will be most convenient to weld the cart most and to attach DVS from a manual lawn-mower.

Robot lawn-mower. From ferrous metal to a prototype

Robot lawn-mower. From ferrous metal to a prototype

Robot lawn-mower. From ferrous metal to a prototype

Robot lawn-mower. From ferrous metal to a prototype

Robot lawn-mower. From ferrous metal to a prototype

The cart is set in motion by two engines with reducers from the VAZ-2108 window wiper (import substitution in operation). At engines not two brushes on a collector as to me it was usual, and three. I did not understand for what the third brush, but that fact that one of wires is connected to the body, and engines had to move diversely for advance, forced me to isolate one of engines from a frame.

Robot lawn-mower. From ferrous metal to a prototype

Robot lawn-mower. From ferrous metal to a prototype

With engines difficult history: in attempt to understand the engine device, I sorted one of them — it already was a harbinger of the fact that the engine with all the horsepowers will go in khalosar a great tabunshchik forever. Generally, "who to som swallows — does not know problems", purchased the new engine and continued to velosipedit and bydlokodit.

The accumulator on 12B is the power source. Arduino receives power supply on USB from raspberry. Raspberry is connected to an USB switch with separate power supply, power supply on it moves from the same accumulator 12v through two parallel L7805 (long travel of the pulse DC-DC converter lasts so far).

Cart wheels are purchased in the construction market. Engines were connected through Monster Motor Shield, but on a good tradition this payment died after connection of power supply to contacts of an output. Vangy holivar in comments on the fact that with curve hands also you should not begin to do nothing, but that if heart asks? Generally som of grams are also not present dramas: we make out the order for the same payment for now we manage two relays since engines on the first couples can turn only in one party. And in general, considering lack of need for PWM, it is possible to make the H-bridge on the basis of the block of 8 relays for Arduino. And how you treat it, dear reader?

Control of engines and poll of sensors (ultrasonic sensors of distance and enkoder on wheels; in version 1.1: infrared sensors of obstacles, the button in a front bumper) Arduino mega 2560 is performed.

Andurina (my wife steadily continues it to call so) is connected to raspberry pi through USB (All modest communication on Serial port). Also the webcam (in version 1.0 for a picture output through Motion) and wi-fi a whistle is connected to raspberry.

Logic of system operation. Outside a grass, on a grass...


Considering as strongly Ilon Mask (and not only he) warned me (I hope that he addressed me too) about danger of Artificial Intelligence, I solved it so far (i.e. II), i.e. Iiyego not to implement in this product that suddenly fallen singularity did not warp everything hvoynik on my section. On Raspberry pi raspbian OS, OpenCV (which so correctly was not got) is set and the web server and FTP are lifted. Management and setup are made through ssh. That code with OpenCV which works at a laptop, does not want to be started on raspberry in any way. After long dances with a tambourine the decision to leave implementation of the functionality tied on OpenCV for version 2.0 was made.

Python 2.7 a script which saves in the table MySQL data on the current provision of the mower in coordinate system (more detailed a bit later) works at raspberry. At the address on IP mowers the matrix (coordinate system) broken into cells is displayed (for convenience 0.5X0.5 meters as it is bevel width). In the table current statuses of cells are specified by different color.

1. Gray — it is unknown;
2. Green — not a mowed grass;
3. Yellow — slanted sections;
4. Red — sections with an obstacle;
5. Blue — section where there is a mower.

Robot lawn-mower. From ferrous metal to a prototype

By clicking free or unknown section it is possible to translate its status in blocked independently to set obstacles.

Besides in version 1.1 on the page there has to be a button of an emergency shutdown, the control knob a fuel valve of DVS and the button of manual control.

In each cycle of work raspbery:


  • expects from arduino of information on end of the previous task (if it was);
  • obtains through arduino information from range finders;
  • processes information from the webcam;
  • if there is an opportunity to move forward, sends to arduino a task to make the movement on one cage (0,5m.) forward. If the cage is ahead blocked (there is an obstacle), sends a task to make turn by 90 degrees to the right.


Arduino in each cycle:


  • polls ultrasonic sensors of distance;
  • For version 1.1:
    — polls the bumper button (at collision with an obstacle switches off the relay of power supply of DVS);
    — polls infrared sensors of obstacles.
  • checks a status of variables from enkoder about turn of wheels;
  • (enkoder work at interruptions, increment the corresponding variables before receipt of the necessary values from which follows that the previous task is performed.);
  • sends to raspbery information on end of a task and data on distance to obstacles;
  • receives a new task.


Short curve video



Full video

Plans for the future, except sounded earlier in the text:


  • To use OpenCV for determination of calibration tags. I.e. we place certain tags (spheres of orange color) on sticks near low plants. We place tags of red color near start or on perimeter border. In OpenCV we do by a mask selection on the necessary color, then we look for a form — a circle. We determine distance by the size of a circle to it and we place in base information for the corresponding square.
  • By means of OpenCV to check the lower part of a frame for average color which has to be green to exclude driving on sidewalks.
  • To connect the second webcam and by means of openCV to create a three-dimensional map of obstacles.
  • To connect to DVS the engine on 12V as the generator, on the mower to create support system of a charge of batteries to exclude need to load it separately.
  • It is possible to use "generator" as a starter.


Bydlokod in open access. Forkayte on health. Only I will be glad to adherents: https://yadi.sk/d/qObAm0deiogvP

Thanks for attention!

This article is a translation of the original post at geektimes.ru/post/261248/
If you have any questions regarding the material covered in the article above, please, contact the original author of the post.
If you have any complaints about this article or you want this article to be deleted, please, drop an email here: sysmagazine.com@gmail.com.

We believe that the knowledge, which is available at the most popular Russian IT blog geektimes.ru, should be accessed by everyone, even though it is poorly translated.
Shared knowledge makes the world better.
Best wishes.