Changes

Raspberry Pi

3,527 bytes added, 00:19, 1 November 2015
C-Media USB sound device
*list all device addresses on a port
**<code>arp -i bridge0 -a</code>
==Set IP address==
*On OS X set ethernet to DHCP with manual addressing. Choose address 192.168.3.1.
*Scan for raspberry pi: <syntaxhighlight lang="bash">sudo nmap -sP 192.168.2.1/24 | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}'</syntaxhighlight>
==Set .local name==
=Maintenance=
==Backup your System Image==
===backup with rpi-clone===
*uses dd and rsync:
https://github.com/billw2/rpi-clone
 
 
===backup with tar.gz===
http://sysmatt.blogspot.com/2014/08/backup-restore-customize-and-clone-your.html
 
===backup with dd===
*power off the pi, remove the sd card, and insert it in your computer.
*check what drive it is. on os x:
*when it is done. eject the disk.
**<code>diskutil eject /dev/rdisk2</code>
 
==Restore from backup image==
*repeat steps above to insert SD card, identify, and unmount.
=Configuration=
==create local wifi hotspot==
*http://www.daveconroy.com/turn-your-raspberry-pi-into-a-wifi-hotspot-with-edimax-nano-usb-ew-7811un-rtl8188cus-chipset/
*https://forums.adafruit.com/viewtopic.php?f=19&t=47716
 
==create .local domain name for raspberry pi==
*http://www.howtogeek.com/167190/how-and-why-to-assign-the-.local-domain-to-your-raspberry-pi/
=Software=
==pocketsphinx / usb mic==
https://wolfpaulus.com/journal/embedded/raspberrypi2-sr/
==google speech scripts==
<s>*install pyaudio:
*https://www.youtube.com/watch?v=ZBX7UzXTmd4
*execute shell commands http://puredata.hurleur.com/sujet-9005-inteface-shell-scripts
==pyOSC==
*http://www.raspberrypi.org/forums/viewtopic.php?t=59714&p=446513
=Graphics=
After these libraries are built, you can then <code>cd</code> to each example project, <code>make</code>, and run the resultant binary file. Please note that these instructions are repeated in the included <code>README</code> file.
=Hardware Peripherals=Verified Peripherals - http://elinux.org/RPi_VerifiedPeripherals==Pi Camera==
*getting started - http://www.raspberrypi.org/archives/3890
*code: https://github.com/raspberrypi/userland/tree/master/host_applications/linux/apps/raspicam
==taking photos with raspistill==<syntaxhighlight lang="bash">raspistill -o image.jpg</syntaxhighlight>*faster photo: https://bitbucket.org/niklas_rother/rasperry-pi-userland/raw/master/host_applications/linux/apps/raspicam/raspifastcamd_scripts ==taking video with raspivid==*take a video<syntaxhighlight lang="bash">raspivid -o video.h264</syntaxhighlight>*Convert to mp4<syntaxhighlight lang="bash">ffmpeg -i video.h264 -vcodec copy video.mp4</syntaxhighlight> ==new video modes==*http://www.raspberrypi.org/new-camera-mode-released/*install rpi-update:<syntaxhighlight lang="bash">sudo apt-get install rpi-update</syntaxhighlight>*update:<syntaxhighlight lang="bash">sudo rpi-update</syntaxhighlight>*exploring camera modes:<syntaxhighlight lang="bash">v4l2-ctl -p 90</syntaxhighlight><syntaxhighlight lang="bash"> v4l2-ctl -v width=640,height=480,pixelformat=H264</syntaxhighlight><syntaxhighlight lang="bash"> v4l2-ctl --stream-mmap=3 --stream-count=900 --stream-to=test90fps.h264</syntaxhighlight> *half resolution, binned:<syntaxhighlight lang="bash">raspivid -w 1296 -h 972 -t 10000 -o pi_0.h264</syntaxhighlight>*90 frames per second VGA:<syntaxhighlight lang="bash">raspivid -w 640 -h 480 -fps 90 -t 10000 -o test90fps.h264</syntaxhighlight>   ==streaming the pi camera==*RPi:<syntaxhighlight lang="bash">raspivid -t 999999 -o - | nc 192.168.2.31 5001</syntaxhighlight>*Laptop: <syntaxhighlight lang="bash">nc -l 5001 | mplayer -fps 31 -cache 1024 -</syntaxhighlight>*low-latency: http://blog.tkjelectronics.dk/2013/06/how-to-stream-video-and-audio-from-a-raspberry-pi-with-no-latency/ ==python interface (picam)==*http://www.raspberrypi.org/learning/python-picamera-setup/==motion-triggered capture==*PIR triggered (motion triggered) camera===*with PIR sensor - http://www.raspberrypi.org/learning/parent-detector/
*launch python script in detached screen session:
<syntaxhighlight lang="bash">
</syntaxhighlight>
===*mmal opencv modetect===
*set recording format in code.
*with motion detection opencv - http://www.sodnpoo.com/posts.xml/raspberrypi_camera_with_opencv_motion_detection_and_recording.xml
./mmal_opencv_modect > video.h264
</syntaxhighlight>
 ===picam python interface===*http://www.raspberrypi.org/learning/python-picamera-setup/===Streaming from RPi to OS X=wrap h264 then combine two files==*RPi: <pre>raspivid -t 999999 -o - | nc 192.168.2.31 5001</pre>*Laptop: <pre>nc -l 5001 | mplayer -fps 31 -cache 1024 -</pre>====low-latency====*http://blog.tkjelectronics.dk/2013/06/how-to-stream-video-concat first and-audio-from-a-raspberry-pi-with-no-latency/ ===Adding an M12 mount===*httpsecond half://wiki.raspberrytorte.com/index.php?title=Camera_Module_Lens_Modifcation#Lens_Mount_Modification===Taking a Photo===
<syntaxhighlight lang="bash">
raspistill avconv -o imagei concat:a.jpgh264\|b.h264 -c copy sum.h264
</syntaxhighlight>
*faster photowrap as h264 (with avconv): https://bitbucket.org/niklas_rother/rasperry-pi-userland/raw/master/host_applications/linux/apps/raspicam/raspifastcamd_scripts===Take a video===
<syntaxhighlight lang="bash">
raspivid avconv -o videoi sum.h264-vcodec copy sum2.mp4
</syntaxhighlight>
===New Video Parameters===*httpwrap as h264 (with ffmpeg)://www.raspberrypi.org/new-camera-mode-released/
<syntaxhighlight lang="bash">
v4l2ffmpeg -ctl i sum.h264 -p 90vcodec copy sum.mp4
</syntaxhighlight>
 
==alternate lens mounts==
*Adding an M12 mount: http://wiki.raspberrytorte.com/index.php?title=Camera_Module_Lens_Modifcation#Lens_Mount_Modification
 
=Wolfson Audio=
*update wolfson audio drivers - https://blog.georgmill.de/2015/02/18/update-for-wolfson-audio-card-on-raspberry-pi/
*Command line recording - http://www.element14.com/community/community/raspberry-pi/raspberrypi_projects/blog/2014/04/06/wolfson-audio-project
==Jack from OSX to Raspberry Pi==
On Raspberry Pi:
*wolfson script to select audio output:
<syntaxhighlight lang="bash">Playback_to_Lineout.sh</syntaxhighlight> or the direct amixer commands
<syntaxhighlight lang="bash">
v4l2amixer -ctl Dhw:0 cset name='HPOUT2 Digital Switch' onamixer -v widthDhw:0 cset name=640,height'HPOUT2L Input 1' AIF1RX1amixer -Dhw:0 cset name=480,pixelformat'HPOUT2L Input 1 Volume' 32amixer -Dhw:0 cset name='HPOUT2R Input 1' AIF1RX2amixer -Dhw:0 cset name=H264'HPOUT2R Input 1 Volume' 32
</syntaxhighlight>
*run dbus:
<syntaxhighlight lang="bash">
v4l2eval dbus-ctl launch --streamauto-mmapsyntax </syntaxhighlight>*copy results and export them:<syntaxhighlight lang=3 --stream-count"bash">export DBUS_SESSION_BUS_ADDRESS=900 --stream-to...export DBUS_SESSION_BUS_PID=test90fps.h264..
</syntaxhighlight>
*start jackd:
<syntaxhighlight lang="bash">jackd -R -T -p 32 -d alsa -n 3 -p 2048 -r 44100 -i2 -o2 &</syntaxhighlight>
*start netone pointed to slave IP:
<syntaxhighlight lang="bash">jack_netsource -H 192.168.0.104 &</syntaxhighlight>
 
On OS X:
*configure jack for necessary outputs (only done once) (2 in 2 out)
*qjackctl with netone backend
===Capture===On Pi:*half resolution, binnedroute jack signals:
<syntaxhighlight lang="bash">
raspivid -w 1296 -h 972 -t 10000 -o pi_0.h264jack_connect netjack:capture_1 system:playback_1</syntaxhighlight>*90 frames per second VGAjack_connect netjack:capture_2 system:<syntaxhighlight lang="bash">raspivid -w 640 -h 480 -fps 90 -t 10000 -o test90fps.h264playback_2
</syntaxhighlight>
 
*jack routing - https://gist.github.com/nyarla/36724e8931fa6bc244a0
*https://github.com/jackaudio/jackaudio.github.com/wiki/WalkThrough_User_NetJack2
 
=Hardware Peripherals=
Verified Peripherals - http://elinux.org/RPi_VerifiedPeripherals
==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
==U9 MiniMic==
<syntaxhighlight lang="bash">arecord -f dat | aplay -f dat &</syntaxhighlight>
==C920==
**<code>lpstat -p -d</code>
*lp help http://www.cups.org/documentation.php/options.html
==Wireless Adapters==
*Adafruit adapter: https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/install-software
*LB-Link with mt7601: https://www.raspberrypi.org/forums/viewtopic.php?t=49864
**for kernel 3.18.7-v7: https://dl.dropboxusercontent.com/u/80256631/mt7601-3.18.7-v7-755.tar.gz
=GPIO=