Raspberry Pi Tips

Revision as of 04:34, 9 November 2021 by Brentp (talk | contribs) (→‎Rotate screen 180*)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

  • Open the console based raspi-config application:
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 these selections 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, 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:
  • 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:
  • Add this line:
hdmi_cvt 1024 600 60 6 0 0 0
  • Uncomment and modify these two lines:
  • Save the file by pressing Ctrl + X, type Y, and hit enter.
Cd /opt/racecapture/
Sudo nano run_racecapture.sh
  • Comment out both checks for "check for ar1100 resistive touch" and "check for ft5406 capacitive touch" by putting a # symbol at the front of the line
  • Change kivy settings:
Sudo nano /home/pi/.kivy/config.ini
  • Add these lines to the input section of the file:
mouse = mouse 
mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput
#%(name)s = probesysfs,provider=hidinput
  • Save the file by pressing Ctrl + X, type Y, and hit enter.

General Notes and Commands

Run Racecapture manually

  • If you don't set it up to run automatically, you'll have to use this command to run it manually.

Make cursor visible

  • This may cause lag in the dashboard so it's not recommended except for setup if you elect to use a mouse
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

To kill the watchdog loop until the next restart, you can use the following command:

 killall -9 run_racecapture.sh

Manually shutdown pi

Sudo Shutdown -h now

Manually restart PI

 sudo reboot

Rotate screen 180*

  • This just rotates the display, but does not rotate the touch settings
sudo nano /boot/config.txt
  • Add this line (if HDMI)
  • Add this line (if Official LCD screen)
  • Save the file by pressing Ctrl + X, type Y, and hit enter.

  • If you have a touch screen, you will need to rotate the touch settings for RaceCapture
Sudo nano /home/pi/.kivy/config.ini
  • Modify this line:
mtdev_%(name)s = probesysfs,provider=mtdev,param=rotation=180
  • Save the file by pressing Ctrl + X, type Y, and hit enter.

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

  • I like to keep the dashboard settings similar between my phone, laptop, and in-dash screen. Once you follow the directions in the link, you can save the config file from RaceCapture to the thumb drive and transfer it between devices. In my experience, this was not a foolproof and reliable solution and required a bit of playing around with it, but it's the easiest solution I found.