Skip to content

neptune46/RaspiWebCar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RaspiWebCar

A toy car controlled by raspberry pi through web browser

Setup Raspberry Pi

1. Install Raspbian OS

2. Setup raspbian mirror and execute system update

3. Setup samba share

  • Install samba: sudo apt-get install samba samba-common-bin
  • Edit samba configure: sudo nano /etc/samba/smb.conf
    • Find the entries for workgroup and wins support, and set them up as follows
      workgroup = your_workgroup_name
      wins support = yes
    
    • Add below section at the end of conf file
      [pihome]
        comment= Pi Home
        path=/home/pi
        browseable=Yes
        writeable=Yes
        only guest=no
        create mask=0777
        directory mask=0777
        public=no
    
  • Set samba password: sudo smbpasswd -a pi
  • See this artical for more details
  • Some useful samba commands
      sudo /etc/init.d/samba start
      sudo /etc/init.d/samba stop
      sudo /etc/init.d/samba restart
      testparm
    

4. Install python Flask web framework

  • sudo apt-get install python3-flask

5. Assembly raspberry car

  • Parts list

    • Raspberry Pi 2 x 1
    • L298N x1
    • DC motor x 4
    • 5V battery (Power PI)
    • 12V battery (Power motors)
  • wiring

  • wiring

  • wiring

6. Control program

  • Frontend: HTML + JQuery/Ajax + Hammer (touch screen library)
  • Backend: Flask web server
  • Car Control: Python RPi.GPIO library

7. Connect raspberry car with android smart phone through WIFI

  • To play with it outdoor where there is no router available, need to use WIFI Direct mode.
    • The easiest way is to use the "hot spot" functionality of smart phone
    • Disable normal wifi and data network, then enable WIFI hot spot (setting SSID and password in the first time).
    • Connect raspberry car with this hot spot as usual (setting a static IP address in Raspbian if neccessary).
    • One additional benefit of this way is, we can use phone to manage wifi connection status.

8. Start program and control car

  • Install SSH client JuiceSSH on android phone and login raspberry car.
  • Start program use command: "python webcar.py"
  • Open browser to connect to Flask server with specified IP address "http://192.168.43.24:3000/"
  • If success, a control pannel will be displayed in a web page. Use finger to touch on this area to control car moving.

9. Demo video

  • video