SHARE
TWEET

Phototrap with Rapsberry and Minimodem

TringaliLuca Oct 19th, 2018 (edited) 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. #Install WiringPi: sudo apt-get install wiringpi
  3. #PIR on pin 23
  4. gpio mode 23 in
  5. b=$(gpio read 23)
  6. while true; do
  7. if [ b != "0" ]; then
  8. streamer -s 1280x720 -f jpeg -o /tmp/tmpfoto.jpeg
  9. cat /tmp/tmpfoto.jpeg | minimodem -t 100
  10. fi
  11. sleep 1
  12. done
  13.  
  14. #This is the receiver:
  15. #!/bin/bash
  16. result="/home/luca"
  17. minsize="+10000c" #10KB
  18. nohup minimodem -r 100 1> /tmp/tmpfoto.jpg 2>/tmp/tmpcode.txt
  19. while true; do
  20. b=$(tail -n 1 /tmp/tmpcode.txt)
  21. if [[ $b== *"NOCARRIER"* ]];  then
  22. if [[ $(find /tmp/tmpfoto.jpg -type f -size $minsize 2>/dev/null) ]]; then
  23. mv /tmp/tmpfoto.jpg $result/$(date +%Y-%m-%d-%H-%M-%S).jpg
  24. fi
  25. fi
  26. sleep 1
  27. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top