Quick How-To Raspberry Pi 3 Dashboard setup.
(WIP) - will be updating this more once I complete this project.
WHAT THIS DOESN'T HAVE
- Code that listens and parses CAN messages. (Though I do use this and it is amazing)
Quick Hardware Review
- Gauge Cluter/Dashboard
- A raspberry pi will listen for CANBUS messages and whatever program you use (or make) will reactive to those messages.
- I used Two apps:
- backend Node.js app that listens to CAN messages (and sends info to a front end via websockets)
- front Chromium web app that displays your information. (you can use whatever you want though)
- Powered by car's 12v (using DC-DC converter)
- Everything auto-starts on power up
- Everything saves and closes on power down
My Parts List (yours may vary)
- Raspberry Pi 3
- PiCAN2
- Heatsinks - (keep that CPU cooler)
- 7" Raspberry Pi Touchscreen Display
- DC-DC converter (12v input to 5v usb) - Use this to power your Pi in the car
- Powerblock for safe power on and power off
Initial Pi setup
Folow what I have below but also feel free to give this a quick look too: heavily inspired by this
Get the OS image installed
- Download and RASPBIAN STRETCH LITE onto your micro SD card.
Initial Configuration
(configure the pi) in the console:
sudo raspi-config- Go to Change User Password and CHANGE LOGIN PASSWORD
- Go to Network Options: setup wifi if needed; you want to update your firmware, drivers, software, etc.
- Go to Boot Options --> B1: Desktop / CLI: console - Auto login (So when it powers up, it automatically logs in. You can turn this off later after development if needed)
- Go to Boot Options --> B2: Wait for Network Boot: NO (dont wait for it - it will boot faster but may take a bit before you can actively do a apt-get or ssh action )
- Go to Interface Options --> SSH: YES (makes it so you can log into your Pi through your wifi)
- Go to Advance Options --> memory split: 256
- (anything else you want, you can always come back)
- FINISH
Make sure to update everything before proceeding
sudo apt-get -y update && sudo apt-get -y upgrade ; sudo apt-get autoremovesudo reboot
Install Video Driver
This will be needed to get Chromium hardware accelerated.
- Install drivers:
sudo apt-get install libgl1-mesa-dri - Then enable the the driver:
sudo raspi-config - Advance Options --> A7: GL Driver --> G2 (FAKE KMS)
- This will allow chromium to hardware accelerate stuff...(but more on that later)
- Reboot:
sudo reboot
Setup for required GUI stuff
Chromium and the thing that will "host" chromium
sudo apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit openboxsudo apt-get install --no-install-recommends chromium-browser
Configure xserver / Chromium
openbox is now installed; let's make it so our window's manager starts up chromium (auto start stuff comes later)
sudo nano /etc/xdg/openbox/autostart
# Disable any form of screen saver / screen blanking / power management
xset s off
xset s noblank
xset -dpms
# Allow quitting the X server with CTRL-ATL-Backspace
setxkbmap -option terminate:ctrl_alt_bksp
# Start Chromium in kiosk mode
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
chromium-browser --kiosk --disable-overscroll-edge-effect --disable-sync --disable-suggestions-ui --disable-signin-promo --mmal-frame-copy --mmal-frame-buffers=4 --ignore-gpu-blacklist --enable-native-gpu-memory-buffers --start-maximized --disable-infobars 'http://your-url-here'
- Above - we eliminate basically ALL of the tool bars, notifications etc.
- We also enable a bunch of crap so we can get "accelerated" canvas, etc
- Later - when we get our web server running,
http://your-url-herewill be replaced with our actual url. - To start chromium now: type
startx -- -nocursor - To quit chromium/x server - hit
Ctrl-Alt-Backspace
Auto Start Chromium
sudo nano /home/pi/.bash_profile
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor
PLAYING WITH CAN
Installing needed drivers
sudo apt-get -y install can-utils libsocketcan2 libsocketcan-dev
Setting up PiCAN2
PiCAN2 Device Overlays (enable CAN device)
- Enable SPI either through
raspi-configor adddtparam=spi=onto/boot/config.txt - put the following in:
/boot/config.txt
#CAN bus controllers
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi-bcm2835-overlay
auto-start CAN interface on bootup
sudo nano /etc/network/interfaces- Paste this into there
auto can0
iface can0 inet manual
pre-up /sbin/ip link set can0 type can bitrate 500000 triple-sampling on
up /sbin/ifconfig can0 up
down /sbin/ifconfig can0 down
helpful links:
- Raspberry Pi & CAN-bus
- Stack Exchange
- Node-CAN NodeJS library that is ready to rumble for CAN messages
Powerblock
5v power from your DC-DC will go directly to this! You're ignition 5v switch/signal with go to the Powerblock's signal jumper.
- Install their driver. That's it.
Install NodeJs
- For the most current, navigate to Install Node.js on Raspberry Pi
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -sudo apt-get install -y nodejs
MAKE A BACKUP
Now that we have installed most of the required OS stuff....LET'S MAKE A BACKUP! Whenever you make successful changes to your OS, always backup your SD image just in case you corrupt your SD card's file system. (like if you shutdown incorrectly, or install something crappy, or screwup a boot config...etc etc etc)
- READ THIS PAGE
- From your mac:
sudo dd bs=4m if=/dev/rdisk2 of=someCoolBackupName.img
This comment has been minimized.
nooklyn1 commentedJul 17, 2020
how are you planning to set up the web server?