Skip to content
Take a photo & do something
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
.gitignore
LICENSE
README.md
autostart.ini
autostart.sh
config.toml
hdc2.service
hdc2.sh
hdc_autostart2.sh
setid.sh
setup.sh
uvc_photo.ini
view.sh
view2.service

README.md

view

Take a Camera Image & send to MONITOR server

This view module provide 3 features:

  • view.sh: Take Camera Image & send to the MONITOR server
  • autostart.sh: RUn view.sh at 5 minutes interval.
  • hdc_autostart.sh: Run view.sh with outside event by GPIO, like PIR(Passive Infra-Red) Human detection Sensor.

1. Install

download from release

or

git clone https://github.com/UedaTakeyuki/view2.git

2. 2etup

Install & setup prerequired modules by

cd view2
./setup.sh 

3. Get free acount of MONITOR™ service

By Web Browser, Sign up to MONITOR™ Service at here. Following Quick Start document of Sign up to Monitor might be informative.

4. confirm your view_id on the MONITOR™

Sign up/in to MONITOR™ and confirm your view_id on the top page as follows:

5. set view_id

Return back to view on the console, set view_id mentioned above by setid.sh command. Let's say your view_id is axwdjqwy as above picture, set it by setid.sh as

./setid.sh axwdjqwy

6. test

###Test to take & send photo

After view_id setting is finished, you can take & send photo by following command.

python -m pondslider

You may see following sequence of log.

{'photo': '/tmp/20190625210920.jpg'}
start handle
end handle
call value handler
start terminate
end terminate

By Web Browser, you can see the MONITOR™ display is updated by your taken & sent photo.

7. setting for automatically run view.sh at 5 minute interval

You can set that view.sh is called repeatedly at 5 minute interval after device is turned on by autostart.sh command as follows:

# set autostart on
./autostart.sh --on

# set autostart off
./autostart.sh --off

Technically speaking, autostart.sh set timer service of systemctl for view.sh. In case you are familiar with crontab, it's OK to set view.sh on the cron yourself instead of using autostart command.

You can confirm current status with --status option:

./autostart.sh --status

You may see following sequence:

./autostart.sh --status
● view2.service - Take photos & Post to the monitor
   Loaded: loaded (/home/pi/SCRIPT/view2/view2.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-06-25 21:13:00 JST; 8s ago
 Main PID: 830 (sudo)
   CGroup: /system.slice/view2.service
           ├─830 /usr/bin/sudo /usr/bin/python -m pondslider --interval 5
           ├─837 /usr/bin/python -m pondslider --interval 5
           ├─838 /bin/sh -c fswebcam /tmp/20190625211306.jpg -d /dev/video0 -D 1 -S 20 -r 320x240
           └─839 fswebcam /tmp/20190625211306.jpg -d /dev/video0 -D 1 -S 20 -r 320x240

Jun 25 21:13:00 raspberrypi systemd[1]: Started Take photos & Post to the monitor.
Jun 25 21:13:00 raspberrypi sudo[830]:     root : TTY=unknown ; PWD=/home/pi/SCRIPT/view2 ; USER=root ; COMMAND=/usr/bin/pytho
Jun 25 21:13:00 raspberrypi sudo[830]: pam_unix(sudo:session): session opened for user root by (uid=0)

In case waiting key input, type "q" key.

In case afte service set as off, you can see followings:

Unit view2.service could not be found.

8. setting for automatically run view.sh with outside event by GPIO, like PIR(Passive Infra-Red) Human detection Sensor.

Instead of periodical running menttioned above step 5, you can set GPIO Event trigger by hdc.sh. hdc.sh runs as event loop to wach GPIO level change and kick view.sh. You can also set hdc.sh as service by hdc_autostart.sh as follows.

# set autostart on
./hdc_autostart.sh --on

# set autostart off
./hdc_autostart.sh --off

You can confirm current status with --status option:

./hdc_autostart.sh --status

You may see the following sequence:

● view.service - Take photos & Post to the monitor
   Loaded: loaded (/home/pi/view/view.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) since Wed 2018-11-14 21:01:52 JST; 25s ago
  Process: 7947 ExecStart=/home/pi/view/view.sh (code=exited, status=0/SUCCESS)
 Main PID: 7947 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/view.service

In case waiting for key input, type "q" key.

In case of service set as off, you can see followings:

pi@raspberrypi:~/view $ ./hdc_autostart.sh --status
Unit view.service could not be found.

8.1 Example usage of PIR (Passive Infrared Ray) Human Detection Sensor

9. Blog posts

for version 1.2.0 or later

for version 1.1.1 or later

for general

10. Q&A

Any questions, suggestions, reports are welcome! Please make issue without hesitation!

11. history

  • 0.1.0 2018.12.06 first version self-forked from view.
You can’t perform that action at this time.