February 2020

Pi camera on a raspberry pi zero

Hank and Gary were having trouble with a pi camera. When I ran raspistill, it would give an error saying that camera not detected. After some digging, I found a great command to troubleshoot camera

vcgencmd get_camera

The output would say: Supported=1 Detected=0

Supported means whether Camera Support is enabled in Raspberry Pi Configuration(raspi-config->Interfaces>Camera). Detected=0 means undetected.

It turns out that the camera connector is rather finnicky. After removing it from the case, we finally got Supported=1 Detected=1 and good to go from there.

Install motioneye on an existing Raspbian Image

Created an install script here. Works with different flavours of Raspbian(Buster, Stretch, Jessie). Recently tested on a Raspberry Pi Zero W.

Determine pi temperature

Normally, the command is

vcgencmd measure_temp

If you use a custom OS besides raspbian, that command may not be available. So alternative is to use the following command

cat /sys/class/thermal/thermal_zone0/temp

Cron problem

Interesting problem arose where the following snippet was being executed in crontab

20 14 * * * echo moo > moo-`date +%d-%m-%y`.log

The command is perfectly legal, and if you run it in a shell, it works as expected.

The issue is, in the cron, the percentage sign needs to be escaped. So the fix is:

20 14 * * * echo moo > moo-`date +\%d-\%m-\%y`.log