- Robot controller circuit diagram
3- Controlling a NAVQ+ Robot With HTML WEB SERVER and Shell Scripts Only
The idea is to control the robot (or anything), using low level commands written with shell scripts commanded straight from a HTML page. Not using higher level languages as Python for example, makes the robot very responsive and quick to act.
First :Installing the LIGHTTPD WebServer
LIGHTTPD that is a very “light” and fast WebServer http://redmine.lighttpd.net/projects/lighttpd/wiki
Lighttpd is a secure, fast, compliant, and very flexible web-server that has been optimized for high-performance environments. It has a very low memory footprint compared to other WebServers and takes care of cpu-load
Let's install Lighttpd web server and components:
sudo apt-get -y install lighttpd
sudo lighttpd-enable-mod cgi
sudo lighttpd-enable-mod fastcgi
Lighttpd is looking for a index.html page at /var/www/html. We will change it, so the index.html will be placed under /var/www. For that, we must edit the Lighttpd config file:
sudo nano /etc/lighttpd/lighttpd.conf
change:
server.document-root =“/var/www/html”
by:
server.document-root =“/var/www”
to allowed this change to take effect, we must stop and re-start the web server:
sudo /etc/init.d/lighttpd stop
sudo /etc/init.d/lighttpd start
At this point the web server is running and if a page index.html is located at /var/www, we can access it from any browser, typing the NAVQ+ address you can see the default web page by lighttpd
stop the server again to include your actual web page and.cgi files
sudo /etc/init.d/lighttpd stop
Clone my repository to your navq+ user space or any where
git clone https://github.com/eslamfayad/Hover_Games3_E.F.git
copy the required folders (images, cgi-bin), and index file to /var/www
sudo cp -r source destination(/var/www)
sudo cp -r "yourdirectory"/Hover_Games3_E.F/ROBOT_WEB_SERVER/images /var/www
sudo cp -r "yourdirectory"/Hover_Games3_E.F/ROBOT_WEB_SERVER/cgi-bin /var/www
sudo cp "yourdirectory"/Hover_Games3_E.F/ROBOT_WEB_SERVER/index.html /var/www
till this point you are ready to run the server and see robot control web page
But first you must change the permissions of index.html:
sudo chmod 755 index.html
also give a permission to each.cgi file to be excuteable
sudo chmod 755 forward.cgi
sudo chmod 755 Reverse.cgi
sudo chmod 755 right.cgi
sudo chmod 755 left.cgi
and so on
NavQ+ i2c Configuration and setupif not installed, install i2c tools
sudo apt-get update -y
sudo apt-get install -y i2c-tools
Add navq user to i2c groupTo use the i2c commands without root, you'll need to add the navq user to the i2c group. To do this, you can run the following command:
$ sudo usermod -a -G i2c user
$ sudo su
$ echo 'KERNEL=="i2c-[0-9]*", GROUP="i2c"' >> /etc/udev/rules.d/10-local_i2c_group.rules
Checking connectionOnce your Arduino Nano and Bme688 sensor is connected using the I2C JST-GH connector, you need to confirm that the NavQ recognizes the Arduino Nano and Bme688 sensor as an I2C devices. To do this, you can run the following command on the NavQ+:
$ i2cdetect -y 5
You should see a device at address 0x77 for temperature sensor and 0x32 for arduino nano. If there is no device at address 0x77, 0x32, you'll need to check your wiring.
and now give the i2c hardware permission, which
grants read and write permission to everyone
sudo Chmod 666 /dev/i2c-5
now you can start running server
sudo /etc/init.d/lighttpd start
in your browser you can hit your NAVQ plus ip address and see the server
now you have te control of your robot using buttons also camera pan- tilte, speed of the motor
also you can use your keyboard to control the robot as if in a GAME
W for forward
S reverse
A for left
D for right
4- Reading Tempeature and humidity and air quality using Bme688 and send data to HTML WEB SERVERplanned future work
Stream video from Google coral camera to the web server
Use ROS to manage the robot path using sensors and camera to scan the farm and create a map for the farm
References:
IoT - Controlling a Raspberry Pi Robot Over Internet With HTML and Shell Scripts Only
Comments