Bought a Raspberry Pi 4 to play around linux with since I've never really delved into that environment. I can't do sandbox type games so I had to make a project out of it. I hate going down to the basement to see if the laundry is done or if our duplex neighbor is using it so I made a webcam by adding a 5MP Arducam camera module from amazon and connected with the CSI ribbon that came with it. I ended up using the acrylic "stand" it came with to help mount it to the Arduino case so I have a single unit camera. I did most of these things through a putty SSH session which allows someone to talk to a computer (arduino) through the network in a secure manner. SSHing into the Arduino allowed me to run the camera "headless".
Here is a list of things I did, many things have to be done as 'sudo':
Here is a list of things I did, many things have to be done as 'sudo':
- Set a static IP address
- Look into apt and apt-install
- Install Apache2 server
- Install php
- Using raspi-config enable the camera interface
- Change Apache2 conf files to allow serving php files
- Go to the directory that index.html lives and change it to index.php
- php files can display html and php, html files can only do html
- Set up directory and file permissions using chmod
- Pay attention to Apache2's permissions specifically so the php can be allowed to run commands
- Permissions are done with a 3 digit number, super interesting how Raspian (raspberi pi debian which is the linux distro running on RPi's). Make sure to not be too lax on these permissions because security is important to keep in networks.
- Run the camera using raspistill (look it up, it's magic that the camera just works... no drivers needed) and save the file in the index.php dir
- Write some php to have the server run a raspistill command
- You can edit files using 'nano' command
- php command should be echo shell_exec('raspistill -o output.jpg')
- Add some HTML that embeds that output.jpg
- While on the same wifi network as the Arduino, get on a different computer or phone, open a browser, and type in the static address for the Arduino and you should get a fresh picture displayed!