80leaves / raspberrypi

A set of tipps & tricks regarding experiments with a raspberry Pi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

raspberrypi

A set of tipps & tricks regarding experiments with a raspberry Pi.

I'm currently using a

RaspberryPi Model B 512MB RAM

and a

EDIMAX EW-7811UN Wireless USB Adapter, 150 Mbit/s, IEEE802.11b/g/n

[Edimax at Amazon.de] [1]

LogiLink BT0015 Class 1 Micro-Adapter (Bluetooth 4.0, USB 2.0, 100m)

[LogiLink at Amazon.de] [2]

#DEV Environment#

I'm actually ssh-ing to my raspberryPi and doing all the main work on my developer machine in OSX. To get some extra comfort I did following entries at my /etc/hosts

## pimote
192.168.178.xxx pi # eth0
192.168.42.1 pifi # wlan0

##Install Raspbian## ###Download latest Raspian### Download the [latest Raspbian Image]

###Bring it to your SD-Card### First determ your SD card

df -h

then unmount it

sudo diskutil unmount /dev/disk4s1

copy Raspbian to it

sudo dd bs=1m if=2013-02-09-wheezy-raspbian.img of=/dev/rdisk4

eject it

diskutil eject /dev/rdisk4

Hint: With ctrl + T you can see the current progress

###First Boot### The first boot will prompt you straight to the raspi-config. If however you might want to call it up again, simply use

sudo raspi-config

I usually change following settings:

  • update the config
  • expand_rootfs
  • configure_keyboard
  • change_pass ! important !
  • memory_split -> 16MB
  • overclock -> Turbo 1000Mhz
  • ssh -> enable

###Second Boot### Now its time to copy our public key from the Developer machine to have eassier ssh access.

Create rsa_pub Keys if not already done yet ssh-keygen -t rsa -C "yourname@yourdomain.ext"

At your Host:

ssh pi@192.168.178.xxx

Pi:

mkdir ~/.ssh

Host:

cat ~/.ssh/id_rsa.pub | ssh USER@HOST "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Now edit ~/.ssh/config at your Host machine

HOST pi
	HostName 192.168.178.xxx
	Port 22
	User pi

From now on you can simply use ssh pi without being prompted for a password

Now, let's update

sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get clean

and install some basics

sudo apt-get install -y vim iw screen avahi-daemon libavahi-compat-libdnssd-dev htop dnsmasq tree git-core	

###Bluetooth USB Adapter### LogiLink BT0015 Class 1 Micro-Adapter (Bluetooth 4.0, USB 2.0, 100m)

First install some required packages

sudo apt-get install -y bluetooth bluez-utils blueman

Make sure the USB bluetooth dongle is detected

lsusb

Scan for your device and note down your mac-address, in my case an Apple Bluetooth Keyboard and make sure its visible and not paired to anything else

hcitool scan

Initialize pairing, you need to enter a passcode ( 0000 ) which has to be typed in again on your keyboard

sudo bluez-simple-agent hci0 AA:BB:CC:DD:EE:FF

Connect your device

sudo bluez-test-input connect AA:BB:CC:DD:EE:FF

Add your device to your list of trusted devices

sudo bluez-test-device trusted AA:BB:CC:DD:EE:FF

####Pair PS3 Controller#### Install required Packages. (bluez-utils might be already)

sudo apt-get install -y bluez-utils bluez-compat bluez-hcidump checkinstall libusb-dev  libbluetooth-dev joystick

Download and compile sixpair

wget http://www.pabr.org/sixlinux/sixpair.c
gcc -o sixpair sixpair.c -lusb

Run sixpair

sudo ./sixpair

Install SixAxis Manager

wget http://sourceforge.net/projects/qtsixa/files/QtSixA%201.5.1/QtSixA-1.5.1-src.tar.gz
tar xfvz QtSixA-1.5.1-src.tar.gz
cd QtSixA-1.5.1/sixad
make
sudo mkdir -p /var/lib/sixad/profiles
sudo checkinstall

Run sixad on boot time

sudo update-rc.d sixad defaults

###Wireless USB Adapter###

EDIMAX EW-7811UN Wireless USB Adapter, 150 Mbit/s, IEEE802.11b/g/n

First make sure an existing hostapd is removed as we need to replace it by a modified version.

sudo apt-get autoremove hostapd

Now download and install a modified version. Thanks @[segersjens]

wget https://github.com/jenssegers/RTL8188-hostapd/archive/v2.0.zip
unzip v2.0.zip
cd RTL8188-hostapd-2.0/hostapd
sudo make
sudo make install

Now hostapd can be started by

sudo service hostapd start

To get our access point up and running, some configrations need to be done

Edit /etc/hosts and add hostname to first line after localhost

sudo vim /etc/hosts
127.0.0.1       localhost YOUR_HOST
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.1.1       YOUR_HOST    

Edit /etc/hostname

sudo vim /etc/hostname
YOUR_HOST

Edit /etc/avahi/avahi-daemon.conf

sudo vim /etc/avahi/avahi-daemon.conf

Change host-name=YOUR_HOST if prefered to be different from your hostname

Edit dnsmasq.conf and add after last line:

sudo vim /etc/dnsmasq.conf
domain=local
dhcp-range=192.168.42.10,192.168.42.10
dhcp-host=80:1f:02:87:7b:a7,192.168.42.1,pi
dhcp-option=3,192.168.42.10
dhcp-option=6,192.168.42.11,8.8.8.8,8.8.4.4,192.168.42.1

Edit /etc/network/interfaces

sudo vim /etc/network/interfaces
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet static
address 192.168.42.1
netmask 255.255.255.0

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp

Edit /etc/hostapd/hostapd.conf

sudo vim /etc/hostapd/hostapd.conf
# Basic configuration

interface=wlan0
ssid=wifi
channel=1
#bridge=br0

# Hardware configuration

driver=rtl871xdrv
ieee80211n=1
hw_mode=g
device_name=RTL8192CU
manufacturer=Realtek

# pimote settings
#country_code=DE
max_num_sta=2
wpa=2
#rsn_preauth=1
#rsn_preauth_interfaces=wlan0
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_pairwise=CCMP
wpa_passphrase=balloon1

You can check your connected devices by

arp -n

##Install libgphoto2 & gphoto2## ! This is work in progress

sudo apt-get install -y libusb-dev libusb-1.0-0-dev 
sudo apt-get install -y libexif-dev
sudo apt-get install -y libpopt-dev
sudo apt-get install -y libfuse-dev
sudo apt-get install -y mono-devel
sudo apt-get install -y monodoc-base
sudo apt-get install -y libmono-2.0.1
sudo apt-get install -y mono-gmcs
sudo apt-get install -y python-pyrex
sudo apt-get install -y libtool

Error: gphoto2: error while loading shared libraries: libgphoto2.so.6: cannot open shared object file: No such file or directory Problem: ldd /usr/local/bin/gphoto2 /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so (0xb6f55000) libgphoto2.so.6 => not found libgphoto2_port.so.10 => not found libltdl.so.7 => /usr/lib/arm-linux-gnueabihf/libltdl.so.7 (0xb6f3a000) libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb6f2f000) libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6f10000) libexif.so.12 => /usr/lib/arm-linux-gnueabihf/libexif.so.12 (0xb6ed4000) libpopt.so.0 => /lib/arm-linux-gnueabihf/libpopt.so.0 (0xb6ec1000) libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb6e50000) libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6d21000) /lib/ld-linux-armhf.so.3 (0xb6f63000) libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6cf8000) shows 'not found'

Solution:

sudo vim /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
/usr/local/lib

Link: http://lonesysadmin.net/2013/02/22/error-while-loading-shared-libraries-cannot-open-shared-object-file/ [1]:http://www.amazon.de/EDIMAX-EW-7811UN-Wireless-Adapter-IEEE802-11b/dp/B003MTTJOY/ref=sr_1_1?s=computers&ie=UTF8&qid=1388835255&sr=1-1&keywords=edimax+ew-7811un [2]:http://www.amazon.de/LogiLink-BT0015-Class-Micro-Adapter-Bluetooth/dp/B0096Y2HFW/ref=sr_1_1?s=computers&ie=UTF8&qid=1394310020&sr=1-1&keywords=logilink+bluetooth [segersjens]:[http://jenssegers.be/blog/43/Realtek-RTL8188-based-access-point-on-Raspberry-Pi] [latest Raspbian image]:[http://downloads.raspberrypi.org/raspbian_latest]

iBeacon

sudo apt-get install -y libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev
mkdir bluez
cd bluez
wget www.kernel.org/pub/linux/bluetooth/bluez-5.26.tar.xz
unxz -c bluez-5.26.tar.xz | tar xv
LDFLAGS=-lrt ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-library -disable-systemd

About

A set of tipps & tricks regarding experiments with a raspberry Pi


Languages

Language:Shell 100.0%