Skip to content

Raspberry Pi tips and tricks

Henrik Östman edited this page Jan 15, 2017 · 18 revisions

Installing basic softwares

  1. sudo apt-get update

  2. sudo apt-get upgrade

  3. sudo rpi-update

  4. Installing Java 8 on Raspberry Pi:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html, click the download button of Java Platform (JDK) 8. Click to Accept License Agreement, download jdk-8-linux-arm-vfp-hflt.tar.gz for Linux ARM v6/v7 Hard Float ABI.

Log-in Raspberry Pi, enter the command to extract jdk-8-linux-arm-vfp-hflt.tar.gz to /opt directory. $ sudo tar zxvf jdk-8-linux-arm-vfp-hflt.tar.gz -C /opt

Set default java and javac to the new installed jdk8.

$ sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0/bin/javac 1 $ sudo update-alternatives --install /usr/bin/java java /opt/jdk1.8.0/bin/java 1

$ sudo update-alternatives --config javac $ sudo update-alternatives --config java

After all, verify with the commands with -verion option. $ java -version $ javac -version

Add this line last in .bashrc

export PATH=$PATH:$JAVA_HOME/bin

And this line in /etc/environment

export JAVA_HOME="/opt/jdk1.8.0_65"

Installing OpenJDK 8 instead of Oracle version

echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list

gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553

gpg -a --export 8B48AD6246925553 | sudo apt-key add -

gpg --keyserver pgpkeys.mit.edu --recv-key 7638D0442B90D010

gpg -a --export 7638D0442B90D010 | sudo apt-key add -

apt-get -t jessie-backports install openjdk-8-jre-headless

Reset lost password

  1. Insert the card in your Mac SD card reader (must work on Window too);

  2. Edit the file “cmdline.txt” and append “init=/bin/sh” (thanks Joe Schmoe). The Rpi will boot in single user mode;

  3. Insert the card in the RPi again and boot up;

  4. When prompt available, enter “su” to log as root (with no password);

  5. Type “passwd pi” and enter a new password;

  6. Remember the new password;

  7. Remove the appended string in the “cmdfile.txt” file. Voila!

Get NTP running

  1. apt-get install ntpdate

  2. edit /etc/rc.local, insert:

( /etc/init.d/ntp stop until ping -nq -c3 8.8.8.8; do echo "Waiting for network..." done ntpdate -s time.nist.gov /etc/init.d/ntp start )&

Install AbioWire+ (or other 1-wire adapters)

AbioWire+ manual I found here.

  1. Comment out blacklisted device-drivers that we need.

    sudo nano /etc/modprobe.d/raspi-blacklist.conf

    And make sure you comment out the line "blacklist i2c-bcm2708" (if they exists) so that it looks like

    #blacklist i2c-bcm2708

  2. Add i2c-dev to the end of /etc/modules file if it's not already listed.

    sudo nano /etc/modules

    Add these

    i2c_dev i2c-bcm2708

  3. Activate support for i2c in the kernel

    sudo nano /boot/config.txt

    Add these two lines at the bottom

    dtparam=i2c1=on dtparam=i2c_arm=on

  4. Reboot the system

    sudo reboot

  5. Install packages

    sudo apt-get update sudo apt-get install i2c-tools owserver

    (ignore any errors owserver might throw when trying to start.)

  6. Test i2c interface to see if we could detect the hardware

    sudo i2cdetect -y 1

    (it will show you a table of detected i2c-busses, if ALL are displaying "--" then no hardware was found)

  7. Edit OWFS config-file

    sudo nano /etc/owfs.conf (TODO: add more info here!)

  8. Check that owserver is listening on port: sudo netstat -tulpn |grep owserver

Rasperberry pi Wifi

http://www.pihlgren.se/raspberrypi-wifi.php

Disable HDMI and Composite out to save ~20 mA power

/opt/vc/bin/tvservice -off

Clone this wiki locally