Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Raspberry pi 3 - setup

Fix issue with ping

$ sudo chmod U+s /bin/ping

enable VNC

$ sudo raspi-config
  • Navigate to Interfacing Options.
  • Scroll down and select VNC > Yes.

Remove Uneeded Packages

$ sudo apt-get purge libreoffice wolfram-engine sonic-pi scratch
$ sudo apt-get purge minecraft-pi penguinspuzzle
$ sudo apt-get remove --purge libreoffice*
$ sudo apt-get clean
$ sudo apt-get autoremove

Fix Can boot config

$ sudo nano /boot/config.txt

at end - change dtparam=spi=off to on

clean and reboot

$ sudo apt-get udpate
$ sudo apt-get upgrade
$ sudo reboot

Initialize the CAN Interface

$ sudo /sbin/ip link set can0 up type can bitrate 500000

Download and setup Test Programs

$ wget
$ unzip
$ cd can-test_pi2
$ chmod u+x cansend
$ chmod u+x candump

Download the Python-CAN files

$ wget
$ unzip
$ cd hardbyte-python-can-4085cffd2519
$ sudo python3 install

Monitor can from command line

$./candump can0

Send can message from command line

$./cansend can0 <CAN 11-bit> or <CAN 29-bit>

in python

>>> # to send
>>> import can
>>> bus = can.interface.Bus(channel='can0', bustype='socketcan_native')msg= can.Message(arbitration_id=0x7de, data=[0, 25, 0, 1, 3, 1, 4, 1], extended_id=False)
>>> bus.send(msg)
>>> # to recieve
>>> notifier = can.Notifier(bus, [can.Printer()])

Python Related

Install Cython

$ pip3 install cython

Install kivy


$ sudo apt-get update
$ sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev pkg-config libgl1-mesa-dev libgles2-mesa-dev python-setuptools libgstreamer1.0-dev git-core gstreamer1.0-plugins-{bad,base,good,ugly} gstreamer1.0-{omx,alsa} python-dev libmtdev-dev xclip


$ sudo pip install git+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.