Product Review - Arduino GIGA R1 WiFi + Camera - A beast in the embedded, IoT and robotics makerspace

Table of contents

RoadTest: Enroll to Review the Arduino GIGA R1 WiFi + Camera

Author: crisdeodates

Creation date:

Evaluation Type: Development Boards & Tools

Did you receive all parts the manufacturer stated would be included in the package?: True

What other parts do you consider comparable to this product?: Portenta H7, Arduino Mega / Due

What were the biggest problems encountered?: Availability of onboard off-the-shelf ports such as grove ports could have been better (solvable using shields)

Detailed Review:

Introduction

First of all, I would like to thank rscasny, the roadtest program team, and element14 for giving me this awesome chance to roadtest this amazing product Arduino Giga R1 Wifi board. Element14 was kind enough to send me a piece for road testing. I have been playing with Arduino boards ever since I started my robotics path. In fact, my first major project from college was using an Arduino Nano, dating back to the early beginning of the previous decade. So Arduino is not new to me and this beast of a thing is absolutely monstrous. Seriously? 76 GPIOs? Even Mega and Due had only 54 of them. When this board was available for the road test, I was determined to try this, not just for the kind of monster it is in the embedded space, but also to explore the endless possibilities it can provide in terms of scaling and productivity in the maker space. More interestingly, I was intrigued by the following statement from the official page: “You can for example run MicroPython and Arduino code simultaneously and communicate via an RPC”

Unboxing/Out of the box Experience

Let's have a look at the kit and its components:


The box came with the following components:

  1. Arduino box
    1. 1 x Arduino Giga R1 Wifi with glass bottom
    2. 1 x 2.4/5Ghz flexible MOLEX antennae
    3. 1 x classic Arduino thank you slip
    4. 1 x classic Arduino stickers (I have like a lot of them now Grinning)
  2. Arducam box
    1. 1 x Arducam OV7675 VGA Color 20-pin DVP Camera Module

      (Yes, Randall was kind enough to include a camera module for the road testers)

The Arduino board in its “Giga” form really made an excellent first impression. The board was massive to hold at 101.6mm x 53.3mm (just like its older cousins Mega and Due), even dwarfing the Raspberry Pi 4 board's 56.5mm x 85.6mm footprint.

By default, the Arduino Giga board seems to come with a multicolor LED blink arduino program that seems to cycle between the Red, Green, and Blue colors of the inbuilt RGB LED that is present next to the audio jack.


Similar boards

There are basically 3 boards that could potentially be compared to Arduino Giga R1 Wifi.

Arduino GIGA R1 WiFi board basically inherits the STM32H7 dual-core Cortex-M7/M4 microcontroller of Portenta H7 boards while maintaining the larger Arduino Mega/Due form factor.

Performance in comparison to Portenta H7: 

Arduino GIGA R1 WiFi board could be expected to have the same high computing capacity as Portenta H7 boards since they share the same STM32H7 microcontroller.

However, in contrast to the Portenta H7, the Giga board comes with 76 GPIO, an audio jack, a USB 2.0 Type-A host port, and extra connectors for a display and a camera. At the same time, the Giga board has no support for DisplayPort over USB-C, no on-board 10/100M Ethernet PHY, no high-density connectors, and no built-in battery support which are present in the Portenta H7 board. 

Both boards feature a USB Type-C port for programming, integrating 2 MB of flash memory, 1 MB of RAM, 16 MB QSPI Flash memory, and 8 MB of SDRAM. Additionally, both boards have a Murata module for wireless connectivity (Wi-Fi and Bluetooth Low Energy BLE). Both boards can be programmed with the Arduino IDE or MicroPython. The dual-core design allows two programs to be run simultaneously with either both cores running Arduino code or one core running an Arduino sketch and the other a MicroPython script. An additional advantage of dual-core design as stated by the Arduino team is that, with this architecture, we can separate higher-level logic such as displays, interfaces, and networking from time-critical tasks such as motor control.

Features in comparison to Arduino Mega / Due:

At first look, the Giga board resembles the look of the Mega / Due form factor, although the Mega and Due can never match Giga in terms of performance. 

Image courtesy: MakerHero

The key difference is that Giga boasts a whooping 76 GPIO in contrast to the 54 GPIO in Mega / due boards. Also, Giga additionally has wireless connectivity, an audio jack, a USB 2.0 Type-A host port, a JTAG connector, and extra connectors for a display and a camera. The Giga also comes equipped with a crypto chip and an antenna. Within the generous 76 GPIO pins, 12 support PWM, 12 with analog input & 2 DACs. There are 4 UART, 3 I2C, and 2 SPI buses, plus CAN bus support (requires external transceiver). The Giga board also includes two new pins in contrast to Mega / Due. They are a VRTC pin to keep the real-time clock running when the main power is removed and an OFF pin that shuts down the board. Giga board can be powered with inputs varying from 6-24V DC while the other two only support up to a maximum of 12V. Even though all the existing shields seem compatible, Giga is a 3.3-volt logic device. Hence most of the existing shields might not work if they operate at the 5V levels. Since the microcontroller operates on a voltage of 3.3V, applying a higher voltage than that, such as 5V, to a pin might damage the microcontroller

Links

Here are some links to get started:

Board walkthrough

Let's have a look at the datasheet and some specifications of the Arduino Giga R1 Wifi board.

The Arduino GIGA R1 is one of the most feature-packed Arduino boards to date. It is supported by the same powerful, ML-capable, dual-core microcontroller found in the Arduino Pro family's Portenta H7.

Courtesy: DroneBot Workshop

Image Courtesy: DroneBotWorkshop

More detailed top view:

image

Image Courtesy: Arduino

More detailed bottom view:

image

Image Courtesy: Arduino

The reference ICs are:

Ref.

Description

Ref.

Description

U1

STM32H7 Dual Core Microcontroller IC

U8

AT25SF128A-MHB-T 16 MB Flash IC

U3

AS4C4M16SA 8MB SDRAM IC

U4

ATECC608A-MAHDA-T Secure Element IC

U5

LBEE5KL1DX-883 Wi-Fi®/Bluetooth® Module

U6

MP2322GQH Buck Converter 3.3V IC

U7

MP2269GD-Z Buck Converter 5V IC

JANALOG

Analog input/output headers

JDIGITAL

Digital input/output headers

JSIDE

Digital input/output headers

SPI

SPI headers

JTAG

JTAG Headers

J2

USB 2.0 A Host

J15

3.5 mm audio in/out

PB1

RESET Button

PB2

BOOT0 button

J14

Micro UFL connector

J5

Camera

J6

Camera

DL1

Power LED

DL2

RGB SMLP34RGB2W3 Common anode LED

J12

CX90B-16P USB-C® connector

Here are the main technical specifications.

  • STM32H747XIH6 Microcontroller (datasheet)
    • 32-bit Arm® Cortex®-M7 core with double-precision FPU and L1 cache up to 480 MHz
    • 32-bit Arm® 32-bit Cortex®-M4 core with FPU up to 240 MHz
    • Dual-core
  • Full set of DSP instructions

  • Memory Protection Unit (MPU)

  • Murata® 1DX Wi-Fi®/Bluetooth® Module (datasheet)
    • Wi-Fi® 802.11b/g/n 65 Mbps
    • Bluetooth® Low Energy (version 5. X via Cordio stack, version 4.2 via Arduino Stack)
    • Micro UFL connector for external antenna
  • Memory
    • 2 MB Flash
    • 1 MB RAM
    • 16 MB NOR Flash
    • QSPI Interface
    • 8 MB SDRAM
  • I/O
    • Digital I/O Pins: 76
    • Analog input pins: 12
    • PWM pins: 13
    • Analog output pins (DAC0/DAC1): 2
    • USB Host: USB 2.0 A
    • USB Peripheral: USB-C®
    • Logic level: 3.3V
    • VRTC: To power the RTC while the board is off
    • OFF pin: To turn off the board

  • Communication
    • 4x UART
    • 3x I2C
    • 2x SPI
    • 1x CAN (an external transceiver is required)

  • Secure Element ATECC608A-MAHDA-T Module (datasheet)

  • USB
    • Host
    • Programming Port
    • HID
    • USB Host USB 2.0 Type A
    • USB Peripheral USB-C®

  • Connectors
    • Camera: 20-pin Arducam camera connector
    • Display: D1N, D0N, D1P, D0P, CKN, CKP, D68-D75
    • Audio jack: DAC0, DAC1, A7
    • JTAG connector

  • Power
    • Circuit operating voltage: 3.3V
    • Input voltage (VIN): 6-24V
    • DC Current per I/O Pin: 8 mA

  • Target areas
    • 3D printing
    • Signal Processing
    • Maker Space
    • Robotics
  • Compatible Software & Development tools
    • Arduino IDE
    • Arduino CLI
    • Arduino Web Editor
    • Arduino IoT cloud
    • dfu-util
    • Arduino Lab for MicroPython
    • Thonny
    • Arduino Core / MbedOS
    • Micro Python

The pinout of the Arduino Giga R1 Wifi board is as follows.

image

Image Courtesy: Arduino

Pin

Function

Type

Description

Three-Pins Header – J1

1

OFF

Digital

3V3 Enable Pin (U6)

2

GND

Power

Ground

3

VRTC

Reset

Real-Time Clock Battery

Analog

1

NC

NC

Not Connected

2

IOREF

IOREF

Reference for digital logic V - connected to 3.3V

3

Reset

Reset

Reset

4

+3V3

Power

+3V3 Power Rail

5

+5V

Power

+5V Power Rail

6

GND

Power

Ground

7

GND

Power

Ground

8

VIN

Power

Voltage Input

9

A0

Analog

Analog input 0 /GPIO

10

A1

Analog

Analog input 1 /GPIO

11

A2

Analog

Analog input 2 /GPIO

12

A3

Analog

Analog input 3 /GPIO

13

A4

Analog

Analog input 4 /GPIO

14

A5

Analog

Analog input 5 /GPIO

15

A6

Analog

Analog input 6 /GPIO

16

A7

Analog

Analog input 7 /GPIO

17

A8

Analog

Analog input 8 /GPIO

18

A9

Analog

Analog input 9 /GPIO

19

A10

Analog

Analog input 10 /GPIO

20

A11

Analog

Analog input 11 /GPIO

21

DAC0

Analog

Digital to Analog Converter 0

22

DAC1

Analog

Digital to Analog Converter 1

23

CANRX

Digital

CAN Bus Receive

24

CANTX

Digital

CAN Bus Transfer

Digital

1

D21/SCL1

Digital

GPIO 21/I2C 1 Clock

2

D20/SDA1

Digital

GPIO 20/I2C 1 Dataline

3

AREF

Digital

Analog Reference Voltage

4

GND

Power

Ground

5

D13/SCK

Digital

GPIO 13/SPI Clock (PWM~)

6

D12/CIPO

Digital

GPIO 12/SPI Controller In Peripheral Out (PWM~)

7

D11/COPI

Digital

GPIO 11/SPI Controller Out Peripheral In (PWM~)

8

D10/CS

Digital

GPIO 10/SPI Chip Select (PWM~)

9

D9/SDA2

Digital

GPIO 9/I2C 2 Dataline (PWM~)

10

D8/SCL2

Digital

GPIO 8/I2C 2 Clockline (PWM~)

11

D7

Digital

GPIO 7 (PWM~)

12

D6

Digital

GPIO 6 (PWM~)

13

D5

Digital

GPIO 5 (PWM~)

14

D4

Digital

GPIO 4 (PWM~)

15

D3

Digital

GPIO 3 (PWM~)

16

D2

Digital

GPIO 2 (PWM~)

17

D1/TX0

Digital

GPIO 1 / Serial 0 Transmitter

18

D0/TX0

Digital

GPIO 0 / Serial 0 Receiver

19

D14/TX3

Digital

GPIO 14 / Serial 3 Transmitter

20

D15/RX3

Digital

GPIO 15 / Serial 3 Receiver

21

D16/TX2

Digital

GPIO 16 / Serial 2 Transmitter

22

D17/RX2

Digital

GPIO 17 / Serial 2 Receiver

23

D18/TX1

Digital

GPIO 18 / Serial 1 Transmitter

24

D19/RX1

Digital

GPIO 19 / Serial 1 Receiver

25

D20/SDA

Digital

GPIO 20 / I2C 0 Dataline

26

D21/SCL

Digital

GPIO 21 / I2C 0 Clock

STM32 ICSP

1

CIPO

Internal

Controller In Peripheral Out

2

+5V

Internal

Power Supply of 5V

3

SCK

Internal

Serial Clock

4

COPI

Internal

Controller Out Peripheral In

5

RESET

Internal

Reset

6

GND

Internal

Ground

Digital Pins D22 - D53 LHS

1

+5V

Power

+5V Power Rail

2

D22

Digital

GPIO 22

3

D24

Digital

GPIO 24

4

D26

Digital

GPIO 26

5

D28

Digital

GPIO 28

6

D30

Digital

GPIO 30

7

D32

Digital

GPIO 32

8

D34

Digital

GPIO 34

9

D36

Digital

GPIO 36

10

D38

Digital

GPIO 38

11

D40

Digital

GPIO 40

12

D42

Digital

GPIO 42

13

D44

Digital

GPIO 44

14

D46

Digital

GPIO 46

15

D48

Digital

GPIO 48

16

D50

Digital

GPIO 50

17

D52

Digital

GPIO 52

18

GND

Power

Ground

Digital Pins D22 - D53 RHS

1

+5V

Power

+5V Power Rail

2

D23

Digital

GPIO 23

3

D25

Digital

GPIO 25

4

D27

Digital

GPIO 27

5

D29

Digital

GPIO 29

6

D31

Digital

GPIO 31

7

D33

Digital

GPIO 33

8

D35

Digital

GPIO 35

9

D37

Digital

GPIO 37

10

D39

Digital

GPIO 39

11

D41

Digital

GPIO 41

12

D43

Digital

GPIO 43

13

D45

Digital

GPIO 45

14

D47

Digital

GPIO 47

15

D49

Digital

GPIO 49

16

D51

Digital

GPIO 51

17

D53

Digital

GPIO 53

18

GND

Power

Ground

Recommended Operating Conditions of Giga are:

Symbol

Description

Min

Typ

Max

Unit

VIN

Input voltage from VIN pad

6

7

32

V

VUSB

Input voltage from USB connector

4.8

5

5.5

V

VDD

Input high-level voltage

0.7*VDD

VDD

V

VIL

Input low-level voltage

0

0.3*VDD

V

TOP

Operating Temperature

-40

25

85

°C

Note: VDD controls the logic level and is connected to the 3.3V power rail and VAREF is for the analog logic

Here is the functional block diagram:

image

Image Courtesy: Arduino

The power distribution is below:

image

Image Courtesy: Arduino

Let us also look at the Arducam module and its datasheet.

The camera is based on an OmniVision 0.3MP OV7675 image sensor. It excels in image capture with its advanced features and exceptional performance and supports RAW/RGB/YUV output format. It is fully compatible with Arduino GIGA R1 board allowing versatile image capture and processing capabilities.

  • Image Sensor: OV7675
  • Resolution: VGA
  • Optical Size: 1/9”
  • Number of effective pixels: 640(H) × 480(V)
  • Pixel Size: 1.75μm × 1.75μm
  • Support Platform: Arduino GIGA R1 WIFI Board
  • Shutter Type: Electronic Rolling Shutter
  • Color Filter Array: Quad-Bayer RGB
  • Frame Rate: 15fps
    • 640×480
    • 320×240
    • 160×120
  • Output Format: RAW
    • RAW RGB
    • YUV422
    • RGB565
  • F.NO: 2.8±5%
  • Focus Distance: 2.7m – ∞
  • Focal Length: 1.75mm
  • Field of View(FOV): 63.9°(D)
  • Power Supply
    • AVDD: 2.7VA ~ 3.0V
    • DOVDD: 1.7V ~ 3.0V
    • DVDD: 1.8V
  • Operating Temperature: -30~70℃
  • Camera Board Size: 30.5mm x 30.5mm

The pinout of the Arducam module is shown below.

image

Image Courtesy: ArduCam

Getting Started

Now, let’s get down to business and start tinkering with our new Arduino Giga R1 Wifi board. The initial setup with MbedOS is pretty straightforward like any other Arduino board.

  1. Download and Install Arduino IDE from the Arduino Software page.
  2. Open the IDE and install the board package.
    To install the GIGA board package, choose "Board Manager" from the left menu.
    Search for "GIGA" and install the latest version.
  3. Select your board in the board selector.
  4. Connect the board to your computer via the USB-C connector.

image

Now let us try an example blink sketch

  1. Open the example from File -> Examples -> Basics -> Blink
  2. Verify (Checkmark) and Upload (Right arrow) the sketch to the board
  3. Now the inbuilt RGB LED near the audio port should start blinking green.
  4. We have successfully set up the Giga board with the Arduino Core for mbed devices.

image

INFO: Normally, if the sketch fails for some reason, the board resets. On the GIGA R1, whenever the MbedOS fails, the board does not reset automatically. Instead, if it fails, the onboard red LED will start to blink in a looping pattern of 4 fast blinks and 4 slow blinks. Hence the red LED does NOT mean your board is broken or bricked. Instead, you can either press the reset button once to reset the sketch or double-tap the reset button to enter bootloader mode which allows you to re-program the board.

Testing

Here we will test the various features and capabilities of the Arduino Giga R1 Wifi board, along with the interfacing of various sensors and actuators.

GPIO access 

Let's connect a bush button to Digital pin 7 of the GigaR1 and read its value.

In the Arduino IDE, go to File -> Examples -> Basics -> DigitalReadSerial

Change the variable pushButton to 7 for Digital Pin number 7 in GigaR1.

Compile and upload the sketch.

Connect a push button to the Digital Pin 7 of the GigaR1.

I used a DFRobot Gravity Push button: https://www.dfrobot.com/product-2362.html

Connect the power pins of the pushbutton to 3.3v and the GND pins of the GigaR1.

image

Observe the state of Digital Pin 7 in the serial monitor output.

image

Wifi access

Reference: https://docs.arduino.cc/tutorials/giga-r1-wifi/cheat-sheet#wi-fi 

Let's see how the Wifi could be set up in GigaR1.

In the Arduino IDE, go to File -> Examples -> Wifi -> WifiWebClient

Change the SSID and password in the arduino_secrets.h file

Change the server variable name to google.com in WifiWebClient.ino file

Compile and Upload the program

image

We can see that the Giga R1 successfully connected to our local Wifi and was able to access the Google server webpage.

IoT cloud

Connecting to Arduino Cloud:

  1. Login to Arduino cloud: https://create.arduino.cc/
  2. Download and install the Arduino Create Agent: https://create.arduino.cc/getting-started/plugin/download 
  3. Make sure the Agent is active and Giga R1 is connected to the computer
  4. Come to the devices tab and click Add Device
  5. Select the option Arduino board and wait for the board to be detected
  6. Once the device is detected, click configure
  7. Give a name for the device. Eg: GigaR1 and proceed
  8. Now the cloud setup will take place and makes the device accessible to the Arduino IoT cloud

image

USB access

Reference: https://docs.arduino.cc/tutorials/giga-r1-wifi/giga-usb 

USB Host

Generic USB keyboards could be easily connected to the GIGA R1's USB-A connector without any additional circuitry. However, we need the USBHostGiga library.

Note: To enable the USB-A port, you will need to define it as an output (PA_15). We can also disable it inside of a sketch by writing a LOW state to it.

  1. Download the USBHostGiga library as a zip file: https://github.com/arduino-libraries/USBHostGiga 
  2. Go to Sketch > Include Library > Add .zip Library and select the downloaded zip to install the library.
  3. Compile and upload the below code:

#include "USBHostGiga.h"

Keyboard keyb;

HostSerial ser;

void setup() {

  Serial.begin(115200);

  while (!Serial);

  pinMode(PA_15, OUTPUT);

  keyb.begin();

  ser.begin();

}

void loop() {

  if (keyb.available()) {

    auto _key = keyb.read();

    Serial.println(keyb.getAscii(_key));

  }

  while (ser.available()) {

    auto _char = ser.read();

    Serial.write(_char);

  }

  //delay(1);

}

Once the code is uploaded, connect your USB keyboard to the USB-A port of GigaR1.

image

Open the serial monitor and start pressing the keyboard keys.

The keys pressed will be displayed on the serial monitor.

image

USB HID

GIGA R1 board can also be transformed or emulated into a Human Interface Device (HID), e.g. mouse & keyboard, game controller, etc.

Let's try to emulate a keyboard. 

In the Arduino IDE, go to File -> Examples -> USBHID -> Keyboard

Open a notepad after the code is uploaded

image


We can see that the GigaR1 now emulates a keyboard and prints the text “Hello World” as if typed from a keyboard device.

CAUTION: The keyboard continues to print as soon as the code is uploaded as it is inside the loop. Hence make sure you are bringing up a notepad or another textual area as soon as the code upload is finished or the board is reset.

CAUTION: Once the GigaR1 is configured as an HID, it will fail to upload any more sketches. In that case, double press the RST button (to the right of the USB-C port) to enter bootloader mode. You will be able to upload new sketches now.

USB Read

Reference: https://reference.arduino.cc/reference/en/libraries/arduino_usbhostmbed5/ 

Let's try to read the contents of a USB drive connected to the USB-A port of the GigaR1.

Go to the Library Manager and install the Arduino_USBHostMbed5 library

Compile and upload the below code:

#include <DigitalOut.h>

#include <FATFileSystem.h>

#include <Arduino_USBHostMbed5.h>

USBHostMSD msd;

mbed::FATFileSystem usb("usb");

void setup()

{

    Serial.begin(115200);    

    pinMode(PA_15, OUTPUT); //enable the USB-A port

    digitalWrite(PA_15, HIGH);    

    while (!Serial)

        ;

    Serial.println("Starting USB Dir List example...");

    // if you are using a Max Carrier uncomment the following line

    // start_hub();

    while (!msd.connect()) {

        //while (!port.connected()) {

        delay(1000);

    }

    Serial.print("Mounting USB device... ");

    int err = usb.mount(&msd);

    if (err) {

        Serial.print("Error mounting USB device ");

        Serial.println(err);

        while (1);

    }

    Serial.println("done.");

    char buf[256];

    // Display the root directory

    Serial.print("Opening the root directory... ");

    DIR* d = opendir("/usb/");

    Serial.println(!d ? "Fail :(" : "Done");

    if (!d) {

        snprintf(buf, sizeof(buf), "error: %s (%d)\r\n", strerror(errno), -errno);

        Serial.print(buf);

    }

    Serial.println("done.");

    Serial.println("Root directory:");

    unsigned int count { 0 };

    while (true) {

        struct dirent* e = readdir(d);

        if (!e) {

            break;

        }

        count++;

        snprintf(buf, sizeof(buf), "    %s\r\n", e->d_name);

        Serial.print(buf);

    }

    Serial.print(count);

    Serial.println(" files found!");

    snprintf(buf, sizeof(buf), "Closing the root directory... ");

    Serial.print(buf);

    fflush(stdout);

    err = closedir(d);

    snprintf(buf, sizeof(buf), "%s\r\n", (err < 0 ? "Fail :(" : "OK"));

    Serial.print(buf);

    if (err < 0) {

        snprintf(buf, sizeof(buf), "error: %s (%d)\r\n", strerror(errno), -errno);

        Serial.print(buf);

    }

}

void loop()

{

}

Now connect a FAT-formatted USB pen drive to the USB-A port of the GigaR1.

image

Please note that the name of the USB drive should be “usb”.

You should be able to see the drive contents in your serial monitor output.

Note: For some strange reason, my pendrive was not mounted. I will try later with another pen drive.

image

Camera Access

Reference: https://docs.arduino.cc/tutorials/giga-r1-wifi/giga-camera 

The GIGA R1 has a dedicated camera connector that allows us to mount certain camera modules directly on the board. This will enable the possibility to use machine vision in our GigaR1 projects. 

The GIGA R1 currently supports the following cameras, via the Camera library that is bundled with the Arduino Mbed Core:

  1. OV7670 and OV7675
  2. GC2145
  3. Himax HM01B0
  4. Himax HM0360

We can access the Camera Library here: https://github.com/arduino/ArduinoCore-mbed/tree/master/libraries/Camera 

The 20-pin camera connector onboard the GIGA R1 is designed to be directly compatible with some breakout boards from ArduCam. This allows us to simply connect the camera module directly to the board, without making any additional circuit.

image

Image Courtesy: Arduino

Let's try to access the camera module using GigaR1.

We will need to install the software called Processing in order to read the serial camera buffer data sent from GigaR1.

Step 1: Configure Arduino to send camera data via Serial

Connect the camera module to the 20-pin camera connector.

In the Arduino IDE, go to File -> Examples > Camera > CameraCaptureRawBytes

Make sure the correct camera module is selected inside the code. Eg: OV7675

Compile and upload the sketch

image

Step 2: Configure Processing to read the camera data via Serial

Open the Processing app.

Copy the following code to the processing app:

import processing.serial.*;

import java.nio.ByteBuffer;

import java.nio.ByteOrder;

Serial myPort;

// must match resolution used in the Arduino sketch

final int cameraWidth = 320;

final int cameraHeight = 240;

// Must match the image mode in the Arduino sketch

final boolean useGrayScale = false;

// Must match the baud rate in the Arduino sketch

final int baudRate = 115200;

final int cameraBytesPerPixel = useGrayScale ? 1 : 2;

final int cameraPixelCount = cameraWidth * cameraHeight;

final int bytesPerFrame = cameraPixelCount * cameraBytesPerPixel;

final int timeout =  int((bytesPerFrame / float(baudRate / 10)) * 1000 * 2); // Twice the transfer rate

PImage myImage;

byte[] frameBuffer = new byte[bytesPerFrame];

int lastUpdate = 0;

boolean shouldRedraw = false;

void setup() {

  size(640, 480);  

  // If you have only ONE serial port active you may use this:

  //myPort = new Serial(this, Serial.list()[0], baudRate);          // if you have only ONE serial port active

  // If you know the serial port name

  //myPort = new Serial(this, "COM5", baudRate);                    // Windows

  myPort = new Serial(this, "/dev/ttyACM0", baudRate);            // Linux

  //myPort = new Serial(this, "/dev/cu.usbmodem14301", baudRate);     // Mac

  // wait for a full frame of bytes

  myPort.buffer(bytesPerFrame);  

  myImage = createImage(cameraWidth, cameraHeight, ALPHA);  

  // Let the Arduino sketch know we're ready to receive data

  myPort.write(1);

}

void draw() {

  // Time out after a few seconds and ask for new data

  if(millis() - lastUpdate > timeout) {

    println("Connection timed out.");    

    myPort.clear();

    myPort.write(1);

  }  

  if(shouldRedraw){    

    PImage img = myImage.copy();

    img.resize(640, 480);

    image(img, 0, 0);

    shouldRedraw = false;

  }

}

int[] convertRGB565ToRGB888(short pixelValue){  

  //RGB565

  int r = (pixelValue >> (6+5)) & 0x01F;

  int g = (pixelValue >> 5) & 0x03F;

  int b = (pixelValue) & 0x01F;

  //RGB888 - amplify

  r <<= 3;

  g <<= 2;

  b <<= 3; 

  return new int[]{r,g,b};

}

void serialEvent(Serial myPort) {  

  lastUpdate = millis();  

  // read the received bytes

  myPort.readBytes(frameBuffer);

  // Access raw bytes via byte buffer  

  ByteBuffer bb = ByteBuffer.wrap(frameBuffer);  

  // Ensure proper endianness of the data for > 8 bit values.

  // The 1 byte bb.get() function will always return the bytes in the correct order.

  bb.order(ByteOrder.BIG_ENDIAN);

  int i = 0;

  while (bb.hasRemaining()) {

    if(useGrayScale){

      // read 8-bit pixel data

      byte pixelValue = bb.get();

      // set pixel color

      myImage.pixels[i++] = color(Byte.toUnsignedInt(pixelValue));

    } else {

      // read 16-bit pixel data

      int[] rgbValues = convertRGB565ToRGB888(bb.getShort());

      // set pixel RGB color

      myImage.pixels[i++] = color(rgbValues[0], rgbValues[1], rgbValues[2]);

    }       

  }  

  myImage.updatePixels();  

  // Ensures that the new image data is drawn in the next draw loop

  shouldRedraw = true;  

  // Let the Arduino sketch know we received all pixels

  // and are ready for the next frame

  myPort.write(1);

}

Make sure to select the correct serial port and baud rate in the code.

Press the Play button on the app to run the code.

image

We can see that the processing code will display the output of the serial data sent by the GigaR1 module.

CAUTION: If the serial port says busy in the processing app, make sure that the serial monitor is not open in the Arduino IDE.

Conclusion

The Arduino Giga R1 Wifi was a very fun and interesting board to work with. The readily available out-of-the-box Arduino example sketch will allow anyone to directly jump into using and tinkering with the kit, although the advanced features such as Dual core programming, multi-channel ADC, etc require some experience. MicroPython support also allows a robotics project to be realized with little to no effort. The availability of good documentation is also a plus as it allows in-depth programming and interfacing. The peripheral interfacings are also well set and we have access to a plethora of interfacing pins and options.

The major pros and cons of the kit are summarized below.

Pros

  1. Simple, robust, and easily programmable development board.
  2. MicroPython programming is available.
  3. Very easy module to work with, even for robotics beginners.
  4. Very good first impression and out-of-the-box experience.
  5. Availability of good documentation and community support.
  6. Allows Python (MicroPython) and C++ (Arduino) programming.
  7. A vast array of peripherals is available onboard.

Cons

  1. The absence of onboard off-the-shelf ports such as grove ports could be a bit awkward, but can be solved by using shields.
  2. Some features are advanced and require a deep understanding of the core concepts.

Future Prospects

I wish to do a bit more testing on the advanced capabilities such as Dual core programming, Multi-channel ADC, actuator interfacings, etc.

Anonymous