Raspberry Pi Tips: Difference between revisions

 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=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=
*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
*On a computer, format the card to FAT32 format
*Download the latest Raspberry Pi Image to the computer
**Stretch Lite - https://www.raspberrypi.org/downloads/raspbian/
*Write the image to the SD card using Win32DiskImager
**https://raspberry-projects.com/pi/pi-operating-systems/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, connect a keyboard, monitor, (and mouse if you wish), then 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:
<pre>
sudo apt-get update
sudo apt-get dist-upgrade
</pre>
*You will be asked if you would like to continue, press "Y" and press enter
*Once the upgrade is done, clean the upgrade junk
<pre>sudo apt-get clean</pre>
=Tweak the Pi’s config to make it startup and run faster=
=Tweak the Pi’s config to make it startup and run faster=
*Open the console based raspi-config application:
*Open the console based raspi-config application:
Line 153: Line 122:
*Depending on how you have this setup, it may be tricky.  This method usually works best for when you have RaceCapture auto-boot.
*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
**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:
<pre> killall -9 run_racecapture.sh</pre>


===Manually shutdown pi===
===Manually shutdown pi===
<pre>Sudo Shutdown -h now</pre>
<pre>Sudo Shutdown -h now</pre>
===Manually restart PI===
<pre> sudo reboot</pre>


===Rotate screen 180*===
===Rotate screen 180*===
*This just rotates the display, but does not rotate the touch settings
*This just rotates the display, but does not rotate the touch settings
<pre>sudo nano /boot/config.txt</pre>
<pre>sudo nano /boot/config.txt</pre>
*Add this line:
*Add this line (if HDMI)
<pre>display_rotate=2</pre>
<pre>display_rotate=2</pre>
*Add this line (if Official LCD screen)
<pre>lcd_rotate=2</pre>
*Save the file by pressing Ctrl + X, type Y, and hit enter.
*Save the file by pressing Ctrl + X, type Y, and hit enter.


Line 172: Line 150:


===Transfer RaceCapture from Pi to another device (or vice versa)===
===Transfer RaceCapture from Pi to another device (or vice versa)===
*https://www.raspberrypi-spy.co.uk/2014/05/how-to-mount-a-usb-flash-disk-on-the-raspberry-pi/
*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.
**https://www.raspberrypi-spy.co.uk/2014/05/how-to-mount-a-usb-flash-disk-on-the-raspberry-pi/

Latest revision as of 04:34, 9 November 2021

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:
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
  • 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:
[input] 
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.
/opt/racecapture/run_racecapture.sh

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)
display_rotate=2
  • Add this line (if Official LCD screen)
lcd_rotate=2
  • 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.