A simple wifi bot for monitoring rooms or “kitchen” robotics


Today, each of us has a dedicated line with a very “thick” channel. Also, most have a wifi router, and again, most of us do not care about turning it off when we leave home. And really, why? The wifi protection protocols are very reliable, the router consumption is negligible. Hence your home is often or always on-line. But what does this give us? Torrent downloads, personal diverse servers, etc.

Particularly advanced of us have a smart home with a variety of "goodies" and remote monitoring via the Internet. This is the right but expensive solution. But all this makes sense to install only in your home. In the case of removable, this is absurd.

Nevertheless, exacerbations of paranoia, hyperresponsibility, or similar factors (recall the classic situation - “Have I turned off the iron?”) Create some discomfort for us when we leave our home. Especially for the long term. The question arises - how is it that the apartment is on-line all the time, but I do not see and do not control anything. It’s strange.

The most budgetary solution to the questions is to put just a webcam. But one will not be enough, and a developed video surveillance network is already a serious infrastructure and not very cheap. Various options were considered and all the pros and cons were weighed. It turned out that the easiest way to still take one webcam, but to attach wheels (or tracks) to it.

I am well aware that in this place the opinions of readers will be divided into two large groups. The first will argue that the sea of ​​such projects, including here, and the second group will argue that to implement this, you need to be friends with a soldering iron.

That's how we approached the main goal of this material - how to implement this project as cheaply and at the level accessible to many without diving into the jungle of electronics.

Looking ahead I can say that the budget is minimal from $ 70 to the limits of common sense. And it greatly depends on how accessible the components are and how thrifty a particular person is. This price tag was formed in Donetsk (Ukraine), although a progressive city, but where to get certain things is still a problem.


All components of our wifi bot were selected based on the price / availability ratio. Ready-made expensive plastics for lovers of refined Arduino structures were marked right away. Otherwise, the budget would be equal to half the budget of the lunar rover.

1. The chassis. Everything is simple here - we take the first “jeep” we like on the radio control (we will throw it out so we can break it). There, as a rule, there is already a marching engine (which pushes forward) and a rotary engine on the front "bridge". Feel free to rip out the circuit of the RU (radio control) leaving only the wires to the engines and the wires from the battery compartment. You can poke a battery into the motors for general development and see where they turn at a particular polarity. That's how our cart will move.

Fig. 1 Chassis.

2.Brain. A device for broadcasting a video stream and commands to our chassis. We need a device with wifi and a port to control the chassis. And since raspberries (Raspberry Pi) are still available, not everyone will dwell on routers. They like it because they have Wifi, USB and the possibility of customization thanks to custom firmware. There was a lot of mockery at the D-link DIR-320, which he just did not work for, but here it will not be about him. It's time for him to retire. Progress does not stand still and now the TP-LINK TL-MR3020 baby can take the "senior citizen" functions on its shoulders, although it is not a fact that when you read this it will be a better option. The advantages of this model are primarily in size, and secondly, it is more nimble. It should also be mentioned that you do not have a long and tedious to cut the firmware, everything has been done here roboforum.ru/wiki/OR-WRT. Many thanks to the guys from roboforum.ru for their huge contribution to home robotics. Therefore, all that will have to be done is to flash the router and configure it a little for your specific conditions.

Fig. 2 TP-LINK TL-MR3020 Router.

3. The all -seeing eye. The webcam is not suitable for any, but let this thorny choice have already been passed more than once. Firstly, it should support UVC (USB Video Class); here www.ideasonboard.org/uvc has a list. And secondly, it’s good if she herself will compress the flow. The optimal one is Logitech Webcam C100, cheap and high quality. You don’t need to do anything with the camera itself, just install and connect it to a USB router.

Fig. 3 Logitech Webcam C100

4.Engine Control Driver L293D. This is a 16-foot circuit. She does the following - if voltage is applied to one input, then the motor rotates in one direction, and if on the second, then in the other. The circuit supports just two motors. If you do not use it, you will have to bother with the N-bridges, but I promised not to load you with electronics. It costs a penny, and decently takes on a headache.

Fig. 4 L293D engine control driver.

5. The microcontroller. You can use any that you have already mastered. The main thing is that he can take a couple of bytes through UART and, depending on them, set 0 or 1 on the corresponding legs. I used the Arduino Mini Pro of the Chinese spill (please do not kick). Just for beginners, this is the easiest.

Figure 5. Microcontroller.

6. And the last thing is the batteries.I puzzled a lot over power and came to the conclusion that the easiest way to get four AA NiMh batteries. They reach a capacity of 2500mAh, are cheap and are not afraid of overcharging. The latter is important to us because our bot must be able to recharge as there may simply be nobody to charge it. The easiest way to organize this is by connecting the battery directly to the PSU which has the desired voltage (6.4V) and which can provide a current equal to the consumption of the entire trolley + another 50-100mA for unhurried charging of the battery. Thus, the trolley will eat current from the power supply, and the excess will stick to the battery. And no charge schemes are applied here! Yes, seasoned electronics engineers are already sharpening blades, but all this has been working for several months without visible damage. The main thing is to choose the right PSU. The current can be limited by a resistor. I also put a diode and got rid of a probable short circuit or a play-off (if some Schumacher sticks into the charge upside down). This is possible because of the design features, for example, you can just push the contacts on the iron door. Right herepeugeot-citroen.net/viewtopic.php?f=11&t=7332&p=104602 people did an exhaustive battery test for which I would like to thank him.

Fig. 6. Charging.


Batteries are installed on the chassis and, for ease of installation, we make two long tires made of sheet metal that run along the chassis. (The tin from coffee cans is simply delightfully soldered.) To one, we connect the “+” batteries through the toggle switch, with which we will de-energize the entire structure. The minus is naturally connected to the second bus. Thus, all consumers can easily be soldered to the tires and not arrange a bacchanalia of wired connections. We solder the elastic contacts to the same tires in order to “abut” the charging.

Fig. 7 Contacts for recharging.

Next, we finish the router. We need to bring out its internal UART and make it so easy to connect the microcontroller there. I do not advise to solder tightly because you will program the microcontroller several times until you are satisfied with the result. You need to connect this way: earth to earth, plus power to plus, RX to TX and TX to RX. The pinout is here wiki.openwrt.org/toh/tp-link/tl-mr3020 Next, fill in the OR-WRT firmware there, the most detailed instructions are on the link to the wiki above, and configure it for your network. The router is finished.

Fig. 8 Connection arduiny to a router.

Now install the engine driver. Four legs to the plus and 4 to the minus and 4 more wires that are already soldered to the legs of the microcontroller ("RA0", "RA1", "RA2", "RA3"), and to the remaining we solder our engines.

Fig. 9 Connecting the L293D.

This will work as follows if the microcontroller sets a high level, for example, on the leg to which the RA0 wire is soldered, motor No. 1 spins for example to the left, and if RA1 then to the right. I’ll get ahead of the question what will happen if two units are installed - nothing bad will happen, the motor will spin in both directions at the same time. Joke. The engine will not spin. In the case of the N-bridge, this would be a short circuit, but our circuit is not afraid of this, it is foolproof.
The microcontroller should in a continuous cycle simply set a high level on the legs in accordance with the byte received. And that’s all.
Here is the program for the Arduino Mini Pro microcontroller.


For its firmware, you need a regular UART adapter for the computer (not to be confused with RS232, this is the same, but the voltages are different here), I use the old date cable from Siemens phones in general. The pin assignment is the same as when connected to the router, but we need one more DTR pin from the RS232 connector, it is connected to the “GREEN” pin on the microcontroller and when the firmware starts, it is set to “0”, so the controller understands that it will be updated right now. If you can’t get this contact from where you can just click on the Reset of the MK itself in time, I haven’t succeeded, but there are living eyewitnesses on the Internet.

The main thing is to watch that the pins in the program coincided with the pins physically. If the motor does not spin or spin in the wrong direction, just check the soldering, most likely they have mixed it up. You can test it all very simply - after the firmware, do not disconnect the MK from the computer and just send the necessary bytes to the appropriate port.

The firmware process itself is simple to disgrace. Open the sketch in the Arduino IDE, select the appropriate port and version of the MK board in the menu. Click the Upload button and that's it. I will not dwell on this in more detail because there are a lot of articles on the Arduino theme.

So at this stage we already have a chassis that drives motors according to orders from MK which? in turn? receives UART commands. B we have a router that is flashed and configured to connect to the home network via wifi.
Now you need to slightly change the web interface so that commands from it are sent directly to the internal UART of the router. Well, from it, respectively, to MK.

I didn’t bother and assigned the well-known buttons “A”, “S”, ”D”, ”W” to control all of us, that is, if for example MK receives byte “W” (0x57), it will set the unit on the leg to which the wire is soldered responsible for moving forward, etc.

Required file:
Or all together

And a set of different versions of sketches, including the latest version with a servo.

The only thing changed there is that Java scripts that process button presses in the web interface now send “A”, ”S”, ”D”, ”W” depending on the button pressed. And the script itself that is sending is redirected to the internal UART of the router. Files must be replaced with the original files in the WWW directory.

The easiest way to do this is with the wonderful winSCP program winscp.net/eng/docs/lang : ru via SSH.
That's probably all. Having received a wifi bot, you can modify it at your discretion. Add different equipment. For example, replace the rotary motor with a servo drive. This will help keep the wheels turned without the need for energy, but you can do without it.

Fig. 10 Servo.

Charging is performed by a conventional transformer and rectifier. An old video cassette is used as a frame, and the contacts are made of "coffee sheet". All you need to do is to taxi and push the contacts into charging. Even when recharging, excess will go through heat.

I understand that I could not cover everything anyway, and if there are enough questions I can make an extended article.

Finally, a few videos.

Also popular now: