Kind of a long explanation but I want to be sure I cover everything to make the question understandable. I started a timelapse project with a RasPi to watch two houses across the street get torn down and then rebuilt. I mounted it under one of my eaves and it is just barely in wifi range, but works. I need to move it out more so I need it set up with a rtc also, but now I cant get it all to work together.
If I have the rtc, camera and usb wifi plugged in, the wifi cuts shortly after booting. If I disconnect either the cam or rtc, it boots fine.
I have it set up so that when it boots, a script named
timelapse.sh runs.
/usr/local/bin/timelapse.sh
Code:
#!/bin/bash
while true
do
filename="pic_$(date +%Y%m%dT%H%M%S)".jpg
raspistill -w 1920 -h 1080 -o /home/pi/images/$filename
echo Image captured
sleep 30
done
I put it in cron originally but now I have it in rc.local. It runs fine on startup.
Next I edited my fstab and created a udev rule so that everytime I inserted my usb thumbdrive it would automatically mount and then run backup.sh.
fstab
Code:
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
UUID=E280-D629 /usb vfat defaults,users,umask=0 0 0
/etc/udev/rules.d/95-usb.rules
Code:
SUBSYSTEM=="block",RUN+="/bin/mount -a",RUN+="/usr/local/bin/backup.sh"
/usr/local/bin/backup.sh
Code:
#!/bin/bash
sleep 10
mv /home/pi/pic/*.jpg /usb
It runs fine also. Not sure if the sleep is really necessary but it isn't the problem.
I then have 2 cronjobs. Shiftpics.sh moves the images to a directory for backup.
/usr/local/bin/shiftpics.sh
Code:
#!/bin/bash
mv /home/pi/images/*.jpg /home/pi/pics
exit 0
and cleanusb moves images from mount directory 3 hours later because it has pics there without the stick sometimes.
/usr/local/bin/cleanusb.sh
Code:
#!/bin/bash
mv /usb/* /home/pi/pics
exit 0
These were all working fine before I added the rtc.
I need the rtc so that I can move it out of wifi range and keep the date/time file naming. I got a rtc, soldered it together and followed the Adafruit wiring and setup instructions. Mine is actually a Digistump real time clock shield but it worked fine when I tested it out on another RasPi.
The ultimate plan is:
The pi would boot and save the pics to images. Shift would move them at 3am and 3pm. I would stick in the usb at around 4am and pm before I left and got back from work. I would walk off because it took about 20 or 30 minutes to copy. I would take out the stick and a couple hours later cleanusb would make sure that directory was clear. Timelapse could run the whole time.
Thank you for any ideas and please tell me if there is anything else I could post to make troubleshooting easier.