... | @@ -40,7 +40,7 @@ http://admin:YWRtaW4%3D@my_lan_ip:8080/snapshot.jpg |
... | @@ -40,7 +40,7 @@ http://admin:YWRtaW4%3D@my_lan_ip:8080/snapshot.jpg |
|
|
|
|
|
#### default ip, default username, default password
|
|
#### default ip, default username, default password
|
|
|
|
|
|
this is the default ip address that the
|
|
the default ip address is the ip that the
|
|
camera will use if there is no internet
|
|
camera will use if there is no internet
|
|
connection e.g. when it is connected
|
|
connection e.g. when it is connected
|
|
directly to a desktop/laptop
|
|
directly to a desktop/laptop
|
... | @@ -49,22 +49,23 @@ for the **tp-link nc200**, when the camera |
... | @@ -49,22 +49,23 @@ for the **tp-link nc200**, when the camera |
|
fresh out of the box and connected directly
|
|
fresh out of the box and connected directly
|
|
to a computer, the following is applicable:
|
|
to a computer, the following is applicable:
|
|
|
|
|
|
* default ip: 192.168.0.10
|
|
* default ip: `192.168.0.10`
|
|
* username: admin
|
|
* username: `admin`
|
|
* password: admin
|
|
* password: `admin`
|
|
|
|
|
|
## initial camera setup
|
|
## initial camera setup
|
|
|
|
|
|
### ensure that you can connect to the camera
|
|
### ensure that you can connect to the camera
|
|
|
|
|
|
* plug the camera network directly into a computer
|
|
* plug the camera network directly into a computer,
|
|
|
|
usually with a network cable
|
|
* switch everything on, give everything time to start up
|
|
* switch everything on, give everything time to start up
|
|
* give the computer a temporary static ip address in the
|
|
* give the computer a temporary static ip address in the
|
|
same range as the camera default ip e.g. if the default
|
|
same range as the camera default ip e.g. if the default
|
|
ip is 192.168.0.10, then give the computer any ip from
|
|
ip is `192.168.0.10`, then give the computer any ip from
|
|
192.168.0.1 to 192.168.0.254 (EXCEPT the same ip as the
|
|
`192.168.0.1` to `192.168.0.254` (EXCEPT the same ip as
|
|
camera)
|
|
the camera)
|
|
* open a browser, and in the address bar provide the
|
|
* open a browser, then in the address bar provide the
|
|
default camera ip and hit ENTER
|
|
default camera ip and hit ENTER
|
|
* login into the camera using the default username/password
|
|
* login into the camera using the default username/password
|
|
|
|
|
... | @@ -77,20 +78,21 @@ note: do any of these as required by your local environment |
... | @@ -77,20 +78,21 @@ note: do any of these as required by your local environment |
|
* setup a connection to your wireless lan
|
|
* setup a connection to your wireless lan
|
|
* setup the actual fixed ip
|
|
* setup the actual fixed ip
|
|
|
|
|
|
IMPORTANT: changing the username and password may break
|
|
IMPORTANT: changing the camera username and password may
|
|
the snapshot url temporarily - this is because some types
|
|
break the snapshot url temporarily - this is because
|
|
of cameras encode the username and password as part of
|
|
some types of cameras encode the username and password
|
|
the link. in the case of the tplink nc200, the username
|
|
as part of the link. in the case of the **tplink nc200**,
|
|
is in plaintext ("admin") but the password is base64-encoded
|
|
the username is in plaintext (`admin`) but the password
|
|
("YWRtaW4" base64 decoded is "admin"). therefore, if you
|
|
is base64-encoded (`YWRtaW4` base64-decoded is `admin`).
|
|
change the password, then you must base64 encode the new
|
|
|
|
password using a script or an online service like
|
|
therefore, if you change the password, then you must
|
|
https://www.base64encode.org/ - when in doubt, research
|
|
base64-encode the new password using a script or an
|
|
the brand/model snapshot url with google
|
|
online service like https://www.base64encode.org/ -
|
|
|
|
when in doubt, research the brand/model with google.
|
|
EXAMPLE: with the **tplink nc200** - if the username is
|
|
|
|
"admin" and the password changed to "abc123" and the ip
|
|
EXAMPLE: for the **tplink nc200** with ip set to
|
|
changed to 192.168.0.87:
|
|
`192.168.0.87`; username `admin`; and the password
|
|
|
|
changed to `abc123`, the correct snapshot url will be:
|
|
|
|
|
|
```
|
|
```
|
|
http://admin:YWJjMTIz@192.168.0.87:8080/snapshot.jpg
|
|
http://admin:YWJjMTIz@192.168.0.87:8080/snapshot.jpg
|
... | @@ -98,27 +100,34 @@ http://admin:YWJjMTIz@192.168.0.87:8080/snapshot.jpg |
... | @@ -98,27 +100,34 @@ http://admin:YWJjMTIz@192.168.0.87:8080/snapshot.jpg |
|
|
|
|
|
once everything is setup, connect the camera to the LAN
|
|
once everything is setup, connect the camera to the LAN
|
|
wia wifi or cable, and ensure the ip is setup properly.
|
|
wia wifi or cable, and ensure the ip is setup properly.
|
|
finally, test the snapshot url AGAIN on the actual network
|
|
|
|
|
|
finally, test the snapshot url AGAIN on the actual network.
|
|
|
|
|
|
### test the camera from the raspberry pi
|
|
### test the camera from the raspberry pi
|
|
|
|
|
|
to test the URL on the raspberry pi:
|
|
to test the URL on the raspberry pi:
|
|
|
|
|
|
1. open the terminal
|
|
1. open a terminal
|
|
2. type `wget <full snapshot url> -O now.jpg`, hit ENTER
|
|
2. type `wget <full snapshot url> -O now.jpg`, hit ENTER
|
|
3. a picture should be downloaded as `now.jpg`
|
|
3. a picture should be downloaded as `now.jpg`
|
|
|
|
|
|
note: running step 2 over and over again, will fetch a new
|
|
note: running step 2 over and over again will fetch a new
|
|
image from the camera and overwrite any existing now.jpg
|
|
image from the camera and overwrite any existing `now.jpg`
|
|
|
|
|
|
## raspberry pi
|
|
## raspberry pi
|
|
|
|
|
|
|
|
setup a raspberry pi:
|
|
|
|
* OS: [rasbpian jessie/buster with desktop](https://www.raspberrypi.org/downloads/raspbian/)
|
|
|
|
* has an internet connection
|
|
|
|
* connected to the same lan as the camera
|
|
|
|
|
|
### create the automatic snapshot download script
|
|
### create the automatic snapshot download script
|
|
|
|
|
|
1. open the terminal
|
|
1. open a terminal
|
|
2. `mkdir camera` - make a new directory for the camera project
|
|
2. `mkdir camera` - make a new directory for the camera project
|
|
3. `cd camera` - (change directory)/enter into the camera folder
|
|
3. `cd camera` - (change directory)/enter into the camera folder
|
|
4. `nano camera.sh` - create/edit a file called 'camera.sh'
|
|
4. `nano camera.sh` - create/edit a file called 'camera.sh' with
|
|
|
|
the `nano` editor
|
|
5. enter the following "shell code":
|
|
5. enter the following "shell code":
|
|
|
|
|
|
```
|
|
```
|
... | @@ -127,27 +136,29 @@ sleep 3 # in seconds, between frames |
... | @@ -127,27 +136,29 @@ sleep 3 # in seconds, between frames |
|
./camera.sh
|
|
./camera.sh
|
|
```
|
|
```
|
|
|
|
|
|
6. to save the file, press CTRL-O (output), then confirm the
|
|
6. in `nano`, to save the file, press `CTRL-O` (O for output),
|
|
filename with enter
|
|
then confirm the filename with the ENTER key
|
|
7. to exit, press CTRL-X
|
|
7. to exit `nano`, press `CTRL-X`
|
|
8. back to terminal, type `chmod +x camera.sh` - this makes the
|
|
8. back to terminal, type `chmod +x camera.sh` - this makes
|
|
file "runnable"
|
|
the file "runnable" in linux
|
|
9. run the file with `./camera.sh`
|
|
9. run the file with `./camera.sh`
|
|
|
|
|
|
note: do not close the terminal window, let it run endlessly
|
|
note: do not close the terminal window, let it run endlessly
|
|
|
|
|
|
|
|
in case the window gets closed, just re-do step 1, 3, 9
|
|
|
|
|
|
advanced: if you have more cameras, repeat these steps, and open
|
|
advanced: if you have more cameras, repeat these steps, and open
|
|
more terminal windows (one per camera) fetching the unique camera
|
|
more terminal windows (one per camera) fetching the unique camera
|
|
snapshot url. don't forget to change the "-O" option so that each
|
|
snapshot url. don't forget to change the `-O` parameter so that each
|
|
camera will be written to a different snapshot file e.g.
|
|
camera will be written to a different snapshot file e.g.
|
|
"`wget ... -O cam1.jpg`", "`wget ... -O cam2.jpg`", etc
|
|
"`wget ... -O cam1.jpg`", "`wget ... -O cam2.jpg`", etc
|
|
|
|
|
|
just in case the window gets closed, just do step 1, 3, 9
|
|
|
|
|
|
|
|
### camera server - part 1: preparing the environment
|
|
### camera server - part 1: preparing the environment
|
|
|
|
|
|
we must install php on the raspberry pi so we can make a simple
|
|
we must install `php` on the raspberry pi so we can run a
|
|
server - we only have to do this once per pi
|
|
simple server - we only have to do this once per pi
|
|
|
|
|
|
|
|
important: this part requires an internet connection
|
|
|
|
|
|
1. open a terminal
|
|
1. open a terminal
|
|
2. run `sudo apt update`
|
|
2. run `sudo apt update`
|
... | @@ -171,7 +182,7 @@ close the terminal when done OR use it for part 2... |
... | @@ -171,7 +182,7 @@ close the terminal when done OR use it for part 2... |
|
|
|
|
|
note: do not close the terminal window, let it run endlessly
|
|
note: do not close the terminal window, let it run endlessly
|
|
|
|
|
|
just in case the window gets closed, just do step 1, 2, 3, 4
|
|
in case the window gets closed, just do step 1, 2, 3, 4
|
|
|
|
|
|
### camera server - part 3: make a web page
|
|
### camera server - part 3: make a web page
|
|
|
|
|
... | @@ -194,15 +205,15 @@ just in case the window gets closed, just do step 1, 2, 3, 4 |
... | @@ -194,15 +205,15 @@ just in case the window gets closed, just do step 1, 2, 3, 4 |
|
</html>
|
|
</html>
|
|
```
|
|
```
|
|
|
|
|
|
6. to save the file in `nano`, CTRL-O, enter to confirm name
|
|
6. to save the file in `nano`, `CTRL-O`, enter to confirm name
|
|
7. to exit `nano`, CTRL-X
|
|
7. to exit `nano`, `CTRL-X`
|
|
8. on a separate computer/mobile, use a browser and access:
|
|
8. on a separate computer/mobile, use a browser and access:
|
|
`http://<ip address of pi>:8010` - you no longer have to
|
|
`http://<ip address of pi>:8010` - you no longer have to
|
|
have `/now.jpg` at the end
|
|
have `/now.jpg` at the end
|
|
|
|
|
|
notes:
|
|
notes:
|
|
* the meta tag in the code at step 4 will make the page refresh
|
|
* the meta tag in the step 4 code will make the page refresh
|
|
every 5 seconds automatically.
|
|
every 5 seconds automatically.
|
|
* you can close this terminal when done
|
|
* you can close this terminal when done
|
|
|
|
|
|
advanced: for multiple cameras, just add more `img` tags with
|
|
advanced: for multiple cameras, just add more `img` tags with
|
... | @@ -218,4 +229,5 @@ suggestion for improvements: |
... | @@ -218,4 +229,5 @@ suggestion for improvements: |
|
* change the camera server from PHP to a python mini-server
|
|
* change the camera server from PHP to a python mini-server
|
|
with `python3 -m http.server`
|
|
with `python3 -m http.server`
|
|
* make the page look better!
|
|
* make the page look better!
|
|
|
|
* making everything run on pi reboot (hint: use `cron`)
|
|
* ...and much much more! |
|
* ...and much much more! |
|
|
|
\ No newline at end of file |