PiCam: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 1: Line 1:
== setup ==
'''warning: this info is in progress -- may not (yet) represent a useful thing'''
'''warning: this info is in progress -- may not (yet) represent a useful thing'''
* ok [https://jawwig.wordpress.com/2013/11/19/setting-up-raspberry-pi-security-cam-on-model-a-or-b-with-minimal-armhf-image/ this link] in the end was totally misleading -- in fact you (maybe?) just need to add some stuff to /boot/config.txt


'''/boot/config.txt'''
'''/boot/config.txt'''
Line 10: Line 13:




LINKS
== test the camera ==
 
* https://jawwig.wordpress.com/2013/11/19/setting-up-raspberry-pi-security-cam-on-model-a-or-b-with-minimal-armhf-image/
* http://raspberrypi.stackexchange.com/questions/10357/enable-camera-without-raspi-config
 
'''enable_camera.sh'''
<pre language="bash">
#!/bin/bash
 
set_config_var() {
  lua - "$1" "$2" "$3" <<EOF > "$3.bak"
local key=assert(arg[1])
local value=assert(arg[2])
local fn=assert(arg[3])
local file=assert(io.open(fn))
local made_change=false
for line in file:lines() do
  if line:match("^#?%s*"..key.."=.*$") then
    line=key.."="..value
    made_change=true
  end
  print(line)
end
 
if not made_change then
  print(key.."="..value)
end
EOF
mv "$3.bak" "$3"
}
 
[ -e /boot/config.txt ] || touch /boot/config.txt
 
set_config_var start_x 1 /boot/config.txt
set_config_var gpu_mem 128 /boot/config.txt
sed /boot/config.txt -i -e "s/^startx/#startx/"
sed /boot/config.txt -i -e "s/^fixup_file/#fixup_file/"
</pre>
 
then


   chmod +x enable_camera.sh
   raspistill -o test.jpg
  apt-get install lua5.2 (needed as it is used in the script)
  ./enable_camera.sh

Revision as of 13:23, 15 March 2017

setup

warning: this info is in progress -- may not (yet) represent a useful thing

  • ok this link in the end was totally misleading -- in fact you (maybe?) just need to add some stuff to /boot/config.txt

/boot/config.txt

# Enable audio (loads snd_bcm2835)
dtparam=audio=on
start_x=1
gpu_mem=128


test the camera

 raspistill -o test.jpg