Stage 2: Extinguishing fire
Constant feedback from sensors is fed to the main module through CON4, and hence position of the fire with respect to the robot is determined. The main module includes an ATmega16 microcontroller, two L293D motor driver ICs to drive motors, a water pump and RF receiver RX1. The circuit diagram of the main module is shown in Fig. 4.
The basic function of the algorithm is to orient the front sensor in front of the fire so that the nozzle of the pump comes directly above the fire source. When this is achieved, the pump starts and extinguishes the fire.
The robot moves with the help of two motors, whose sense of rotation is controlled by the controller, depending on the feedback from the sensor.
Stage 3: RF communication and manual control (manual mode)
The robot is controlled by the operator with the help of a wireless remote (circuit diagram is shown in Fig. 5) that uses an RF module for communicating with the robot.
Switches, push buttons and joysticks are provided on the remote that controls various tasks such as autonomous mode selection, reset and starting the pump. For each command, the remote sends a specific character that is received by the robot and the corresponding operation is performed.
Specimen code for autonomous mode is given as below:
[stextbox id=”grey”]For remote (transmitter):
i=’h’; //auto mode
For robot (receiver):
case ‘h’: //auto mode
Programming of the AVR is done using embedded C language. It is similar to C language but includes all functionalities of C as well as access to AVR pins, peripherals and controls. C code is converted to hex code using WinAVR.
Hex codes generated are burnt into MCUs for the main module (robot) and the remote module. Working of the program is explained as comments in the main module (robot) and remote module source codes.
The program jumps to the main function where the object code actually starts. At remote module, a DIP (DIP1) switch is interfaced using which you can select operating mode (autonomous or manual), switching of the water pump, reset all settings or LED indicators test mode as given in Table I.
Tools used are described below:
WinAVR is a suite of executable, open source software development tools for Atmel AVR series. It includes GNU GCC compiler for C and C++, Programmer’s Notepad, Makefile, etc.
Programmer’s Notepad (PN)
This is a source editor with some IDE features. PN can call any command-line tool and capture its output. It is ideal for calling make utility, which executes make file, which, in turn, calls the compiler, linker and other utilities used to build your software.
WinAVR now includes MFile utility, an automatic make file generator for AVR GCC, which can run on various platforms including Windows, FreeBSD and Linux. You can use this utility to quickly generate make files for your project based on some simple menu input.