Video Car
Raspberry Pi like a Wifi Router
Raspberry Pi like a Wifi Router
Upgrade Raspberry Pi software
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
lsusb
iw list
See if exits Mode:AP it is an access point compatible router
Install this packs
sudo apt-get install isc-dhcp-server hostapd
Config DHCP Server
sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.orig
sudo nano /etc/dhcp/dhcpd.conf
#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;
authoritative;
Add
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.2 192.168.2.30;
option broadcast-address 192.168.2.255;
option routers 192.168.2.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name "local";
option domain-name-servers 8.8.8.8, 8.8.4.4;
}
sudo cp /etc/default/isc-dhcp-server /etc/default/isc-dhcp-server.orig
sudo nano /etc/default/isc-dhcp-server
INTERFACES="wlan0"
sudo cp /etc/network/interfaces /etc/network/interfaces.orig
sudo nano /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow hotplug wlan0
iface wlan0 inet static
address 192.168.2.1
netmask 255.255.255.0
sudo ifconfig wlan0 192.168.2.1
Config Access Point
sudo cp /etc/hostapd/hostapd.conf /etc/hostapd/hostapd.conf.orig
sudo nano /etc/hostapd/hostapd.conf
interface=wlan0
ssid=RaspiAP
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
sudo cp /etc/default/hostapd /etc/default/hostapd.orig
sudo nano /etc/default/hostapd
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Config to route traffic
sudo cp /etc/sysctl.conf /etc/sysctl.conf.orig
sudo nano /etc/sysctl.conf
net.ipv4.ip_forward=1
sudo sysctl -p /etc/sysctl.conf
Enable NAT
sudo iptables -t nat -A POSTROUTING -j MASQUERADE
Config startup
sudo update-rc.d hostapd enable
sudo update-rc.d isc-dhcp-server enable
sudo mv /usr/share/dbus-1/system-services/fi.epitest.hostap.WPASupplicant.service /home/pi
Run Html_Server
Run Html_Server
pi@raspberrypi:~/Sunfounder_Smart_Video_Car_Kit_for_RaspberryPi/html_server $ sudo python manage.py runserver 0.0.0.0:8000
Browse http://192.168.2.1:8000/ to see all available commands
Browse http://192.168.2.1:8000/ to see all available commands
Request Method:
GET
Request URL:
http://192.168.2.1:8000/
Using the URLconf defined in html_server.urls, Django tried these URL patterns, in this order:
^admin/
^motor/forward
^motor/backward
^motor/stop
^camera/increase/y
^camera/decrease/y
^camera/increase/x
^camera/decrease/x
^camera/home
^motor/set/speed/(\d{1,3})
^turning/(\d{1,3})
^calibrate/getconfig
^runmode
^calibrationmode
^calibrate/turning/(.)/(\d{1,3})
^calibrate/motor/run
^calibrate/motor/stop
^calibrate/motor/left/reverse
^calibrate/motor/right/reverse
^calibrate/confirm
^calibrate/pan/(.)/(\d{1,3})
^calibrate/tile/(.)/(\d{1,3})
^test/(.)/(\d{0,3})
^client/
The current URL, , didn't match any of these.
Browse http://192.168.2.1:8000/client
Browse http://192.168.2.1:8000/client
See a html client like the image :