2

members

Easy Raspberry basics: Project 02b Raspberry PI camera module V2 and MotionEyeOS

of Acoptex.com in Raspberry Pi 3

Raspberry basics: Project 02b

Project name: Raspberry PI camera module V2 and MotionEyeOS

Tags: Raspberry, Raspberry camera V2, Raspberry PI camera module, Raspberry PI 3, MotionEyeOS, Surveillance Camera System, CCTV camera, meye-xxxxxxxx boot login, where do I find the meye-xxxxxxxx boot login?

In this project, you need these parts :

1.Raspberry PI 3 model B 1 pc

2. Raspberry PI camera module V2, and a USB webcam (for example Logitech C920) 1 pc

3. Empty Micro SD card,  Micro SD card with Raspbian and SD card adapter 1 pc

4. Micro USB power supply (2.1 A, max 2.5 A) 1 pc

 

TV or monitor and HDMI cable
Keyboard and mouse

 

5. TV or monitor 1 pc

6. HDMI cable 1 pc

7. USB keyboard 1 pc

8. USB mouse 1 pc

General

We will learn how to use the Raspberry PI camera module V2 with MotionEyeOS.

Understanding the MotionEyeOS

MotionEyeOS is a Linux distribution that has ability to detect motion and capture images and movies of what triggered it. You can also access a live stream of your camera online, even when you’re not home, which is handy if you want to check in every now and then. When away from home, being notified of any movement is very useful, and MotionEyeOS has a nifty option for custom notifications.

The MotionEyeOS turns your single-board computer into a video serveillance system. The MotionEyeOS supports the following devices:

  • Raspberry Pi (all versions);
  • Banana Pi;
  • Odroid C1/C1+, Odroid C2, Odroid XU4;
  • Pine A64/A64+.

MotionEyeOS is the perfect solution to build your own surveillance system because it is simple to install and has a web-based, user-friendly interface that is responsive in practically any browser.

It supports most USB cameras, Raspberry Pi camera modules, and IP cameras. Additionally, it brings other useful features when it comes to a surveillance system:

  • Motion detection with email notifications
  • You can set set a working schedule
  • Take still images
  • Store your files in SD card, USB drive, or upload your files to Google Drive or Dropbox
  • Access your media files through FTP server or SFTP server

Understanding the Raspberry PI camera module V2

The Raspberry Pi Camera Module v2 replaced the original Camera Module in April 2016. The v2 Camera Module has a Sony IMX219 8-megapixel sensor (compared to the 5-megapixel OmniVision OV5647 sensor of the original camera).

The Camera Module can be used to take high-definition video, as well as stills photographs. It’s easy to use for beginners, but has plenty to offer advanced users if you’re looking to expand your knowledge. There are lots of examples online of people using it for time-lapse, slow-motion, and other video cleverness. You can also use the libraries we bundle with the camera to create effects.

You can read all the gory details about IMX219 and the Exmor R back-illuminated sensor architecture on Sony’s website, but suffice to say this is more than just a resolution upgrade: it’s a leap forward in image quality, colour fidelity, and low-light performance. It supports 1080p30, 720p60 and VGA90 video modes, as well as still capture. It attaches via a 15cm ribbon cable to the CSI port on the Raspberry Pi.

The camera works with all models of Raspberry Pi 1, 2, and 3. It can be accessed through the MMAL and V4L APIs, and there are numerous third-party libraries built for it, including the Picamera Python library. See the Getting Started with Picamera resource to learn how to use it.

The camera module is very popular in home security applications, and in wildlife camera traps.

There’s also an infrared version of the camera (called Pi NoIR) which gives you everything the regular Camera Module offers, with one difference: it doesn’t use an infrared filter. This gives you the ability to see in the dark with infrared lighting.

You can read more about camera module here.

Understanding the Raspberry PI 3 model B

The Raspberry Pi 3 is the third-generation Raspberry Pi. It replaced the Raspberry Pi 2 Model B in February 2016.

Specification:

  • Quad Core 1.2GHz Broadcom BCM2837 64bit CPU
  • 1GB RAM
  • BCM43438 wireless LAN and Bluetooth Low Energy (BLE) on board
  • 40-pin extended GPIO
  • 4 USB 2 ports
  • 4 Pole stereo output and composite video port
  • Full size HDMI
  • CSI camera port for connecting a Raspberry Pi camera
  • DSI display port for connecting a Raspberry Pi touchscreen display
  • Micro SD port for loading your operating system and storing data
  • Upgraded switched Micro USB power source up to 2.5A

Signals and connections of the Raspberry PI 3 model B


Signals and connections of the Raspberry PI camera module V2

You can see on the back of ribbon cable one side has a piece of blue plastic and other has some traces on it. Line up traces on the ribbon cable with traces on the Raspberry PI 3 camera port. There is the tab which you can lift up and pull it by its edges. By doing that it will open up so you can insert the ribbon cable end with traces into the camera port. When it's in press tab to fix the ribbon cable.

Step by Step instruction

1. Using empty Micro SD card

  1. Download the SD Memory Card Formatter software for your operating system here.
  2. Install the SD Memory Card Formatter software.
  3. Insert your empty Micro SD card first to SD card adapter and then to the SD card reader connected to your PC.
  4. Open the SD card Formatter application, and format your microSD card with the "overwrite format" option selected.
  5. Download the MotionEyeOS image for your device here - (for Raspberry PI 3 it will be motioneyeos-raspberrypi3-20180401.img.xz).
  6. Use 7-zip to extract the motioneyeos-raspberrypi3-20180401.img file from motioneyeos-raspberrypi3-20180401.img.xz
  7. Use win32diskimager or Etcher, to write the image onto the Micro SD card. 
  8. The Win32 Disk Imager is a free tool that help us write images to USB sticks or SD/CF cards with our Windows machine. You can download it here. Etcher can be downloaded here and is available for Windows, Linux and Mac.
  9. Open Win32 Disk Imager. Select the image you’ve get previously, select your microSD card, and press Write button. When the flash is completed, your microSD card is ready OR
  10. Open Etcher. Select the image you’ve get previously, select your microSD card, and press Flash button. When the flash is completed, your microSD card is ready.
  11. Insert the Micro SD card in the Raspberry Pi 3.
  12. Connect an Ethernet cable to 10/100 LAN port of Raspberry Pi 3. You will need it on the first boot.
  13. Connect the Raspberry PI camera module V2 to the Raspberry Pi 3 camera port (CSI camera port). Make sure that Raspberry PI 3 switched off.
  14. Connect Micro USB power supply to Raspberry PI 3 board micro USB input.
  15. Wait for about 2 minutes for the system to boot.
  16. You need to find your Raspberry Pi’s IP Address on your PC in order to access it. You can use Angry IP Scanner or other similar software to find it. The Raspberry Pi’s IP Address you’re looking for is the one with "MEYE" on the name.
  17. Open any browser (IE, Mozilla, Opera and so on) on your PC and type the Raspberry Pi IP Address. You’ll see the MotionEye login page.
  18. If you are booting first time use username admin and password field leave blank.
  19. If you have a camera connected to your Raspberry Pi, it will be detected automatically, and you should see a live image from the camera. We have used two cameras - the USB camera and the Raspberry Pi Camera V2 module. You can see it shows shows live image from both cameras automatically.
  20. You can configure different things in your web user interface. We suggest to check the following configurations when configuring the MotionEyeOS for the first time. Go to the three bars menu, and open the General Settings; Enable Advanced Settings. You can change the admin username and set a password; Set your timezone and a hostname.Click the orange button at the top right “Apply” to apply the changes – this will require a reboot. The surveillance user is only granted view access to the video stream from my Raspberry Pi 3 camera. Configuring a username and password for the surveillance user would ensure that the video stream from your Raspberry Pi 3 CCTV camera only displays after either the surveillance user or admin user logs in successfully. To create a surveillance user, you need to enter a username in the Surveillance Username text field and a password in the Surveillance Password text field.
  21. You can also enable Wireless Network in the Network menu. You need to enter your network credentials as shown in the following figure.
  22. Expert Settings. To turn off the LED indicator of the camera, you need to  click on the toggle button for Enable CSI Camera Led to switch it off. Then press Apply button at the top and reboot your Raspberry Pi 3.
  23. There are quite a lot of different settings in this software. You can check them by going through the different menus.

2. Using Micro SD card with Raspbian

Before Proceeding

  • The given commands normally need to be run as root; type them in a root shell or use sudo before each command.
  • On systems where Python3 is the default Python interpreter, you should use the pip2 command instead of pip.
  • If you are configuring a motionEye system that will only act as a hub for other motionEye-based cameras (i.e. no locally connected cameras and no IP cameras), you can skip installing motion, ffmpeg.
  1. Insert your micro SD card with Raspbian into the TF card slot on the Raspberry Pi 3 board. It will only fit one way.
  2. Connect Raspberry PI 3 board HDMI port to your TV or Monitor HDMI port (use HDMI cable).
  3. Make sure that your monitor or TV is turned on, and that you have selected the right input (e.g. HDMI 1,  etc).
  4. Plug in your USB mouse and USB keyboard to Raspberry PI 3 USB ports.
  5. Plug an Ethernet cable into the Ethernet port to connect it to internet.
  6. Connect Micro USB power supply to Raspberry PI 3 board micro USB input.
  7. The Raspberry PI desktop will start up.
  8. Open the Raspberry Pi Configuration tool from the main menu. Go to Raspberry icon-> Preferences -> Raspberry PI configuration
  9. Ensure the camera software and SSH enabled. If it hey are not enabled, enable them and reboot your Raspberry PI 3 board to begin.
  10. There is another way to do it. When The Raspberry PI desktop start up go to Terminal.
  11. In the Terminal window, type the following command: sudo raspi-config
  12. You should see the Raspberry Pi software configuration tool. Select the Interfacing Options.
  13. Select P1 Camera and Yes to enable it.
  14. Select P2 SSH and Yes, then OK and Finish to enable it.
  15. For fresh install Raspbian you need to set the root password manually (if you don't know the default password). To do this just enter this command and your desired password: sudo passwd root. We used root as password.
  16. Some commands can't be used without a root privileges that's why we need to log as root user. Just type su at the command line and enter the password (we had set password root before) and you will see that left part of the command line changed to root@raspberrypi:/home/pi#
  17. We suggest you to use Web Browser from your Raspbian Pi Desktop as you connected to Internet and can use this project data to simply copy and paste to terminal's command line or you can type each command in the terminal's command line. 
  18. Use this command to update the dependencies of the pi: sudo aptitude update && sudo aptitude upgrade

  19. Motioneye require some dependencies for it to enable some features in this tutorial we will going to install all dependencies required for it to run all the features. Install ffmpeg first by using the command: apt-get install ffmpeg

  20. Install libmariadbclient18 and libpq5 required by motion - use this command: apt-get install libmariadbclient18 libpq5

  21. Download motion by using this command: wget https://github.com/Motion-Project/motion/releases/download/release-4.1.1/pi_stretch_motion_4.1.1-1_armhf.deb

  22. Install motion by using this command: dpkg -i pi_stretch_motion_4.1.1-1_armhf.deb

  23. Install the other dependencies from the repositories by using this command: apt-get install python-pip python-dev libssl-dev libcurl4-openssl-dev libjpeg-dev libz-dev

  24. If you can't get libcurl4-openssl-dev then use the command to download it: wget http://security.debian.org/debian-security/pool/updates/main/c/curl/libcurl4-openssl-dev_7.52.1-5+deb9u6_armhf.deb and install it: dpkg -i libcurl4-openssl-dev_7.52.1-5+deb9u6_armhf.deb
  25. Install motioneye, which will automatically pull Python dependencies (tornado, jinja2, pillow and pycurl) by using this command: pip2 install motioneye

  26. Prepare the configuration directory by using this command: mkdir -p /etc/motioneye
  27. Copy the config file just in-case you will be editing it in future by using this command: cp /usr/local/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf
  28. Prepare the media directory by using this command: mkdir -p /var/lib/motioneye
  29. Add an init script, configure it to run at startup and start the motionEye server: cp /usr/local/share/motioneye/extra/motioneye.systemd-unit-local /etc/systemd/system/motioneye.service
  30.  systemctl daemon-reload
  31.  systemctl enable motioneye
  32.  systemctl start motioneye
  33. To upgrade to the newest version of motionEye, just issue this command: pip2 install motioneye --upgrade
  34. Restart the motioneye by using this command: systemctl restart motioneye

  35. That's it you have now installed the motioneye and you now have a home surveillance camera using raspberry pi. To access the configuration go to your raspberry IP Address there's two way to get your IP: a) If you are still connected to your raspberry pi, you can type this command in the command line: ifconfig 
  36. b) or access your router dashboard to find your raspberry pi address.
  37. After having successfully followed the installation instructions, the motionEye server should be running on your system and listening on port 8765. Fire up your favorite web browser and visit the following URL: http://your-raspberry-ip-address:8765 and you'll be able to render a login page (we have IP address 192.168.0.124, so we access motioneye by typing this http://192.168.0.124:8765)
  38. If you are booting first time use username admin and password field leave blank.
  39. If you have a camera connected to your Raspberry Pi, it will be detected automatically, and you should see a live image from the camera. 

3. Where do I find the meye-xxxxxxxx boot login?

If you get this kind of window do not worry. You do not need this login and password. 

Summary

We have learnt how to use the Raspberry PI camera module V2 with MotionEyeOS.

Library

  • No libraries needed in this project

Sketch

  • No sketches needed in this project


Other projects of Acoptex.com
Medium Basics: Project 083w Sipeed Maixduino board - Using PlatformIO IDE of Acoptex.com in Sipeed Maixduino 08-08-2019
Medium Basics: Project 083e Sipeed Maixduino board - Uploading MaixPy of Acoptex.com in Sipeed Maixduino 04-08-2019
Medium Basics: Project 083f Sipeed Maixduino board - Using MycroPython of Acoptex.com in Sipeed Maixduino 04-08-2019

Published at 10-05-2018
Viewed: 3298 times