Development of a Wi-Fi Controlled Mobile Video Device on the Arduino NANO Basis

The development of a Wi-Fi-controlled video machine using Arduino NANO is described. The connection diagram of Arduino NANO and additional modules is presented. The relevance of the topic under development is emphasized by the increasing demand for the use of remotely controlled video devices.<br><br>A Wi-Fi-controlled video device (machine) was developed, which is powered by a battery that is connected to the charge controller module with microUSB. Possible battery life is 5-6 hours without recharging.<br><br>In the process of developing a Wi-Fi-controlled video machine, a large amount of work was carried out, including adding the necessary libraries for the correct writing of programs and determining the necessary conditions for the functioning of the device. Program (sketch) for controlling the engines of the machine is also developed; the main components for creating the device are identified.<br><br>For the mobile camera application to work, it is necessary to download the JoyLite application from the AppStore or PlayMarket; after which the smartphone “connects” to the Wi-Fi network and the SANNCE HD 720p camera.<br><br>In the software part of the development of a Wi-Fi-controlled video machine using Arduino NANO in the Arduino IDE software environment, the program (sketch) was developed for the SANNCE HD 720p “JoyLite” mobile application. This program configures the signals from the stepper motors of the camera to asynchronous motors of the machine, as well as adjusting the speed of the wheels.<br><br>During the tests of the device, it turned out that the Wi-Fi-controlled video machine has a sensitivity to speed impacts, namely, the speed should exceed 255 r/s.<br><br>The developed Wi-Fi-controlled video machine can be used in various fields. For example, the device can be used in systems such as "Smart Home" or in security systems, or be implemented as a training project in the course of robotics.


Introduction
For a long time, people needed a safe way to collect video information in various situations, for example, in places with poisonous or infected air, in narrow technical openings, a security perimeter, and the like. Previously, they used all possible means for this: that is, mirrors, binoculars, and the like. Subsequently, they began to use the system of camera probes. Let's note that in the conditions of the city there are many places in which a person cannot directly get into, but in which a small mobile platform on wheels can pass in which the camera is installed. The problem was in managing the platform and timely information received.
The advent of cheap and affordable microcontrollers has led to the use of the Internet for communication of the "human-device" and "device-device" type [1]. Now most residents of modern cities daily transmit or receive any data. At the same time, the modernization of data transmission channels is at an incredibly dynamic pace.
Wi-Fi wireless LAN technology is no longer an innovation. It is used in many areas of human activity, in-cluding in everyday life. An example is the use of tablets, smartphones, laptops or other devices to work on the Internet remotely.
Let's note the development of the Wi-Fi wireless network [2], in the form of public and secure access points available in educational institutions, hotels, restaurants and other public places. Let's also take into account the availability of free access points for all, without restrictions, set at train stations, subways, shopping centers, universities, and, by decision of local authorities, in any public places. So, taking into account the above, studies aimed at developing a device based on the use of Wi-Fi technology and microcontrollers of the most used brands are relevant.

Literature review and problem statement
One of the ways to use technology for transmitting data over a wireless local Wi-Fi network in the developed device is to use the Arduino platform. This platform is used both in educational developments [3] and in modern systems, for example, in solar power plant control systems [4] or security systems [5].
Arduino has established itself as an accessible platform in programming, software, and development methods [6].
In [7], a review of about 100 works was published, which were published in the period 2006-2016, and in which the study of applications and experiments related to the use of Arduino boards was carried out. Based on the study of these works, a great interest in the design of robots on Arduino platforms was noted. The author of the study also notes that Arduino is an ideal platform for educational robotics. In addition, Arduino is the most popular board for amateur and educational electronics [8] and robotics [9], which has many variations with open source projects, textbooks, and forums for beginners [7][8][9].
In [10], when developing a robot-electromechanical machine controlled by a computer and electronic programming, a four-wheeled platform was used. The authors of [10] in their study developed a robot that can be controlled using mobile applications for Android. Researchers also noted that the robot, which is designed, along with quality and repeatability is unparalleled. But this robot does not transmit video information.
In [11], robot on a two-wheeled platform was considered. The system architecture contains a pair of DC motors and an Arduino microcontroller board, a single-axis gyroscope, and two axial accelerometers used to determine orientation. But such a system needs constant position correction.
In [12], a four-wheeled robot was developed for observation using the Arduino and Android APIs. But this robot is too large.
More recent studies by the authors of [13] offer fourwheel DC motors that help control the robot and the ultrasonic sensor to avoid obstacles. The camera is connected to the robot via Wi-Fi. But this robot can also be smaller.
So, an analysis of the literature shows that Arduinobased applications for microcontrollers are very successful in the development and implementation of robotics. But among the solutions considered; there are no solutions that would allow using the standard Arduino sets to minimize the robot size while maintaining its stability in space without constantly adjusting its position.

The aim and objectives of research
The aim is to develop and get a robot in the form of a Wi-Fi-controlled video machine on an Arduino-based platform, which was the smallest when using Arduino components and could perform a fairly wide range of functions.
To achieve the aim, the following objectives are set: -development of a project of Wi-Fi-controlled video machine with a minimum size of the wheel platform, which ensures stability of movement; -writing a sketch, which has the ability to decode the signals from the stepper motors of the camera, the function of transmitting signals to asynchronous motors of the machine and setting the speed of rotation of the wheels of the machine in the Arduino IDE software environment; -configuring the SANNCE HD 720p camera model I21AG with Wi-Fi network and robot motion control.

Materials and research methods in the design and development of Wi-Fi-controlled video machines
The following Arduino modules are used: Arduino Uno, Arduino Leonardo, Arduino Ethernet, Arduino Mega 2560, Arduino Mini, Arduino Micro, Arduino Due, LilyPad Arduino, Arduino Pro, Arduino Yún, Arduino NANO 2.x, Arduino NANO 3.0, when designing the robot, Arduino NANO 3.0 was chosen. The advantages of this module are its small size and ATmega328 memory, the volume of which is 32 KB (of which 2 KB allocated for the bootloader).
Connection to a PC is via a mini USB cable. Among the components of Arduino, Table 1, enclosure No. 4 was elected, which, with its miniature size, allows to place a video camera. The following components were used for the WiFi-controlled video machine: 1. Arduino NANO Atmega328p and USB cable. 2. SANNCEHD 720p Wi-Fi camera model I21AG with charger.
3. Machine body kit (platform with two DC3V-6V gear motors and three wheels -two main and one auxiliary).
4. Two ceramic capacitors 0.1-10 µF. 5. L298N motor driver. 6. The 18650 battery and a compartment under it. 7. Boost Retractor MT3608. 8. MH TP4056-PROTECT 5V charge controller module. 9. Connecting wires. A more detailed image of the elements necessary for the development of a WiFi-controlled video machine, with the selected SANNCE HD 720p WiFi camera model I21AG, is presented in Fig. 1.
A typewriter body kit (a platform with two DC3V-6V gear motors and three wheels) with a universal chassis configuration has the ability to adapt to various machine assemblies.
Also, for the correct operation of two gear motors, two ceramic capacitors of 0.1-10 µF are installed [14].
The Arduino L298N motor driver is used to control two low-power DC collector motors or a low-power 4-wire twophase stepper motor [14]. In practice, it is used to control the engines of small wheeled robots or the engines of mobile toys [15]. To fix the module on a flat surface, the board has one mounting hole.
Driver power is supplied either from the Arduino controller, or another microprocessor control device or an external power source (power supply, battery). The supply voltage is 2-9 V DC. The control signal is 1.8-7 V DC. The maximum current consumption of connecting motors is up to 1.5 A.
The step-up voltage converter MT3608 is designed to receive voltage up to 28 V with a load current of up to 2 A from a low-voltage voltage source. The regulator on the converter board allows you to select the desired output voltage level.
The MH TP4056-PROTECT 5V charge controller module is based on the TP4056 chip -a charge controller for Li-Ion and Li-Po 3.7 V batteries with a built-in temperature sensor. TP4056 automatically completes the charging cycle when it reaches a voltage of 4.2 V and the charge current drops to 1/10 of the programmed value. The module has an indication of the charge process. At the time of charging, the red LED lights up, and when the battery is fully charged, the green LED lights up, the red one turns off. The project uses an 18650 battery and a compartment PV-3 connecting wires with a cross-sectional area of 0.75 mm 2 is a power wire consisting of a monolithic copper conductive core with a cross section of 2 to 95 mm 2 and polyvinyl chloride insulation. For convenience, the differences of the poles in the circuit, different colors were used.
As a method of researching the operation of a finished video machine, it was tested in action, the test data are given in Table 2.

Research results for the development of Wi-Fi-controlled video machines
Arduino NANO is a small, mock-compatible device on the ATmega328 microcontroller with a clock frequency of 16 MHz. The controller provides 32 KB of flash memory for storing firmware, 2 KB of RAM and 1 KB of non-volatile EEPROM memory for data storage. To connect to the computer, the CH340G chip is used (the driver for it must first be installed at the beginning of work with Arduino). Arduino NANO can be powered by a Mini-B USB connector or an external 6-12 V power supply (pin "Vin"), or 5 V stable external power (pin "5V"). The power automatically switches to a higher voltage source.
The purpose of the module in a Wi-Fi-controlled video machine is to connect the power via a standard micro USB connector. At the same time, we note that power supply via a micro USB wire is impractical, because freedom of movement is needed to move a Wi-Fi-controlled video machine. To achieve this goal, the project uses a 18650 battery and a compartment. If the battery runs out, the charger is used.
When choosing a Wi-Fi camera, they were guided by its size and a list of functions that are performed. The SANNCE-HD 720p model I21AG Wi-Fi camera was selected (Fig. 1). The SANNCE HD 720p I21AG Intelligent Wireless Wi-Fi IP Camcorder with night motion sensor has a number of features: -P2P technology -the ability to watch what is happening in the room or hole, to control the camera in real time (from anywhere in the world, only Internet access is required); -reversing camera -horizontally 350°, vertically 90°; -clear night shooting, thanks to built-in IR illumination, visibility up to 8 meters (daytime shooting up to 30 meters); -record video and photos on a memory card, smartphone/tablet or FTP server (support for memory cards up to 64 Gb); -two-channel audio communication has a built-in microphone and speaker; -security device mode -activation of an alarm about movement in the camera's field of view (it is possible to set a certain time during which a notification will come to the smartphone if movement is recorded in the camera's field of view); -dual stream technology (local recording is carried out separately from remote viewing); -special software (JoyLite) with which you can control the camera.

Fig. 1. SANNCE HD 720p Wi-Fi Camera Model I21AG
Arduino NANO is connected to the SANNCE HD 720p Wi-Fi camera and the L298N motor driver. The connection to the camera was due to 6 wires A0 -A5, which are connected to the microprocessor of asynchronous motors on the camera. The L298N motor driver is connected to the Arduino NANO using INT1 -D3, INT2 -D9, INT3 -D10, INT4 -D11 (Fig. 2).

Fig. 2. ArduinoNANO connection diagram
To connect the engines, they were connected to the ports of Motor-A (right motor) and Motor-B (left motor) on the L298N driver. Connecting wires from the driver to the gearmotors. To control the motors, the standard library AFMotor.h [15] was used.

Speaker Camera SANNCE HD 720p Arduino Nano
The Wi-Fi-controlled video machine (Fig. 3) was powered by a battery, which is connected to the micro USB charge controller module. The project scheme also includes an adjustable step-up converter 2 A -28 V MT3608 to increase the voltage, because the rotation speed of DC motors when connecting the Arduino board from a computer and a power supply or batteries is significantly different. From the boost converter, the power goes to the SANNCE HD 720p Wi-Fi camera, Arduino NANO. The L298N motor driver, which in turn supplies power to the motors through ceramic capacitors, is connected to the charge controller module along with the wires of the «+» and «-» poles of the boost converter.
After identifying all components, the complex part of the development was the software part, which provided decoding of signals from stepper camera motors and transmission of signals to asynchronous motors of the machine.
Considering that to perform the functions of the movements of the motors of the machine, there are enough signals of the form of a vector with three Boolean variables, then three wires for each motor were connected to the camera microcontroller.
In the software part of the development of a Wi-Ficontrolled video machine using Arduino NANO in the Arduino IDE software environment, the program code was created for the SANNCEHD 720p "JoyLite" camera mobile application. This program (sketch) has the ability to decode signals from stepper camera motors, the function of transmitting signals to asynchronous motors of the machine and adjusting the speed of rotation of the wheels of the machine.
The decoding algorithm of the camera motor signals is valid all the time when the typewriter receives a signal from a smartphone.
When determining, with the help of an algorithm, the movement of the camera motors, the received data is written into the motorsTrick function in the program code. This function also transmits signals to the motors of the machine through the motor driver.
After transmitting information to the machine's motors, it is possible to adjust the wheel speed.
The block diagram of decoding signals from a stepper motor and supplying the corresponding signals to asynchro-nous motors is shown in Fig. 4, and some fragments of the sketch are shown below: #define FRW_SPEED 120// forward speed (0-255) #define BKW_SPEED 90// backward speed (0-255) #define TURN_SPEED 95// rotational speed (0-255) #define MOVE_TIME 3// time that the car rides after the command (seconds) #define TURN_TIME 0.4// time that the machine spins after the command (seconds) #define TIMEOUT 700// driver exit polling timeout (duration of signal sending to CAMERA motors) #define START_DELAY 100// turn-on delay, seconds (waiting for camera calibration) #define Setting the speed of movement forward, backward, rotations, the one with which the machine goes after the command, and the one with which the machine rotates after the team, caused many problems during development. As it turned out, in a Wi-Fi-controlled video machine there is sensitivity to its speed limits, namely, the speed should be no more than 255 r/s.
In addition, with this connection of cameras and stepper motors, the functions of the reversing camera are disabled. The appearance of the finished device, the dimensions of which in the finished form are: the width to the outer side of the axle of the wheels is 155 mm, the length is 260 mm, the height with wheels and the camera is 190 mm, shown in Fig. 5.
For the mobile application of the SANNCE HD 720p JoyLite camera: firstly, the JoyLite application was downloaded from the AppStore or PlayMarket; after downloading the application to the smartphone, they tied up the wellknown Wi-Fi network and the SANNCE HD 720p camera. Upon completion of the setup, the "live-video" camera is connected in the "JoyLite" application.  Table 2. It reflects the effect of the type of surface on the operating time of the device, the effect of the type of lighting on the camera, type of control device. So, as can be seen from the Table 2, control of the machine is possible both using a PC and using a smartphone. The image obtained with the help of a video camera is enough to use the developed device for fixing and observation.
Checking the additional features of the camera, shown below, shows that they can be fully utilized: -record video and photos on a memory card, smartphone/tablet or FTP server (support for memory cards up to 64 Gb); -two-channel audio communication has a built-in microphone and speaker; -security device mode -activation of motion alarm in the camera field of view; -dual stream technology (local recording is carried out separately from remote viewing).

Discussion of research results on the development of a Wi-Fi-controlled mobile device on a wheeled platform (video machines)
Developed Wi-Fi-controlled video machine are tested. The results reveal a high quality image transmission (Table 2, HD=1080p), which is clear even in a dark room (720p) at a distance of up to 8 meters and in daylight at a distance of up to 30 meters, respectively, of the characteristics of the camera. When connecting the machine to a smartphone or computer, ease of operating the machine is noted, which does not require special skills due to the presence of an interface similar to those widely used in computer games or radio-controlled toys. Therefore, it can be controlled even by a child if he has the necessary device configured for the machine.
It should be noted that the project development plans are considering the possibility of increasing the operating time of a Wi-Fi-controlled video machine without additional recharging up to ten hours.
The developed device, using the developed sketch, allows to control the engines of the machine using the camera's mobile application via Wi-Fi control based on the Arduino NANO platform.
Disabling the reversing camera function is compensated by the twists and turns of the robot itself.
Using the Arduino NANO platform allows to place additional sensors and add new functions on the same device in the future [7,13]. But this is the subject of the following studies.
In addition, the further use of schemes already developed and worked out during research also leads to increased competitiveness of the product.
Performs tests show the performance and quality characteristics of the device are shown in Table 2.
According to the results of the demand analysis, the developed Wi-Fi-controlled video machine can be used in various industries. For example, a device can be integrated into the Smart Home system [7], a security system [12]. Also, this project can be used or carried out as a training course in robotics [3,7].

Conclusions
1. The developed Wi-Fi-controlled mobile device has a three-wheeled platform of a video machine, allows to minimize dimensions to the following values: width to the outer side of the wheel axle is 155 mm, length 260 mm, height with wheels and a camera 190 mm using standard parts from Arduino kits. In addition, the use of the Arduino NANO platform allows to place additional sensors on the same device and add new functions.
2. Connecting to Wi-Fi networks found high quality image transmission, which is 1080p in daylight up to 30 meters and 720p in eclipse or at night, thanks to the built-in IR illumination, and is clear even in a dark room at a distance of up to 8 meters. When controlling, thanks to the sketch written, the movement of a Wi-Fi-controlled video machine, its ease is determined due to the presence of an interface similar to those widely used in computer games or in radio-controlled toys, it does not require special skills.
3. The above characteristics of the device allow to say about the possibilities of its use in the systems of "Smart Home", security, etc. In addition, this project can be carried out as a training course in the course of robotics.