** March 19: There was an error in the Vim description, so I have corrected it. ** **
I started working with Raspberry Pi. This time, as the title suggests, I installed a camera and built a site (only for Wifi in my home) that monitors the room in my home with Motion software, so I would like to summarize it.
The main points are as follows.
This time I bought this camera for Raspberry Pi. It is very cheap at 1500 yen. https://www.amazon.co.jp/raspberry-%E3%82%AB%E3%83%A1%E3%83%A9%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB-Raspberry-%E3%81%A8%E3%82%B1%E3%83%BC%E3%82%B9500W%E7%94%BB%E7%B4%A0-%E6%84%9F%E5%85%89%E3%83%81%E3%83%83%E3%83%97OV5647%E3%82%BB%E3%83%B3%E3%82%B5%E3%83%BC/dp/B07NSS1QRW/ref=sr_1_1?__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A&keywords=lotw+camera&qid=1584354810&s=computers&sr=1-1-catcorr
First, assemble this.
The camera, case, and instructions were in a compact package overall. I made a camera case, but I didn't take most of the pictures. .. The screws are very small and difficult to insert, but it wasn't too difficult because I just put the plastic case together and fastened with the screws. Next is how to install this module on Raspberry Pi.
There is a black cover on the connector where the camera module is installed, and there is usually no space to insert it. Therefore, lift the cover with your fingernail and insert it into the gap. At this time, insert it so that the metal sensor surface is installed on the Raspberry Pi side and the camera side.
Here is the installed photo. The box on the Raspberry Pi side that I purchased is not firmly fitted.
The installation of the Raspberry Pi is completed in this way, but next we will set it on the Raspberry Pi so that we can shoot with the camera. After that, I logged in as the root user and set it up.
From Settings, go to Interface → Enable Camera.
Next, start an application called LXterminal, which is equivalent to the command prompt in Windows. This LX terminal commands with Linux commands. I myself was new to Linux commands, so I'm groping while searching. To see if the camera is connected, type in the following and press enter.
If successful, you will see the following. If detected = 0, you are not connected, so something wrong should have happened somewhere in the past.
If there is a problem on the device side, you can update the device in Raspberry Pi to the latest version with the following command.
sudo apt-get upgrade
After confirming the connection, try taking a picture with the camera.
sudo raspistill -o image.jpg
You can take a single photo with this command. The photo itself is stored in the folder that is the current directory on the LX terminal.
The nearby figurine is out of focus and appears to be in focus on the background behind it.
Reference URL https://www.pc-koubou.jp/magazine/17276
Now that the camera settings have been completed, I would like to be able to check the images shot in real time. This time, install the software called Motion on the Raspberry Pi, start the software with the command of LX terminal, and make it possible to check it on the URL.
Install Motion with the following command.
sudo apt-get install motion
Then, edit the following so that Motion can be moved by the following command.
sudo vim /etc/default/motion start_motion_daemon=no ↓ start_motion_daemon=yes
First of all, if the command is not accepted and an error occurs, you need to install a text editor called Vim, so install it with the following command.
sudo apt-get install vim
Now, the edit screen will appear as below, but you need to know how to edit Vim uniquely. Reference URL https://qiita.com/kon_yu/items/b8864ff566b8b67a9810
You can switch from the non-editable screen to the possible screen by pressing the i command (insert: editable) or the s command (substitute: insert). Use the Esc key to switch from the editable screen to the non-editable screen. ~~ The editable screen and non-editable screen can be switched with the s and esc keys, so ~~ Type yes and no after switching. And after switching, you can exit with the: wq command on the non-editable screen.
Well, this is actually the setting. Let's actually shoot. Start Motion with this command.
sudo motion -n
The video you shot http://raspberrypiのIP:8081/ You can check it on this URL.
The captured image of the video actually shot is on the top. The quality was still rougher than the photo. However, you can see it all over the house where Wifi is available. I wondered if it could be applied, such as watching a child sleeping at a distance while doing housework or work.
This time, we installed a camera on the Raspberry Pi and built an environment for shooting. The installation itself was not difficult. However, there were many points that I did not understand well in the settings in Raspberry Pi, such as setting on Linux commands and setting only as the root user. Next, I would like to consider whether it is possible to change the shooting method by changing the settings of this camera. Also, I would like to build a server or utilize cloud services such as AWS so that it can be viewed outside Wifi. I thought that 1500 yen was too cheap for the camera performance, but that is not the case at all, and it is more than enough performance to play as a toy. It's been a fun time. ..
URL that was very helpful https://qiita.com/westvirginia/items/ba79f7549b43da116467