MKR Vidor 4000 Camera Example
The Arduino MKR Vidor 4000 is not only the first in the Arduino MKR series to provide a FPGA option, it also as the option to add a camera via a MIPI connector near the Mini PCIe connector. With the assistance of the onboard FPGA, this allows the Vidor 4000 to be used in a variety of computer vision applications. This can include facial recognition, obstacle navigation and avoidance as well as object detection. There are two examples that are provided by Arduino as a starting point for computer vision with the MKR Vidor 4000; VidorEnableCam and VidorQrRecognition. The VidorEnableCam example is a good test to verify the camera option of the MKR Vidor 4000 and the VidorQrRecognition adds QR Code Recognition to this as well as demonstrates the capability to add imagery on top of the camera image. The VidorQrRecognition will be used in this example as well as a bit of NeoPixel functionality.
Related Posts
VidorScout - MKR Vidor 4000 Mobile Robot: Intro
VidorScout - MKR Vidor 4000 Mobile Robot: VidorBitstream compile
VidorScout - MKR Vidor 4000 Mobile Robot: Assembly and Test
VidorEnableCam
https://www.arduino.cc/en/Tutorial/VidorEnableCam
VidorQrRecognition
https://www.arduino.cc/en/Tutorial/VidorQrRecognition
Hardware Required
- Arduino MKR Vidor 4000
- Omnivision OV5647 camera or Raspberry Pi Camera V1 (OV5647)
- Used :
- MakerFocus Camera IR Fisheye Wide-Angle 175 Degree 5MP OV5647 Webcam Built-in IR-Cut
- Used :
- micro-HDMI to HDMI cable or adapter
- Monitor with HDMI input
- NeoPixel Strip - Addressable 24-Bit RGB LED Strip (White PCB), WS2812B (WS2811)
Hardware Set-up
To demonstrate the VidorQrRecognition capabilities of the MKR Vidor 4000, a MakerFocus 5MP OV5647 Camera was used. At this time, the examples provided from the Arduino Libraries only support the OV5647 sensor which was used in the v1.x of the Raspberry Pi Camera module, thus the v2.x Raspberry Pi Camera will not work with the code provided without modifying the code.
MakerFocus 5MP OV5647 Camera and MKR Vidor 4000
The O5647 camera connects to the MKR Vidor 4000 at the J8 MIPI camera connector near the Mini PCIe connection (J2) .
Note the orientation of the blue tab on the camera cable.
Connect a micro-HDMI to HDMI cable to a computer monitor.
NOTE: It took testing with 3 different monitors before an image was seen from the MKR Vidor 4000. The default resolution is 640x480@60Hz .
MakerFocus IR Fisheye Wide-Angle 175 Degree 5MP OV5647 Camera also comes with 2 large IR sensors that mount on each side of the Camera PCB. These will not be used in this example. Also, the NeoPixel Strip is connected to A6 of MKR Vidor 4000 with a 470 Ohm resistor.
Connect the MKR Vidor4000 to a computer using a USB to USB-micro cable.
Vidor example install
If not completed already, add the VidorGraphics and VidorPeripheral libraries to the Arduino IDE; see the Intro from the Related Posts list.
For this example, the VidorGraphics, VidorCamera and Vidor_NeoPixel libraries were used.
NOTE: There is a difference between the VidorGraphics examples from the VidorBitstream code and the current released version that is added by the Arduino IDE libraries. Thus, if the VidorGraphics examples are from the VidorBitstream process and code was created from the original examples, a few changes will be necessary since the older code will not compile or run with the newer code.
Diff between original and VidorBitstream VidorQrRecognition Arduino code.
A comment added to top of new code.
The wait for Serial was removed and a "vcam.vgfx.begin() was added to initialize the video subsystem.
New code adds "vcam.qrrec.draw()" to enable the camera output for QR code recognition.
VidorQrRecognition example
Description of the VidorQrRecognition example can be found on the Arduino site at the following link.
https://www.arduino.cc/en/Tutorial/VidorQrRecognition
The VidorQrRecognition example demonstrates the interaction between the FPGA BitStream code and the Arduino libraries by recognizing the markers on a QR code and then displaying cross hair images where the QR code markers are located on the screen. Also, the example was modified to indicate when the QR code markers are found, a NeoPixel LED will light and thus blink accordingly.
If the QR code is covered, then the Cross hair are not displayed on screen and the NeoPixel LED does not blink. Expose the QR code again and the QR code marker indicators are seen again.
To perform the demonstration, a RadioShack Helping Hand was used to hold the MakerForce camera module and a QR code was created from the works "MKR Vidor 4000". The image is displayed on an HDMI Monitor and a webcam was used to capture it.
QR Code markers found and NeoPixel LED lights red
Video Demo of the VidorQrRecognition example.
Next Step
Assemble chassis and mount motors and IR sensors.
Top Comments