BC Wiki - Raspberry Pi

Category: diy

Models and Performance

Understanding the system/gpu RAM split

Raspberry Pi Setup

Flash-Friendly File System (f2fs)

“Added f2fs support to the build script. Pre-built images available for download use ext4 because f2fs file systems can not be resized at present.”

Memory Card Selection

“We have done what we can to optimise the build for the Raspberry Pi 2 and one can comfortably use applications such as LibreOffice, which in fact is a joy to use :-) But the microSDHC I/O throughput is a bottleneck so we recommend that you use a Class 6 or Class 10 microSDHC card. If you build the image yourself we recommend you use the f2fs filesystem.”

Creating Swap with dphys-swapfile

On Ubuntu, install with `sudo apt install dphys-swapfile`.

The configuration file is in `/etc/dphys-swapfile`. Set swap location with `CONF_SWAPFILE=/your/location` and set size in megabytes with `CONF_SWAPSIZE=100`.

Use `systemd` to control it:

References:

Some people will tell you that making a swapfile on an SD card is a recipe for disaster; others will tell you that swap thrashing is not a realistic concern. I keep my swapfile on a spinning disk connected to the Raspberry Pi.

Peripherals

Non-Contact Temperature Measurement

Pinout

Configuration

Serial Interfaces (SPI and I2C)

https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=121440

https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=11617
You need to load the 'spidev' module to get userspace spi device access, in the same way the i2c-dev module provides userspace i2c access.
Try "modprobe spidev".

how to detect spi devices?

Scientific Computing

pip install matplotlib memory error
http://raspberrypi.stackexchange.com/questions/34644/pip-exception-while-installing-matplotlib-on-raspberry-pi
pip install --no-cache-dir matplotlib

http://stackoverflow.com/questions/20533426/ubuntu-running-pip-install-gives-error-the-following-required-packages-can-no
apt-get install libfreetype6-dev libpng12-dev
pip install matplotlib

Bugs

Wireless Sequencing Error

RPi3 wifi sequence error

problem: `brcmfmac: brcmf_sdio_hdparse: seq 194: sequence number error` in console when receiving wifi packets

Missing Console Cursor

Ubuntu Mate for Raspberry Pi

"We created a simple utility called graphical to disable/enable the MATE desktop environment for easily creating a headless “server”. Executing graphical disable will present a console login on the next boot, with no X11 or associated services running. If you want to get the full Ubuntu MATE desktop back, run graphical enable and reboot."

Problem: can’t see cursor position in terminal when rebooting after `graphical disable`

Programming

Controlling General-Purpose I/O with Python

Raspberry gPIo
https://learn.sparkfun.com/tutorials/raspberry-gpio

"Driving the Raspberry Pi’s I/O lines requires a bit of programming. Programming in what language? Take your pick! A quick glance at the Raspberry Pi GPIO examples shows that there are dozens of programming-language-choices. We’ve pared that list down, and ended up with two really solid, easy tools for driving I/O: Python and C (using the WiringPi library)."

Pins 2,4 - 5VDC
Pins 6,9,14,20,25,30,34,39 - Ground

Python module: RPi.GPIO
https://sourceforge.net/projects/raspberry-gpio-python/

"Note that this module is unsuitable for real-time or timing critical applications. This is because you can not predict when Python will be busy garbage collecting. It also runs under the Linux kernel which is not suitable for real time applications - it is multitasking O/S and another process may be given priority over the CPU, causing jitter in your program. If you are after true real-time performance and predictability, buy yourself an Arduino! (see http://www.arduino.cc  )

Note that the current release does not support SPI, I2C, 1-wire or serial functionality on the RPi yet. This is planned for the near future - watch this space!"

https://pypi.python.org/pypi/RPi.GPIO
RPi.GPIO 0.6.2

pip install rpi.gpio
Collecting rpi.gpio
  Downloading RPi.GPIO-0.6.2.tar.gz

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(18, GPIO.OUT)
GPIO.output(18, GPIO.HIGH)
pwm = GPIO.PWM(18, 1000)
pwm.start(50)
if GPIO.input(17):
    print("Pin 11 is HIGH")
else:
    print("Pin 11 is LOW")
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)

Category:DIY