Friday 19 May 2017

BirdBox2017: something is eating my SD card

2017 is turning out to be a great bird box season for us.

Both of our Raspberry Pi camera boxes are occupied, with the first set of chicks almost ready to leave the nest.

For the last few days my only concern has been whether I'll run out of SD card space before the chicks depart.

The old 2013/4 designed Raspberry Pi camera system attached to our Canadian Maple tree has been working faultlessly, as it pretty much has for each season since spring 2014. It is the temporary home of two great tits. The female laid six eggs about 14 days ago, and today they started to hatch.

The newer PicaxePi box is mounted on the side of our pergola, and is the home of two blue tits and their 8 or 9 chicks. This is the first year that eggs have been laid in this box. Hopefully we will get a proper chance to count these chicks before they leave the nest in 3 or 4 days time.

This is also the system that has been giving me a few little problems. It is great to have 2 Pi cameras fitted to this box (one inside, the other on the outside) each controlled by its own Pi Zero. But the current drain on the 12Ahr battery is just too high.

I think I had estimated a run time of about 37hrs, and sure enough, I've had to change batteries after about 35hrs for two of my three batteries. (With the longer days of May, the box is probably running for 15 or 16 hours per day). The third battery (the newest) had been allowed to fully discharge over winter, and its not happy! So it only lasts about 30hr when powering this box.

If I run this system again next year, I will provide software control of the power to the outside camera. That way I can leave the camera off by default, and only turn it on when we are actually watching. Motion recordings have been pretty useless anyway, since an approaching bird is so small compared to the large area of moving vegetation.

My only other option (short of buying a car battery) is to follow NestBoxTech's lead and connect using power-over-ethernet. I'd really like to do this, but I don't want a cable draped across the garden (maybe I could attach a box to the back of the house).

So anyway, the problem I had this week was (like the last one) related to running out of SD card space. I've been remembering to remove the video files regularly from the PicaxePi system. But each time I did, I noticed I had less space than before.

By yesterday I'd calculated that the remaining space (approx 400MB) would disappear by Sunday and the system would not be able to boot up. So I had to take a second look today via ssh.

I traced the problem to the /var folder which had consumed 11GB of my 16GB micro SD card. More specifically the log files (user, system & debug) were the main culprits, so I chose to delete user.log, syslog.1 and debug.1. I also checked the most recent entries for user, syslog & debug using the commands like this:-

tail -n 100 /var/log/syslog

...and I found a large number of motion related messages. A quick check inside the motioneye.conf file revealed that motion log-level reporting had been left set to Debug ...probably by me, as I don't think this is the default.

Anyway, all fixed now that I've replaced "debug" with "error" for log-level recording. Thank goodness for ssh!

The system should prevent logs from becoming a problem, but I guess logrotate is not configured by default on the Pi.


  1. I had a vague idea of running cat5 to a location then setting up Pi1 as a wireless access point, then having multiple nest boxes / trailcams etc in range each with a pi Zero W. These could be powered either by solar or battery so you wouldn't necessarily need to be wired back to the hub (or could be by cheap 2 core wire). I've got Pikrellcam running nicely on a ZeroW, and would like to then have it periodically auto-archive via wifi to a central NAS/PC when ZeroW SD card free space fell to a threshold.... Maybe adapt empty Pringles can into directional antennae given that we can't recycle them anymore.

    1. Pringles cantenna? Interesting, but probably a waste of time.

      If you want to use wifi, I'd strongly suggest getting a proper 3-aerial wifi router. Put it in a weather-proof ABS box, and mount it 2-3m above ground. Use POE to provide the 12V normally required for a router (i.e. keep the mains/12V supply inside your house). Link router data to house via CAT5.

      My bird box wifi network gives me good range, even with the router inside the kitchen. But mounting it outside should give you 30m+ even using a PiZW. You just need to avoid using busy channels, and mount the router in a clear, high location.
      Also see:

      Back-up video options: 1. a program to copy videos every hour to remote storage. If successful, delete originals. 2. Mount a remote storage location on your server/house computer and try saving/streaming direct to this location.

      Note that you will need a time-server if you want sensible local timestamps.

    2. Oh, one more thing. If you can use 5GHz rather than 2.4GHz, I reckon the slight loss of range is more than compensated by the complete lack of wifi traffic (lots of channels to choose from).

  2. Thanks, I've an old 2 aerial wifi router that I could use. It wants 15v, but I would prefer to step down from a higher V PoE source (48V in this case), as the initial cat5 cable run is ~100m and I dont have any power source at the end... any ideas gratefully received.

  3. I think I'd use the 10/100 mode B POE scheme, where power is via unused CAT cable cores; e.g. simply break-out the blue pair (use for +V dc) and the brown pair (use for 0V dc). Then find a suitable dc/dc converter for the router end, with an ac/dc converter at the "house" end.

    Amazon have one or two 15V assemblies like this one:

    For the ac/dc "house" supply you could use any 1A supply from 24V to 40V including old printer supplies like this:

    I hope this helps.