The Motion Surveillance application detects a motion in front of the Arducam Mega (camera module) using the PIR Click (motion sensor) board. ArduCAM captures an image with resolution 320x240 and stores the image in an external storage device (microSD Card). Additionally, the application demonstrates a live preview of captured images.
The live preview of captured images is demonstrated by running an HTTP web server on the development board. The user connects to the webserver through an internet browser and view the live preview of the captured images.
microSD Card
LAN8740
PHY daughter board
Note: The link above points to LAN8720A PHY
Daughter Board. You can procure the PIC32MZ
Embedded Connectivity with FPU (EF) Starter Kit and remove the
LAN8740 PHY Daughter board on it and use it for this demo.
Arducam
Mega 5MP Rolling Shutter camera or Arducam
Mega 3MP Rolling Shutter camera
Note: The project is by
default configured to function with the Arducam Mega 5MP camera.
However, if you wish to use the Arducam Mega 3MP camera instead, you can
do so by modifying the CAMERA_TYPE to CAMERA_OV3640 in the “arducam.h”
file of the project, as shown below.
This project has been verified to work with the following versions of software tools:
Refer Project
Manifest present in harmony-manifest-success.yml under the project
folder firmware/src/config/default
- Refer the Release Notes to
know the MPLAB X IDE and MCC Plugin
version. Alternatively, Click
Here.
- MPLAB
XC32 C/C++ Compiler v4.30
- Any Serial Terminal application like Tera Term terminal
application.
Because Microchip regularly update tools, occasionally issue(s) could be discovered while using the newer versions of the tools. If the project doesn’t seem to work and version incompatibility is suspected, It is recommended to double-check and use the same versions that the project was tested with.
Note: The above pin configuration can be followed while using an Arducam Mega 3MP Rolling Shutter camera as well.
To run the webserver component in the demo application, the target development board and the host computer should be in the same network. The host computer can be connected to a router via an ethernet cable or Wi-Fi. The target board should be connected to the router via an ethernet cable. Please refer to the following connection diagram.
The application is configured and build with LAN8740 PHY driver. To use a different PHY, use MPLAB® Code Configurator (MCC) to select and configure the PHY. Make sure that correct PHY address and configuration flags are used for the particular PHY daughter board. The MII/RMII and I/O configuration flags should match the hardware for the PHY board. This application demonstration assumes that IPv4 is enabled. If IPv4 is not enabled in MCC, the code in app.c will not build and needs to be updated to remove the IPv4 dependencies.
The demo has DHCP enabled, and expect a DHCP server to be available. If there is no DHCP server, then the default static IP address will be used: 192.168.100.10. If this static address does not match your network settings, use MPLAB® Code Configurator (MCC) to modify the static IP address of the network interface.
The NetBIOS name of the application is specified during the initialization of TCP/IP stack. It is the hostName member of TCPIP_HOSTS_CONFIGURATION structure. The NetBIOS service must be enabled in demonstration configuration, for the demonstration to respond to NetBIOS queries. Alternatively, use the IPv4 or IPv6 address (if IPv6 is enabled) of the board directly.
The IPv4 and IPv6 addresses can be obtained by running the TCP/IP Discovery utility on the computer. Ex: ipconfig
The pre-built hex file can be programmed by following the below steps.
Perform “Hardware Setup” steps mentioned above, if not done already.
Ensure a microSD Card is formatted and loaded with the web_pages provided within the **pic32mzef_motion_surveillance_pages** directory.
Build and download the demonstration project on the target board.
Serial Terminal Configuration:
When the DHCP client is enabled in the demonstration, wait for the DHCP server to assign an IP address for the development board. This will be printed on the serial port terminal (shown inside red box in the above image).
Alternatively: Use ipconfig to get the IP address of the board and ping to test if the device is reachable.
An LED “LED2” on the Curiosity PIC32MZ EF 2.0 Development Board toggles when a motion is detected in front of the motion sensor (PIR click).
An JPEG format image with 320x240 resolution is captured and stored on the microSD Card. Check the logs in the terminal for the motion detection, start capture and saved image events.
Steps to preview the captured images:
Step 1: Live streaming of captured images:
Note:
Step 2: Preview the images stored on the microSD Card using Windows Photo Viewer application:
Reference Training Module:
This application demo builds and works out of box by following the instructions above in “Running the Demo” section.