Visit Website: Youtube Channel:
Building upon the code created in Robotics Level 1, this repository contains code to interface the robot with additional hardware such as PiCamera, transistors (for switching 12V high brightness LEDs), Ultrasonic Distance Sensor and Speaker (for text to speech)
The code for interfacing the additional hardware is placed in the following respective folders inside 'earthrover' directory:-
Further, created a Web GUI or Web Control Panel for the robot. Using this panel, user can interact with the robot and control its hardware through a browser.
Brief overview of the code present in this repository is as follows:-
Type | Name | Description | More |
---|---|---|---|
folder | camera_lights | This folder contains code for streaming video using Pi Camera module and interfacing GPIO pins with Transistor switching circuit. The live video feed can be monitored on the Web Control Panel. The panel also has controls to switch ON/OFF the robot lights and camera. | Read Article for detailed code explaination and circuit diagram |
folder | range_sensor | This folder contains code for interfacing Raspberry Pi with Ultrasonic Range Sensor and associated Web controls.The folder contains python files to control Ultrasonic Distance Sensor HC-SR04 for measuring the distance from an obstacle. The distance measured by the sensor is displayed on the Web Control Panel when the sensor is turned ON. The robot is programmed to move backwards in case it detects an obstacle within 30 cm | |
folder | speaker | This folder contains code for Speaker interface (Text to Speech functionality and associated Web Controls. User can type the text on the Web Control panel which is passed to the robot over wifi LAN. The text is converted to robotic speech using ESPEAK module inside Raspberry Pi and spoken out through a mini speaker connected to the audio port of Raspberry Pi | |
folder | css | contains CSS files used in "index.php" and "remote.php" files | |
folder | js | contains Javascript files used in "index.php" and "remote.php" files | |
folder | pwm | contains Python files for speed control of DC motors | |
file | index.php | The main file resposible for rendering Web Control Panel GUI | |
file | remote.php | This file generates the direction and speed control GUI. It is embedded inside the "index.php" file | |
file | vars.php | A file with utility functions. These functions interact with GPIO pins for achieving robotic controls | |
file | ajax_direction.php | receives direction data from client and calls relevant function in "vars.php" | |
file | ajax_speed.php | receives speed data from client and calls relevant function in "vars.php" | |
file | util.py | This file also has utility functions (similar to "vars.php") implemented in Pyhton. It is used when robot's direction needs to be changed programatically. Example: Obstacle avoidance implemented in "range_sensor" folder |