... | ... | @@ -40,7 +40,7 @@ http://admin:YWRtaW4%3D@my_lan_ip:8080/snapshot.jpg |
|
|
|
|
|
#### 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
|
|
|
connection e.g. when it is connected
|
|
|
directly to a desktop/laptop
|
... | ... | @@ -49,22 +49,23 @@ for the **tp-link nc200**, when the camera |
|
|
fresh out of the box and connected directly
|
|
|
to a computer, the following is applicable:
|
|
|
|
|
|
* default ip: 192.168.0.10
|
|
|
* username: admin
|
|
|
* password: admin
|
|
|
* default ip: `192.168.0.10`
|
|
|
* username: `admin`
|
|
|
* password: `admin`
|
|
|
|
|
|
## initial camera setup
|
|
|
|
|
|
### 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
|
|
|
* give the computer a temporary static ip address in the
|
|
|
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
|
|
|
192.168.0.1 to 192.168.0.254 (EXCEPT the same ip as the
|
|
|
camera)
|
|
|
* open a browser, and in the address bar provide the
|
|
|
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 camera)
|
|
|
* open a browser, then in the address bar provide the
|
|
|
default camera ip and hit ENTER
|
|
|
* login into the camera using the default username/password
|
|
|
|
... | ... | @@ -77,20 +78,21 @@ note: do any of these as required by your local environment |
|
|
* setup a connection to your wireless lan
|
|
|
* setup the actual fixed ip
|
|
|
|
|
|
IMPORTANT: changing the username and password may break
|
|
|
the snapshot url temporarily - this is because some types
|
|
|
of cameras encode the username and password as part of
|
|
|
the link. in the case of the tplink nc200, the username
|
|
|
is in plaintext ("admin") but the password is base64-encoded
|
|
|
("YWRtaW4" base64 decoded is "admin"). therefore, if you
|
|
|
change the password, then you must base64 encode the new
|
|
|
password using a script or an online service like
|
|
|
https://www.base64encode.org/ - when in doubt, research
|
|
|
the brand/model snapshot url with google
|
|
|
|
|
|
EXAMPLE: with the **tplink nc200** - if the username is
|
|
|
"admin" and the password changed to "abc123" and the ip
|
|
|
changed to 192.168.0.87:
|
|
|
IMPORTANT: changing the camera username and password may
|
|
|
break the snapshot url temporarily - this is because
|
|
|
some types of cameras encode the username and password
|
|
|
as part of the link. in the case of the **tplink nc200**,
|
|
|
the username is in plaintext (`admin`) but the password
|
|
|
is base64-encoded (`YWRtaW4` base64-decoded is `admin`).
|
|
|
|
|
|
therefore, if you change the password, then you must
|
|
|
base64-encode the new password using a script or an
|
|
|
online service like https://www.base64encode.org/ -
|
|
|
when in doubt, research the brand/model with google.
|
|
|
|
|
|
EXAMPLE: for the **tplink nc200** with ip set to
|
|
|
`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
|
... | ... | @@ -98,27 +100,34 @@ http://admin:YWJjMTIz@192.168.0.87:8080/snapshot.jpg |
|
|
|
|
|
once everything is setup, connect the camera to the LAN
|
|
|
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
|
|
|
|
|
|
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
|
|
|
3. a picture should be downloaded as `now.jpg`
|
|
|
|
|
|
note: running step 2 over and over again, will fetch a new
|
|
|
image from the camera and overwrite any existing now.jpg
|
|
|
note: running step 2 over and over again will fetch a new
|
|
|
image from the camera and overwrite any existing `now.jpg`
|
|
|
|
|
|
## 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
|
|
|
|
|
|
1. open the terminal
|
|
|
1. open a terminal
|
|
|
2. `mkdir camera` - make a new directory for the camera project
|
|
|
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":
|
|
|
|
|
|
```
|
... | ... | @@ -127,27 +136,29 @@ sleep 3 # in seconds, between frames |
|
|
./camera.sh
|
|
|
```
|
|
|
|
|
|
6. to save the file, press CTRL-O (output), then confirm the
|
|
|
filename with enter
|
|
|
7. to exit, press CTRL-X
|
|
|
8. back to terminal, type `chmod +x camera.sh` - this makes the
|
|
|
file "runnable"
|
|
|
6. in `nano`, to save the file, press `CTRL-O` (O for output),
|
|
|
then confirm the filename with the ENTER key
|
|
|
7. to exit `nano`, press `CTRL-X`
|
|
|
8. back to terminal, type `chmod +x camera.sh` - this makes
|
|
|
the file "runnable" in linux
|
|
|
9. run the file with `./camera.sh`
|
|
|
|
|
|
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
|
|
|
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.
|
|
|
"`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
|
|
|
|
|
|
we must install php on the raspberry pi so we can make a simple
|
|
|
server - we only have to do this once per pi
|
|
|
we must install `php` on the raspberry pi so we can run a
|
|
|
simple server - we only have to do this once per pi
|
|
|
|
|
|
important: this part requires an internet connection
|
|
|
|
|
|
1. open a terminal
|
|
|
2. run `sudo apt update`
|
... | ... | @@ -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
|
|
|
|
|
|
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
|
|
|
|
... | ... | @@ -194,15 +205,15 @@ just in case the window gets closed, just do step 1, 2, 3, 4 |
|
|
</html>
|
|
|
```
|
|
|
|
|
|
6. to save the file in `nano`, CTRL-O, enter to confirm name
|
|
|
7. to exit `nano`, CTRL-X
|
|
|
6. to save the file in `nano`, `CTRL-O`, enter to confirm name
|
|
|
7. to exit `nano`, `CTRL-X`
|
|
|
8. on a separate computer/mobile, use a browser and access:
|
|
|
`http://<ip address of pi>:8010` - you no longer have to
|
|
|
have `/now.jpg` at the end
|
|
|
|
|
|
notes:
|
|
|
* the meta tag in the code at step 4 will make the page refresh
|
|
|
every 5 seconds automatically.
|
|
|
* the meta tag in the step 4 code will make the page refresh
|
|
|
every 5 seconds automatically.
|
|
|
* you can close this terminal when done
|
|
|
|
|
|
advanced: for multiple cameras, just add more `img` tags with
|
... | ... | @@ -218,4 +229,5 @@ suggestion for improvements: |
|
|
* change the camera server from PHP to a python mini-server
|
|
|
with `python3 -m http.server`
|
|
|
* make the page look better!
|
|
|
* making everything run on pi reboot (hint: use `cron`)
|
|
|
* ...and much much more! |
|
|
\ No newline at end of file |