Difference between revisions of "Raspberry Pi Tips"

From Autosport Labs
Jump to: navigation, search
Line 10: Line 10:
 
*Choose the fastest MicroSD card you can for fastest boot times.  32gb is plenty big and reasonably cheap, Class 10 is preferred.  I used this one:
 
*Choose the fastest MicroSD card you can for fastest boot times.  32gb is plenty big and reasonably cheap, Class 10 is preferred.  I used this one:
 
** https://www.amazon.com/gp/product/B06XYHN68L/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
 
** https://www.amazon.com/gp/product/B06XYHN68L/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
*On a computer, format the card to FAT32 format
+
On a computer, format the card to FAT32 format
*Download the latest Raspberry Pi Image to the PC
+
 
 +
Download the latest Raspberry Pi Image to the PC
 
**Stretch Lite - https://www.raspberrypi.org/downloads/raspbian/
 
**Stretch Lite - https://www.raspberrypi.org/downloads/raspbian/
*Write the image to the SD card using Win32DiskImager
+
Write the image to the SD card using Win32DiskImager
  
 
=Start Pi and Update OS=
 
=Start Pi and Update OS=

Revision as of 13:25, 31 July 2019

Introduction

I started out my Raspberry Pi project as a beginner to all things Pi. There was lots of useful information in the forums, but I still had to learn a lot along the way. Although I don't spell out every detail, this page should help beginners along. All of the "boxes" are text that you will type in or see on the screen. Unless otherwise instructed, press the "Enter" key after typing the text.

I started with a writeup by PS14 on the forums, then added my own notes and additional sections. Huge thanks to PS14 for his awesome notes!

You can pick and choose which sections in these Tips may be appropriate for you. Depending on your setup, not all of them will be.

Install Raspbian Stretch Lite on MicroSD card

On a computer, format the card to FAT32 format

Download the latest Raspberry Pi Image to the PC

Write the image to the SD card using Win32DiskImager

Start Pi and Update OS

  • Place the MicroSD card in the Pi, connect a LAN cable to the Pi's Cat5 connection for internet access, and power up.
  • You will be asked to login to the device:
    • Login: pi
    • Password: raspberry
  • Once you have a blinking command line prompt, update to the latest packages:
sudo apt-get update
sudo apt-get dist-upgrade
  • You will be asked if you would like to continue, press "Y" and press enter
  • Once the upgrade is done, clean the upgrade junk
sudo apt-get clean

Tweak the Pi’s config to make it startup and run faster

sudo raspi-config
  • Use the up and down arrow keys to move the highlighted selection between the options available. Pressing the right arrow key will jump out of the Options menu and take you to the <Select> and <Finish> buttons. Pressing left will take you back to the options. Alternatively, you can use the Tab key to switch between these.
  • Highlight #3 Boot Options, hit the right arrow key, and press enter.
  • Choose Desktop/CLI as Pi
    • Choose B2 Console Autologin (with this you will no longer need to enter the password every time the Pi boots up) and press enter
  • Highlight #4 Localisation Options and hit enter. I live in the Eastern Timezone of the US - customize this to your location.
    • Choose I1 Change Locale
    • Uncheck en_GB.UTF-8 UTF-8 by hitting the spacebar
    • Check en_US.UTF-8 UTF-8 by hitting the spacebar
    • Hit tab so OK is highlighted and hit enter
    • Choose en_US.UTF-8, hit tab to highlight Ok, and hit enter
    • Choose I2 Change Timezone and hit enter
    • Choose US, hit tab to highlight Ok, and hit enter
    • Choose Eastern, hit tab to highlight Ok, and hit enter
    • Choose I4 Change Wi-Fi Country and hit enter
    • Scroll down to US United States, hit tab to highlight Ok, and hit enter
    • Hit enter
  • Highlight #7 Advanced Options
  • Choose A3 Memory split and change 64 to 256 and press enter
  • Exit out of menu and hit enter with “Yes” selected to reboot
  • When the Pi reboots you should now be auto logged in as user "Pi" and have a blinking command line prompt
sudo nano /boot/cmdline.txt
  • Inside this file, make the following changes:
    • Append the following to the end of the line:
quiet splash loglevel=0 logo.nologo
  • Save the file by pressing Ctrl + X, type Y, and hit enter
sudo nano /boot/config.txt
  • Add the following line to the bottom of the file:
disable_splash=1
  • Save the file by pressing Ctrl + X, type Y, and hit enter
  • If you are not using the Pi’s internet,wifi or bluetooth during racing, you can turn these services off to boot up faster. They are easily turned back on when you need to do updates.
sudo systemctl stop dhcpcd.service
sudo systemctl disable dhcpcd.service
sudo systemctl stop hciuart.service
sudo systemctl disable hciuart.service
  • When you need to use the internet to update Pi or RaceCapture, simply enable and start the same services.
sudo systemctl enable dhcpcd.service
sudo systemctl start dhcpcd.service

Change keyboard to US

sudo nano /etc/default/keyboard

Change XKBLAYOUT from “gb” to “us” Save the file by pressing Ctrl + X, type Y, and hit enter

Installing the RaceCapture App

Change to the /opt directory to install the RaceCapture app

cd /opt

Download the RaceCapture app. Update the URL below for the version that you want. This is the latest version as of 2019-07-08.

sudo wget https://autosportlabs-software.s3-us-west-2.amazonaws.com/racecapture_linux_raspberrypi_1.16.0.tar.bz2

Extract the downloaded package. Hit the tab key after typing "race" and it should autofill the name for you so you don't have to type it all out.

sudo tar -xjvf race...

Setup for Mausberry circuit

The Mausberry circuit is a great way to power the Pi on/off with the ignition and (hopefully) prevent the MicroSD card from becoming corrupt.

wget http://files.mausberrycircuits.com/carsetup.sh
sudo bash carsetup.sh
sudo reboot
  • If you want, you can change the minute multiplier in the carsetup.sh file to “60” to change it to seconds. I set my delay to 1 and minutes multiplier to 5, so my delay is 5 seconds.

Make the RaceCapture app Auto-start

  • I recommend waiting until you have everything configured the way you want before making the app auto-start.
sudo nano /etc/rc.local
  • Add the following line before the exit 0 line:
/opt/racecapture/boot_racecapture.sh pi
  • Save the file by pressing Ctrl + X, type Y, and hit enter.
  • Reboot to take effect.
sudo reboot

Set up for DFRobot display

  • If you use the official Pi display, there's not much setup to do. If you choose another display, you may need to configure it. I chose to use a 7" DFRobot display:
sudo nano /boot/config.txt
  • Uncomment this line:
disable_overscan=1
  • Add this line:
hdmi_cvt 1024 600 60 6 0 0 0
  • Uncomment and modify these two lines:
hdmi_group=2 
hdmi_mode=87
Cd /opt/racecapture/
Sudo nano run_racecapture.sh
  • Comment out both checks for "check for ar1100 resistive touch" and "check for ft5406 capacitive touch"
  • Change kivy settings:
Sudo nano /home/pi/.kivy/config.ini
  • Add these lines to the input section of the file:
[input] 
mouse = mouse 
mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput
#%(name)s = probesysfs,provider=hidinput

General Notes and Commands

Run Racecapture manually

/opt/racecapture/run_racecapture.sh

Make cursor visible

This may cause lag in dashboard so not recommended except for setup

Sudo nano /home/pi/.kivy/config.ini
  • Add this to the modules ection
cursor = 1
  • Save the file by pressing Ctrl + X, type Y, and hit enter

Exit RaceCapture

  • Depending on how you have this setup, it may be tricky. This method usually works best for when you have RaceCapture auto-boot.
    • Alt + PrintScreen + K , followed by exiting the app via touch screen

Manually shutdown pi

Sudo Shutdown -h now

Rotate screen 180*

  • This just rotates display, not touch
sudo nano /boot/config.txt
  • Add this line:
display_rotate=2


  • Rotate touch for RaceCapture
Sudo nano /home/pi/.kivy/config.ini
  • Modify this line:
mtdev_%(name)s = probesysfs,provider=mtdev,param=rotation=180

Transfer RaceCapture from Pi to another device (or vice versa)