Monday, July 23, 2018

119: Raspberry Pi Camera Exposure

I've tried 3 cameras: the V1 (5mpix), V2 (8mpix) and a wide-angle (5mpix). I've had trouble with exposure with all of them.

One small gripe: the raspistill command --help arg lists a zillion options without a clue about what the default values are.

But that's not my story. I want to take snaps from before dawn till after dusk and I found that the many exposure-related arguments seemed to be ineffective. But I finally discovered the silver bullet. Shutter speed (-ss microseconds). That one works.

So, I average B/W pixel values in python and adjust shutter speed accordingly. My current -ss range is (bright to dark) 500 to 4000000 microseconds (1/2000th to 4 seconds).

Tuesday, July 10, 2018

118: A Problem with Insulation

I have several IoT systems installed in farm hoophouses (used to be called "greenhouses"). Each configuration is housed in a (mostly) waterproof plastic container -- about 12" x 18" x 8". The hoophouses are environmental trouble -- often high humidity and the daily temperature can range 50F to 120F. Processors are either Particle Photons or Raspberry Pi Zero-W and nearly all include relay boards. E.g.:

6-port relay

The boards are screwed down (loosly) to 1/4" plywood -- non-conductive, but I didn't like the back side of the boards:

many nasty soldered pins

So I decided to stick masking tape on the back of the boards. At least they ere easier to handle. Like so:

Don't do this!

At least, in the case of the particular product I used and/or the temperature range, that tape was NOT an effective insulator. I've had a few "relay board failures". But today (belatedly) I proved to myself that it was the stupid masking tape. When I replaced the tape with the black electrical type my failing relay board was fixed.

Wednesday, July 4, 2018

117: Overheating: The Pi's Internal Temperature Sensor

I currently have a Pi Zero W mounted inside a farm hoophouse (i.e., one of the new plastic film greenhouses). Unless the sides get rolled-up it can get over 120F in a hoophouse on a summer day. Yesterday my Pi Zero reported 154F from inside it's sealed case -- very close to the max 70C/158F for the Arm processor spec. Anyway, I protect my Pis as folows:

In cputemp.sh
h=`hostname` # I have several Pis
while true ;
do
 a=`/opt/vc/bin/vcgencmd measure_temp`
 b=`expr "$a" : '.*=\([0-9][0-9]*\)'`
 if [ $b -gt "70" ] ;
 then
  echo $h HOT | mail -s 'Rpi-HOT HALTED' some@gmail.com
  sudo halt # must power off/on to restart
 fi
 if [ $b -lt "55" ] ;
 then
  sleep 300
 else
  sleep 60
 fi
done


And in crontab
@reboot bash ...(your path).../cputemp.sh

Which means the above shell file will be executed whenever the Pi restarts.

P.S.: About overheating -- while my Pi Zero seemed to be working up to 70C, it became erratic at 66C/150F. while it still sent data to a web page, it stopped being able to snap a new image with the PiCamera/raspistill.