Programmable Logic

Enter Your Electronics & Design Project for a chance to win up to a $200 Shopping Cart of Product!

Back to The Project14 homepage

Project14 Home
Monthly Themes
Monthly Theme Poll

 

Overview

 

VidorScout is an autonomous mobile robot that uses Sensor Fusion which combines camera vision, Time of Flight Sensor data and IR Sensors to identify objects for both avoidance and for object identification. The camera sensor can also be used for QR code identification to identify that an object has been labeled correctly or as a waypoint with autonomous navigation.  The Arduino MKR Vidor 4000 Development Board will be used to take advantage of the on board SAMD Microcontroller and Intel Cyclone 10 FPGA capabilities. A 5MP OV5647 Camera sensor will be used to capture real-time images to be output via the Vidor HDMI port as well as for analysis.   A closed Maze will be used to demonstrate the functionality of the bot.

 

Related Posts

VidorScout - MKR Vidor 4000 Mobile Robot: VidorBitstream compile

VidorScout - MKR Vidor 4000 Mobile Robot: Camera QR Code Recognition

VidorScout - MKR Vidor 4000 Mobile Robot: Assembly and Test

 

Hardware

FeatureDetail
BrainArduino MKR Vidor 4000
ToF Sensor

Adafruit VL53L0X Time of Flight Distance Sensor - 30 to 1000mm

CameraMakerFocus Raspberry Pi3 Camera IR Fisheye Wide-Angle 175 Degree Camera 5MP OV5647 Webcam Built-in IR-Cut
Motor DriverAdafruit DRV8833 DMAX98357A
Motors2 x DC Gearbox Motor TT Motor 200RPM Tire Wheel DC 3-6V for Arduino
Audio OutAdafruit I2S 3W Class D Amplifier Breakout
MicAdafruit I2S MEMS Microphone Breakout – SPH0645LM4H
LightsACROBOTIC 1m 60-Pixel Addressable 24-Bit RGB LED Strip (White PCB), WS2812B (WS2811)
ChassisExpanded PVC for Robot Base

 

 

Software

 

ApplicationPurpose
Arduino IDEBuild and load code to the MKR Vidor 4000
Visual Studio CodeOffline coding edits
Intel Quartus Prime Lite Edition v18.1Sythesis of HDL designs
Nios II Command ShellBuild design configuration and create ttf files for installing to the board.
VidorFPGAIP Blocks for Vidor FPGA
VidorPeripheralsLibraries for controlling Vidor Peripherals
VidorGraphicsLibraries for creating Vidor HDMI graphics
VidorBitstreamFPGA files associated with the Vidor examples
USBBlasterEmulation of Intel USBBlaster programmer
WiFiNinaWiFi connection from Vidor

MKR Vidor 4000 First Steps

 

Prior to getting started with the MKR Vidor 4000, it is best to ensure the Arduino has the latest Vidor 4000 Libraries and BoardManger files.

 

Manage Libraries

 

To check the Libraries, from the top menu of the Arduino IDE:

 

1. Select Sketch->Include Library then  select Manage Libraries.

 

  2. From the Library Manager window, type in vidor in the search bar to get a list of Vidor 4000 related libraries.

      The main libraries are:

  • USBBlaster
  • VidorGraphics
  • VidorPeripherals
  • WiFiNINA

 

   3.  Update or install the appropriate libraries

 

Boards Manager

 

  To check the Boards Manager, from the Arduino IDE

   1. Select Tools->Board and click on Boards Manager

 

  2. Type "vidor" in the search bar to get a list of related board libraries.

      The current options are:

  • Arduino SAMD Beta Boards (32-bit ARM Cortex-M0+)
  • Arduino SAMD Boards (32-bit ARM Cortext-M0+)

 

  3. Update or install the appropriate board files.

 

BootLoader

 

  To update the MKR Vidor 4000 BootLoader:

   1. From the Arduino IDE menu, select File->Examples then SAMD_BootLoaderUpdater->UpdateBootloader

   

 

  2. This will open the UpdateBootloader Sketch.

 

 

  3. Build and load the UpdateBootloader Sketch and then open the Serial Monitor to complete the update

 

  4. The following message will be seen in the Serial Monitor

Type 'Y' in the upper command input and hit Enter
//////////////////////////////

Welcome to the Arduino SAMD bootloader updater
----------------------------------------------

Checking if bootloader requires an update ... bootloader is NOT running the latest


Would you like to proceed with updating it? (y/N)

WARNING: DO NOT UNPLUG the USB cable during the update!!!

Updating bootloader ...

0.00%
6.25%
12.50%
18.75%
25.00%
31.25%
37.50%
43.75%
50.00%
56.25%
62.50%
68.75%
75.00%
81.25%
87.50%
93.75%
100.00%

The bootloader was successfully updated \o/

Your board will now start blinking in joy :)

 

 

Firmware Update

 

To update the Firmware on the MKR Vidor 4000, I'll just reference a previous post of mine that outlines how to do this on the MKR WiFI 1010 but the process should be the same with the Vidor 4000.

MKR WiFi 1010 - Enable BLE Support

 

 

Vidor 4000 Example

 

Once the board has been updated, select an Vidor example to ensure the board is working.

Here I have selected the VidorGraphics->VidorDrawLogo as an example but with some modifications.

Code:

#include "VidorGraphics.h"
#include "Vidor_GFX.h"

Vidor_GFX  vdgfx;

void setup() {
  Serial.begin(9600);

  // wait for the serial monitor to open,
  // if you are powering the board from a USB charger remove the next line
  while (!Serial);

  // Initialize the FPGA
  if (!FPGA.begin()) {
    Serial.println("Initialization failed!");
    while (1) {}
  }

  delay(4000);
  Serial.println("Fill Rect!");
}

void loop()
{
  /**
  *  Draw an Arduino logo
  */

  // Fill the screen with a white background
  //vdgfx.fillRect(0,0,640,480,vdgfx.White());
  vdgfx.fillRect(0,0,1680,1050,vdgfx.White());


  /**
  *  The library allows drawing some basic elements to the view, like circles, rectangles, lines
  */  

  /*
  vdgfx.fillCircle(225,225,100 ,vdgfx.lightBlue());
  vdgfx.fillCircle(415,225,100 ,vdgfx.lightBlue());
  vdgfx.fillCircle(225,225,90 ,vdgfx.White());
  vdgfx.fillCircle(415,225,90 ,vdgfx.White());
  vdgfx.fillRect(175,220,100,10 ,vdgfx.lightBlue());
  vdgfx.fillRect(365,220,100,10 ,vdgfx.lightBlue());
  vdgfx.fillRect(410,175,10,100 ,vdgfx.lightBlue());
  */
  /**
  *  To draw a text we can use the classic functions like write() and print()
  *  Text size, color and position can be changed using the .text subclass
  */
  vdgfx.setFont(5);
  vdgfx.text.setCursor(200,130);
  vdgfx.text.setAlpha(255);
  vdgfx.text.setSize(3);
  //vdgfx.text.setColor(vdgfx.lightBlue());
  vdgfx.text.setColor(vdgfx.darkTurquoise());
  vdgfx.println("element");
  vdgfx.text.setCursor(385,130);
  vdgfx.text.setSize(3);
  vdgfx.text.setColor(vdgfx.redOrange());
  vdgfx.println("14");
  
  vdgfx.setFont(5);
  vdgfx.text.setCursor(215,370);
  vdgfx.text.setAlpha(255);
  vdgfx.text.setSize(3);
  //vdgfx.text.setColor(vdgfx.lightBlue());
  //vdgfx.text.setColor(vdgfx.darkTurquoise());
  vdgfx.text.setColor(vdgfx.Black());
  vdgfx.println("Project");
  vdgfx.text.setCursor(376,370);
  vdgfx.text.setSize(3);
  //vdgfx.text.setColor(vdgfx.redOrange());
  vdgfx.text.setColor(vdgfx.yellowGreen());
  vdgfx.println("14");

  while (1) {
  }
}

 

I made some edits to the Vidor_GFX code to add more colors

 

Vidor_GFX.h

   uint32_t darkCyan();

   uint32_t darkTurquoise();
   uint32_t redOrange();
   uint32_t yellowGreen();

 

Vidor_GFX.cpp

uint32_t Vidor_GFX::darkCyan() {

 return Color(0x00, 0x8B, 0x8B);
}

uint32_t Vidor_GFX::darkTurquoise() {
 return Color(0x00, 0xCE, 0xD1);
}

uint32_t Vidor_GFX::redOrange() {
 return Color(0xFF, 0x81, 0x00);
}

uint32_t Vidor_GFX::yellowGreen() {
 return Color(0x8E, 0xAA, 0x31);
}

 

 

This produces the following image from the HDMI connection:

 

Next Step - Download the FPGA files and build and load them to the board via the Arduino IDE.