Difference between revisions of "Raspberry Pi"
(→Pockesphinx) |
|||
Line 18: | Line 18: | ||
*list all device addresses on a port | *list all device addresses on a port | ||
**<code>arp -i bridge0 -a</code> | **<code>arp -i bridge0 -a</code> | ||
+ | =Maintenance= | ||
+ | *backup your raspberry pi. | ||
+ | *remove the sd card and insert in your computer. | ||
+ | *check what drive it is. on os x: | ||
+ | **<code>df</code> | ||
+ | **you should see something like ''/dev/disk2s1'', figure out which is your hard drive and which is the SD card. | ||
+ | *unmount the card. | ||
+ | **<code>diskutil unmount /dev/disk2s1</code> | ||
+ | *duplicate the disk to your hard drive. replace the second argument, ''of=/Volumes/Cistern/RaspberryPi/...'' with the path and filename where you want to backup the image. | ||
+ | **<code>sudo dd if=/dev/rdisk2 of=/Volumes/Cistern/RaspberryPi/wheezy-20130522-backup.img bs=1m</code> | ||
+ | **you can hit '''Ctrl-t''' on your keyboard to see stats about the copy in progress. | ||
+ | *when it is done. eject the disk. | ||
+ | **<code>diskutil eject /dev/rdisk2</code> | ||
=Configuration= | =Configuration= |
Revision as of 19:05, 22 May 2013
Contents
Setup
Install OS on SD card
- Purchase a verified SDHC cards - http://elinux.org/RPi_SD_cards
- Follow EASY setup - http://elinux.org/RPi_Easy_SD_Card_Setup
- resizing main partition from booted raspberry pi - http://elinux.org/RPi_Resize_Flash_Partitions
Debugging
Using a USB to TTL cable
- Install USB drivers
- for os x - http://sourceforge.net/projects/osx-pl2303/
- Connect pins like so:
- NOTE: LEAVE THE RED WIRE OFF TO USE EXTERNAL POWER SUPPLY. leave the red wire connected to power pi from the usb cable.
- Use
screen
to connect to pi. From Terminal, start session:screen /dev/cu.usbserial 115200
What port is my raspberry pi on?
- list all device addresses on a port
arp -i bridge0 -a
Maintenance
- backup your raspberry pi.
- remove the sd card and insert in your computer.
- check what drive it is. on os x:
df
- you should see something like /dev/disk2s1, figure out which is your hard drive and which is the SD card.
- unmount the card.
diskutil unmount /dev/disk2s1
- duplicate the disk to your hard drive. replace the second argument, of=/Volumes/Cistern/RaspberryPi/... with the path and filename where you want to backup the image.
sudo dd if=/dev/rdisk2 of=/Volumes/Cistern/RaspberryPi/wheezy-20130522-backup.img bs=1m
- you can hit Ctrl-t on your keyboard to see stats about the copy in progress.
- when it is done. eject the disk.
diskutil eject /dev/rdisk2
Configuration
apt-get not connecting
- add DNS server. see here:
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&t=17016
vim instead of vi
vim instead of vi so arrow keys work:
sudo apt-get update
sudo apt-get -y install vim
bash configuration
- edit .bashrc:
- uncomment
ll
andla
- uncomment
add a user account
while logged in as PI user:
sudo adduser MyUser
sudo adduser MyUser sudo
now it is time to test out your new account.
- logout as pi:
logout
- at the login prompt, login as your username created above.
- CONGRATS!
- time to shut down your system:
sudo poweroff
type in your password. the system will shut down.
add audio for non-default user
getting audio to work for a non-default user:
sudo usermod -a -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,netdev,input rtwomey
- logout, then login
SSH Login
ssh login:
- should work by default. you just need to know the IP address.
- Connecting to a local mac with internet sharing on, it's probably 192.168.2.3, or 192.168.2.2.
- Store your public key on the remote system, so you aren't prompted for password:
http://www.linuxproblem.org/art_9.html
not resolving IP addresses
sudo vi /etc/resolv.conf
- add the line
nameserver 8.8.8.8
- this is the google nameserver.
vnc remote
- http://learn.adafruit.com/adafruit-raspberry-pi-lesson-7-remote-control-with-vnc/installing-vnc
- http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=34094
overclocking
- using command line http://www.jeremymorgan.com/tutorials/raspberry-pi/how-to-overclock-raspberry-pi/
- using raspi-config http://elinux.org/RPi_raspi-config
scp
- to copy photos to my current computer, over ethernet cable:
- scp rtwomey@192.168.2.3:~/images/*.jpg ~/Pictures/
- if you've stored your ssh public key, you won't be prompted for password!
Software
FM Transmitter
- FM transmitter with python code - http://www.icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_FM_Transmitter
- cached
- this works!!
- get file with wget:
- unzip the file:
tar -xvzf Pifm.tar.gz
- What files were created extracted, and where did it put them?
ls -la
- Make a radio folder and move the files in.
mkdir radio
mv pifm.* radio
mv PiFm.py radio
mv sound.wav radio
gphoto2
- installing:
sudo apt-get install gphoto2
- take a photo:
gphoto2 --capture-image-and-download
- after taking a photo it's necessary to reset the USB port. use usbreset util.
usbreset /dev/bus/usb/001/004
- put your /dev/bus/usb device as the second argument above. you can find it from --list-ports.
- list cameras:
gphoto2 --list-ports
- control and capture of DSLR http://skowron.biz/artikel/gphoto-raspberry/
usbreset
- build by hand: http://toothbrushsymphony.blogspot.com/2013/01/usb-reset-on-raspberry-pi.html
- apt-get?
festival
- festival on raspberry pi - http://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis)
- see http://wiki.roberttwomey.com/Setting_Up_Festival_TTS#Using_Voice_on_Raspberry_Pi
pocketsphinx
- http://wiki.roberttwomey.com/Setting_Up_Festival_TTS#Using_Voice_on_Raspberry_Pi
- sphinx on raspberry pi - https://sites.google.com/site/observing/Home/speech-recognition-with-the-raspberry-pi
- http://www.raspberrypi.org/phpBB3/viewtopic.php?f=37&t=9487
Pockesphinx
- Install libasound2-dev, bison (bison was already installed on my raspberry pi):
sudo apt-get install libasound2-dev
- Get sphinxbase and pocketsphinx, preferrably putting them in a code directory:
- Unzip:
tar -xzf sphinxbase-0.8.tar.gz
tar -xzf pocketsphinx-0.8.tar.gz
- Generate configuration files. In the sphinxbase-0.8 directory:
./autogen.sh
make
make install
- Repeat in pocketsphinx-0.8 directory.
- test is out
src/programs/pocketsphinx_continuous -samprate 48000
megahal
- try it -
supercollider
others
- installing on rpi: http://sam.aaron.name/2012/11/02/supercollider-on-pi.html
- example install directory:
/usr/share/doc/supercollider/examples/
- http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SC-on-Beagle-Board-Raspberry-Pi-td7581949.html
- satellite CCRMA - https://ccrma.stanford.edu/wiki/Satellite_CCRMA_First_Steps
nltk
- http://www.raspberrypi.org/phpBB3/viewtopic.php?f=9&t=6097
- install setup tools
wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea
sudo sh setuptools-0.6c11-py2.7.egg
- install pip
sudo easy_install pip
- install numpy (precompiled binary)
sudo apt-get install python-numpy
- install nltk
sudo pip install nltk --upgrade
- run nltk
- run python then type import nltk
OpenCV
hd video playback
- omxplayer http://elinux.org/Omxplayer
- play a file:
omxplayer -o hdmi ~/Movies/robot_playing_catch.mp4
- play a file:
- play script: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=9789&p=112154
Video
- RPi video looper - http://www.timschwartz.org/raspberry-pi-video-looper/
OSC
liblo
To use liblo to write an OSC client and server in C, first install the liblo development package on both the computer you would like to broadcast from (the client) and the computer that will receive the messages (the server). Using APT:
apt-get install liblo-dev
Then, visit http://liblo.sourceforge.net/ and navigate to the example code or documentation. The example code provides a simple client and server. If you're just copying and pasting these, and would like to quickly compile them and test that they work, do the following for the server:
wget http://liblo.sourceforge.net/examples/example_server.c gcc -o server example_server.c -llo ./server
And for the client:
wget http://liblo.sourceforge.net/examples/example_client.c
Then on the line defining an lo_address
, change NULL
to the IP address of your server. Finally
gcc -o client example_client.c -llo ./client
If you've done everything successfully, you should see a variety of sample output from the running server
program.
Graphics
OpenGL
Using OpenGL on the Raspberry Pi appears to be pretty idiosyncratic. For instance, see https://benosteen.wordpress.com/2012/04/27/using-opengl-es-2-0-on-the-raspberry-pi-without-x-windows/. Don't be misled by what is described on that webpage. While correct, far simpler example projects exist on the Raspberry Pi at /opt/vc/src/hello_pi. These are very useful! Read the README
there, and get cracking. To get started, you can build every project by running:
sh rebuild.sh
If you would only like to build a subset of the projects, first cd
to /opt/vc/src/hello_pi/libs
, and build each library included there. Specifically:
cd /opt/vc/src/hello_pi/libs/ilcient && make cd ../vgfont && make
After these libraries are built, you can then cd
to each example project, make
, and run the resultant binary file. Please note that these instructions are repeated in the included README
file.
Hardware Peripherals
Verified Peripherals - http://elinux.org/RPi_VerifiedPeripherals
Pi Foundation Camera Module
- getting started - http://www.raspberrypi.org/archives/3890
- code: https://github.com/raspberrypi/userland/tree/master/host_applications/linux/apps/raspicam
C-Media USB sound device
- setting up with alsamixer, etc - http://asliceofraspberrypi.blogspot.com/2013/02/adding-audio-input-device.html
- setup C-media usb sound device - http://www.cpmspectre.pwp.blueyonder.co.uk/raspberry_pi/MoinMoinExport/DaffodilUSBSoundAdapter.html
C920
- USB packet loss (90% of frames)
microline 320 printer
installing
- install cups
sudo apt-get install cups
- willtake a little while
- install menu item:
sudo apt-get install system-config-printers
- reboot
- add printer
- start ltxde:
startx
- Select Menu->Preferences->Printing
- Printer should autodetect. Or you can enter the URI manually:
parallel:/dev/usblp0
- Change model to Generic, type Raw. This will pass raw data to printer.
- start ltxde:
- http://ubuntuforums.org/showthread.php?t=1436079&page=2
command line
- printing
cat myTextFile.txt | lp -oraw
- list printers
lpstat -p -d
- lp help http://www.cups.org/documentation.php/options.html
GPIO
- pin over-voltage protection circuits - http://elinux.org/RPi_Tutorial_EGHS:GPIO_Protection_Circuits
- light example - https://projects.drogon.net/raspberry-pi/gpio-examples/tux-crossing/gpio-examples-1-a-single-led/
- uses wiringPI, command line tool, for ex:
gpio
- installed using git - https://projects.drogon.net/raspberry-pi/wiringpi/download-and-install/
- uses wiringPI, command line tool, for ex:
through python
- follow adafruit - http://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/overview
- Rpi.GPIO -
- requires python-dev
- python-rpi.gpio
- https://code.google.com/p/raspberry-gpio-python/
Logic Level Conversion
- RPi is 3.3V.
untested
- Processing - http://forum.processing.org/topic/processing-on-raspberry-pi
- webcam streaming - http://sirlagz.net/2012/08/04/how-to-stream-a-webcam-from-the-raspberry-pi/
- opencv - http://mitchtech.net/raspberry-pi-opencv/
- julius - http://www.aonsquared.co.uk/raspi_voice_control
Problems
- raspberry pi resets audio device after recording begins. similar to this complaint - http://www.raspberrypi.org/phpBB3/viewtopic.php?t=12086&p=135385
Course of Instruction
- week 1
- week 2
- Raspberry Pi - Week 3
- Raspberry Pi - Week 4