Raspberry: Difference between revisions
Line 199: | Line 199: | ||
== HummingBird robot == | == HummingBird robot == | ||
http://www.hummingbirdkit.com/learning/tutorials/raspberry-pi | http://www.hummingbirdkit.com/learning/tutorials/raspberry-pi | ||
== Power Raspberry Pi by AA batteries == | |||
http://www.raspberrypi-spy.co.uk/2013/04/raspberry-pi-aa-battery-shoot-out/ | |||
= Other cool stuff = | = Other cool stuff = |
Revision as of 16:56, 5 May 2013
Raspberry Pi
ARM architecture (armv6)
http://www.memetic.org/raspbian-benchmarking-armel-vs-armhf/
Miscellaneous
- Raspberry pi quick start guide
- http://elinux.org/RPi_Hub
- wifi setup
- Berryboot for multiple boots
- video player: omxplayer videofile.mp4
- mp3 player: mpg321 "my file.mp3". See https://sites.google.com/site/semilleroadt/home/raspberry-pi about testing sound on Raspberry Pi.
- raspberry pi server
- re-run configuration
- MagPi: The Unofficial Raspberry Pi Magazine—Published around eight times a year, MapPi is a free and polished electronic magazine for Pi hobbyists.
- HTG guide to getting started with Raspberry Pi
- A month with raspbian How to change date/time.
- My youtube video demostrating GPIO function.
- N900 as a remote display
- Use Raspberry Pi behind a proxy http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&t=13986
Remote desktop connection with tightvnc
tightvncserver vncserver :1 -geometry 1600×900 -depth 16 -pixelformat rgb565: vncserver –kill :1
Raspbian package repository
http://archive.raspbian.org/raspbian/pool/main/r/r-base/
LXDE (same as Lubuntu)
Quick launch bar
To add lxterminal to quick launch bar,
Right click any empty space on taskbar -> Panel Setting -> Panel Preferences -> Panel Applets -> Application launch bar & Edit -> Accessories & lxterminal
Keyboard shortcut
The shortcuts are defined in the file ~/.config/openbox/lxde-rc.xml
For example,
- open the lxpanelctl menu, click Ctrl + ESC.
- open launch an application, click Windows + r.
- Toggle full screen, Alt + F11.
- Launch task manager, Ctrl + Alt + Del.
Get internet by sharing the internet from another machine
- https://wiki.archlinux.org/index.php/Internet_Share
- static iP. Set up host eth0 IP and then set up RPi IP:
- In Windows, allow Internet sharing. An IP of 192.168.0.2 will be automatically assigned to the Laptop's network card. Make static IP of 192.168.0.2 in Rasp Pi. Enter subnet mask and gateway (192.168.0.1). Also make an entry in /etc/resolv.conf with nameserver=192.168.0.1. Reboot and Rasp Pi will get Net all right.
- In Linux, An IP of 10.42.0.37 will be assigned to eth0 card. Make static IP of 10.42.0.37 in Rasp Pi. Enter subset mask and gateway (10.42.0.1). Also make an entry in /etc/resolv.conf with nameserver=10.42.0.1. Reboot and Rasp Pi will get Net all right.
- Other thoughts:
sudo nano /etc/network/interfaces iface eth0 inet static address 192.168.100.1 netmask 255.255.255.0 network 192.168.100.0 broadcast 192.168.100.255 gateway 192.168.100.254
The gateway is important and in most cases will always point to your firewalls, switch or routers IP address.
In my current setting, the host machine's eth0 has IP 10.42.0.1 (inet addr). The RPi has IP 10.42.0.37 and gateway 10.42.0.1.
$ netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0 10.42.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 wlan0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
And /etc/resolv.conf may be worth to be changed too. /etc/hostname and /etc/hosts are unnecessary.
An example of /etc/resolv.conf (set up linux DNS) shown from my RPi is
nameserver 10.42.0.1
But maybe another choice is nameserver 8.8.8.8.
Some tools for discovering the IPs in a network include Fing (iOS/Android) or Scapy (python).
IP scan tools
- fing (ios, android, linux, windows). Command line usage
sudo fing -n 192.168.1.1/24
where /24 means 'network prefix' size 24 bits. Check wikipedia classless inter domain routing. For example, CIDR notation 192.168.100.0/24 would be equivalent to 192.168.100.0/255.255.255.0.
- Angry ip scanner cross platform. open source. Basic knowledge on internet protocol. However, it is slow and show all instead of found ip's.
- netbios. It does not discover linux boxes, however.
GPIO experiments
C libraries
- wiringPi and GPIO examples
- http://www.airspayce.com/mikem/bcm2835/
- http://elinux.org/RPi_Low-level_peripherals
- C vs Python
GPIO layout
The following picture was taken from www.raspberrypi-spy.co.uk
WebIOPi
WebIOPi is a REST framework and a webapp which allows you to control Raspberry Pi's GPIO. It does not require apache to be installed. So we can use web browser from Android to control the GPIO in Raspbery Pi ... Another choice is Web.py.
Run Python using webiopi module
sudo python -m webiopi 8000
Start/stop the background service
sudo /etc/init.d/webiopi start sudo /etc/init.d/webiopi end
Start webiopi at startup:
sudo update-rc.d webiopi defaults
Note that we shall browse to http://localhost:8000/ instead of http://localhost:8000/webiopi. If something is still wrong, use a different port. The default user is "webiopi" and password is "raspberry".
It seems the code is still not stable. I kept getting a message "Error response" Error code 404. Message: Not Found. Error code explanation: 404 = Nothing matches the given URI.
Web.py
See the article The Python Pit - drive your Raspberry Pi with a mobile phone in http://www.themagpi.com/en/issue/9.
Circuit and Electronics
- http://www.scribd.com/doc/31582947/%E9%9B%BB%E8%B7%AF%E8%88%87%E9%9B%BB%E5%AD%90%E5%AD%B8-Electric-Circuits-and-Electronics
- http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-002-circuits-and-electronics-spring-2007/
Blink a single LED
I follow the instruction in https://projects.drogon.net/raspberry-pi/gpio-examples/tux-crossing/gpio-examples-1-a-single-led/ to install gpio program/library in raspberry pi. Here is the result
- without PI cobbler: http://www.youtube.com/watch?v=xWJZRK4W13Q
- with PI cobbler: see the picture below. The soldering part is not easy for a beginner. Be sure to follow some instruction on youtube videos to begin with. Note that the white stripe is on the edge closest to the SD card.
- Another example by using C++ code. No extra library needs to be installed. http://hertaville.com/2012/11/18/introduction-to-accessing-the-raspberry-pis-gpio-in-c/. The site also shows the program to create the diagram is from http://www.fritzing.org.
- Python approach. Here it is assumed pin 9 (or 6) is used for GND and pin 11 for GPIO17 (see the GPIO layout above). The LED was connected using a 330 ohm resistor in series with pin 9 (or 6) and 11 to limit the current.
import RPi.GPIO as GPIO import time # blinking function def blink(pin): GPIO.output(pin,GPIO.HIGH) time.sleep(1) GPIO.output(pin,GPIO.LOW) time.sleep(1) return # to use Raspberry Pi board pin numbers GPIO.setmode(GPIO.BOARD) # set up GPIO output channel GPIO.setup(11, GPIO.OUT) # blink GPIO17 50 times for i in range(0,50): blink(11) GPIO.cleanup()
- Google: raspberry pi python led
16x2 LCD
http://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi. The '16x2' LCD means it can show 16 characters per row and there are 2 rows in total. Each character consists of 8x5 (height x width) dots.
8x8 Matrix LED Backpack
http://learn.adafruit.com/matrix-7-segment-led-backpack-with-the-raspberry-pi/overview
Another more versatile output from the 8x8 matrix is by using C program. See Mark Williams blog.
I also create a version of launching LED using R. See http://www.youtube.com/watch?v=TwoWrPp6_iw.
IR Remote with XBMC
HummingBird robot
http://www.hummingbirdkit.com/learning/tutorials/raspberry-pi
Power Raspberry Pi by AA batteries
http://www.raspberrypi-spy.co.uk/2013/04/raspberry-pi-aa-battery-shoot-out/
Other cool stuff
Interfacing with a Wiimote
http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/wiimote/
Robot control
http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/robot_control/