Installing the Code!!!
Part 1: Dependencies
The software relies on other programs to run smoothly. We'll install these now.
- Install Main Dependencies
sudo apt install git -y sudo apt install python3-pip -y sudo apt install python-setuptools -y sudo apt install python3-flask -y sudo apt install python-flask -y sudo pip install django-templates
- Now, we're going to install the official PiCar-V code.
cd ~/ git clone https://github.com/sunfounder/SunFounder_PiCar-V.git
- Enter the directory
cd ~/SunFounder_PiCar-V
- Install smaller dependencies
sudo ./install_dependencies
- VERY IMPORTANT!!! REBOOT THE CAR
sudo reboot now
sudo reboot now
Right now's a great time to move the car to battery power if plugged into the wall.
Part 2: Extra Settings
In this part, we'll enable I2C in the Pi's Config. This allows you to control the motors. Don't worry, this one's quick, and you're almost ready to drive :}}}}
- Enter the Raspberry Pi config
sudo raspi-config
- Select interface options by using the number on the option, and using your keyboard.
- Enable I2C by moving down to the option and pressing enter.
Part 3: Drivers and Services
Now, we'll install the drivers for the servos on the car, and we'll make some code to ensure the program runs on bootup.
cd ~/SunFounder_PiCar-V
2. Run the Servo Setup Script - This will move servos in the car, so make sure it is on the floor in an open space.
picar servo-install
3. This next part sets up AutoStart for the remote control program. We'll make a new "service file" so the pi knows to start it after booting.
sudo nano /lib/systemd/system/PiCar.service
4. Paste the following code, then exit.
[Unit]
Description=PiCarServer
After=multi-user.target
[Service]
Type=idle
ExecStartPre=/bin/sleep 15
ExecStart=/usr/bin/python3 /home/pi/SunFounder_PiCar-V/remote_control/manage.py runserver 0.0.0.0:8000
[Install]
WantedBy=multi-user.target
5. Now we'll enable the service with the following commands.
sudo systemctl daemon-reload
sudo systemctl enable PiCar.service
DONE! The next page explains how to connect to the car.