Download PDF Parts List View on YouTube

Today we will look at the latest member of the popular Arduino Uno line of microcontrollers, the Arduino Uno R4. With this release, Arduino has produced two boards – the Minima for budget-conscious users and the WiFi with all the bells and whistles. 

Introduction

The Arduino Uno was officially released in October 2010 as a replacement for the Arduino Duemilanove. The Uno offered several improvements over the Duemilanove, and it soon became one of the most popular microcontrollers in the world, especially among makers and hobbyists.

Since its initial release, the Arduino Uno has undergone a number of updates:

  • Arduino Uno (Revision 1) – Released in October 2010. The initial version of the Arduino Uno featured a removable Atmel ATmega328 microcontroller and used the Atmel ATmega8U2 for USB connectivity.  Note that Atmel is now Microchip.
  • Arduino Uno (Revision 2) – This revision added four solder pads connecting two of the ATmega8U2’s pins. This allowed the ATmega8U2 to be replaced with a standalone circuit once the development phase was complete.
  • Arduino Uno (Revision 3) – Released in November 2011. This was a major revision that changed the USB chip to an ATmega16U2 and added more pin headers for compatibility with future hardware. This revision is still available and has been “cloned” by many manufacturers. When people speak about “an Arduino,” this is the board they are talking about.
  • Arduino Uno WiFi (Revision 2) – Released in 2018, this variant of the Uno added built-in WiFi connectivity through an ESP32 module. In addition to WiFi, it also offered enhanced features like a 6-axis IMU, temperature sensor, and crypto chip for secure communication.  It was never very popular, but it is still available.

There were also several “special edition” Arduino Unos produced, such as the Arduino Uno SMD Edition (which replaced the removable DIP ATmega328 chip with a surface-mount version) and the Arduino Genuino Uno (“Genuino” was the name under which the Uno was sold outside the USA for some time due to legal complications).

Now, in mid-2023, we finally have a new revision of the Arduino Uno. Actually, we have two.

Let’s see if it was worth the wait!

The Arduino Uno R4 Boards

Instead of just a single board, the new Arduino Uno R4 has been released as two.

  • The Uno R4 WiFi – A board with all the “bells and whistles”.
  • The Uno R4 Minima – A less expensive, “stripped-down” version.

As of this writing, July 2023, the Minima retails for USD 20.00, while the WiFi version will set you back USD 27.50.

Each board is packaged with a clear plastic carrier, which is handy for experimenting.

Board Characteristics

The first thing you will notice about the new Uno R4 is that it has an almost identical form factor to the Version 3 Uno, including the female Dupont connectors and mounting holes. The USB connector has changed, which is unsurprising, as the Uno 3’s USB-A connector was outdated when it was released 12 years ago. The new boards use USB-C connectors.

The barrel jack is still there, and this time it accepts a wider range of input voltages.

The Minima board has a pretty sparse design, with lots of empty real estate on the PCB.  In contrast, the WiFi board is very populated, with much of its board space occupied by a 12 x 8 matrix of LEDs.

The connectors are all clearly labeled, and there are a few extra connectors as well.  The WiFi board has connectors for accessing its internal ESP32 processor and a QWIIC connector for I2C.  The Minima has a diagnostic connector, and both boards have the familiar ICSP connector for SPI.

As expected from an Arduino product, the build quality of both boards is excellent.

5-Volt Operation

To maintain compatibility with the older Arduino Uno boards, the new R4 boards use 5-volt logic.  This is not very common in 2023, as almost every new microcontroller board is a 3.3-volt device, but it does have the advantage of allowing the R4 boards to accept existing Uno shields.

The QWIIC connector on the WiFi board is a 3.3-volt I2C bus and is not 5-volt tolerant.  The ESP32 Header, which allows direct connection to the onboard ESP32, is also a 3.3-volt logic connection.

Powering up the boards

The new Uno R4 boards operate internally at 5 volts but can be powered in several different ways:

  • USB-C Connector – The board uses 5 volts from the USB-C input.
  • Barrel Connector – The same 2.1mm barrel connector used on the R3 boards (center is positive) can be used with voltages from 6 volts to 24 volts.
  • VIN pin – You can also apply 6–24 volts to the VIN pin; essentially, this is the same as using the barrel connector.

Renesas RA4M1 Microcontroller

The new Arduino Uno R4 boards employ the Renesas RA4M1 microcontroller.

This is a 48 MHz Arm-Cortex MPU with 32 kB of SRAM, 256 kB of Flash memory, and 8 KB of EEPROM.

The MPU features a number of timers, including a Watchdog Timer and a Real Time Clock.

It has many analog interface options, including 25 14-Bit Analog to Digital Converters, one 12-Bit Digital to Analog Converter, four Operational Amplifiers, two Comparators, and an internal temperature sensor.

It also has an abundance of communications options, including two I2C (Integrated Integrated Circuit), two SPI (Serial Peripheral Interface), four SCI (Serial Communications Interfaces, also called UART), and one SSI (Serial Synchronous Interface, also called USART)port.

Note that the Arduino Uno R4 boards do not expose all the capabilities of the RA4M1.

This microcontroller can be booted up in two different modes:

  • Single-Chip Mode – This is the default mode. In this mode, the microcontroller boots up normally and connects to the USB port for use with an IDE.
  • SCI/USB Mode – In this mode, the microcontroller boots up as a USB peripheral. This allows for HID (Human Interface Device) emulation and sharing storage with an external computer.

Uno R3 – R4 Feature Comparison

Here is a quick look at the key features that differ between the Arduino Uno R3 and R4 boards.

As the chart shows, the R4 models are superior to the R3 in virtually every way, with one notable exception.

Warning – 8 mA Current Limitation!

The one difference between the new R4 boards and the older Uno’s that you must be aware of is the pin current limitation.

On the new Arduino Uno R4 boards, the maximum source/sink current is 8 milliamperes. On the older R3 boards, it was 20 mA. 

In other words, the new Arduino Uno R4 boards can only handle about 40% of the current on its I/O pins than the older Arduino Uno R3 could!

For driving other digital logic devices and displays like OLED’s this limitation is irrelevant; 8ma is plenty of current for logic circuitry. But it’s a different story when powering an LED.

Powering LEDs with the New Uno’s

In many circuit diagrams, including ones here in the DroneBot Workshop, you’ll see LEDs connected to microcontroller I/O pins using a dropping resistor with a value of 150 to 330 ohms. Most of the circuits I’ve designed use 220 ohms, and that’s a pretty popular value as it handles the voltage drop and current of virtually every discreet LED.

With a 220 ohm dropping resistor, a standard red LED will pull about 12 mA from a 5-volt digital I/O pin.  And that exceeds the 8 mA limitation of the new Arduino Uno R4 boards.

I hooked up an LED with a dropping resistor to pin D13 on an Arduino Minima so that I could run the fascinating Blink sketch. I used a 1k resistor and had no problem seeing an LED. Tried it with different colors of 5mm LEDs, and they all worked.  In this configuration, the LED pulled about 3 mA, well within the accepted range of the Arduino R4 digital I/O pins.

As a rule of thumb, try not to use a dropping resistor of less than 470 ohms. This will draw about 6 mA from the I/O pin, assuming your LED has a dropping voltage of about 2 volts.  For LEDs with higher voltage drops, you can reduce the value to as low as 330 ohms.

Just stay away from the 220 ohm dropping resistors, and you’ll be fine!

If you’d like to compute the actual resistor value for your LED, you’ll need to know the LED’s voltage drop. Armed with that information, you can use the LED Dropping Resistor Calculator at DigiKey to calculate the value of your resistor.

Arduino Uno R4 Pinouts, Connectors, and Features

Here is an in-depth look at the pinouts, connectors, and features of the Arduino Uno R4 boards. Most of the pins and connectors are common to the Minima and WiFi boards; however, in some cases, the pinouts are exclusive to one board. This is noted in the diagrams and descriptions.

If you want a big diagram of the Uno R4 Minima, Arduino has one here.

For a large drawing of the Uno R4 Wifi, you can click here.

Power In & Out

In addition to having power connections, the Uno R4 boards also output voltages at low currents.  These mimic the same outputs in the Uno R3.

The connections on the side are as follows:

  • VIN – This is the input voltage used for powering the board. It can be any DC voltage in the range of 6 to 24 volts.
  • GND – Two ground connections.
  • 5V – This is a 5-volt output used to power external peripherals.
  • 3V3 – A 3.3-volt output, also used for external low-current devices.

There are also power connections on the top of the board:

  • 2.1mm Jack – This barrel jack can accept voltages from 6 to 24 volts; it is internally connected to the VIN pin.
  • USB-C – The USB-C connector can be used for both communications and power. It supplies 5 volts.

Power & RTC (WiFi Only)

Although the Real Time Clock RTC) is included on both boards, only the WiFi board has connections for a battery backup.

  • VRTC – This is a connection for a small (I have used 3 volts) battery to back up the real-time clock.
  • GND – A Ground Connection
  • OFF – This connection allows you to control the power on the board; when held LOW, the board will turn off. This allows you to implement a power switch on your project.

Boot & Reset

There are a few pins that are related to the boot process:

  • BOOT – This pin was originally used to change the Boot Mode of the processor; however, in the Arduino Uno R4 boards, this is not connected. It is also unlabeled and is only there for compatibility with older shields.
  • IOREF – This pin is an output and is connected to 5 volts. Its purpose is to provide a voltage reference for the board’s logic level.
  • RESET – This pin resets the microcontroller when held LOW.

There is also a Reset button on the top corner of the board.

Bottom Connectors & LED

There are a couple of connectors and an LED at the bottom of the board. 

Power LED

The power LED is at the bottom of the WiFi board and is located a bit further inward on the Minima. It illuminates when the correct power supply voltage is applied to the board.

ICSP Connector

The ICSP, or “In-Circuit Serial Programming” connection, was a feature on the Arduino Uno R3 boards, as well as the original 8-bit Nano boards.  It provides an SPI bus connection.

QWIIC (WiFi Only)

The QUIIC connector allows for simplified connection of peripherals with compatible connections. This is an I2C connection, so several devices can be connected as long as they each have unique I2C addresses.

Two things to note about using the QUIIC connector:

  • This is a 3.3-volt I2C bus. Do not connect it to 5-volt peripherals!
  • This connection uses the second I2C port, so existing sketches must be modified if you wish to use QUIIC devices.

SWD / JTAG (Minima Only)

This 10-pin connector is for the connection of external diagnostic and debug equipment. It is only found on the Minima.

Analog In

As with the original Uno, these boards have six ADC inputs.

By default, the Analog to Digital converter will work at 10 bits; however, you can change the resolution to 12 or 14 bits using the analogReadResoloution command.

  • A0 – A5  – Analog Inputs, maximum 5-volts or AREF voltage.

Analog Out

Unlike the older R3 boards, the new Arduino Uno R4 boards have a Digital to Analog Converter, or DAC.  This is a single-channel DAC and provides an output voltage ranging from 0 to 5 volts.

  • A0 – DAC Output – Output of 12-bit DAC.

I2C Bus

The new Arduino Uno R4 boards have two I2C interfaces.

Interface 0 is connected the same way that it was on the earlier Uno boards, to two of the Analog pins and to a separate set of pins at the top of the Digital I/O connector.

Interface 1 is connected to the QUIIC connector – remember, this is a 3.3-volt connection. It can also be programmatically connected to the existing I2C connections, this time at a 5-volt logic level.

OP-Amp

The Renesas RA4M1 MCU has four internal operational amplifiers, one of which is brought out to the pins on the Uno R4 boards.

The op-amp can be programmatically controlled and is for use with the Analog to Digital Converters. This can increase the input sensitivity of the ADCs, which is especially useful for audio designs.

  • A1 – Positive Input – Op-amp positive input.
  • A2 – Negative Input – Op-amp negative input.
  • A3 – Output – Op-amp output.

Digital I/O

The new Arduino Uno R4 boards have the same Digital I/O ports used on the R3 version. As with the R3, six of the pins are PWM (Pulse Width Modulation) capable.

Actually, most of the pins are really PWM capable; however, the timing registers used on the pins not stated as “PWM-capable” are used for other purposes. It is advisable only to use the designated pins for PWM.

  • D0 – D13 – Digital GPIO pins. 

UART

The UART, or hardware serial port, is one area where the R4 boards differ from their R3 cousins.

In the R3, there was one UART, and it was connected to both the USB connector and to pins D0 and D1.  The R4 uses two hardware serial ports, one connected to USB and the other to D0 and D1.

The consequence is that any code that expects to exchange serial data over D0 and D1 needs to use the Serial1 object instead of the Serial object.

  • D0 (TX) – The TXD1 Output
  • D1 (RX) – The RXD1 Input

SPI Bus

Four digital I/O pins are also used for the SPI bus connections. This is the same configuration used with the Uno R3.

  • D10 – SSLA0 – Chip Select
  • D11 – COPIA – Controller Out, Peripheral In
  • D12 – CIPOA – Controller In, Peripheral Out
  • D13 – RSPCKA – Clock signal

CAN Bus

A Controller Area Network (CAN Bus) is a vehicle bus standard designed to allow microcontrollers and devices to communicate with each other. The Arduino Uno R4 boards have a single CAN Bus connection.

Note that this connection cannot be physically connected directly to a CAN Bus. Instead, you will require a transceiver to change the logic level signals to CAN Bus-compatible ones. The Arduino hardware and libraries take care of bus protocol and data formatting.

One rather odd issue is that the CAN Bus connections on the Minima and WiFi boards are different!

Minima

  • D4 – CAN TX – CAN BUS Transmit
  • D5 – CAN RX – CAN BUS Receive

WiFi

  • D10 – CAN TX – CAN BUS Transmit
  • D13 – CAN RX – CAN BUS Receive

Analog Reference Voltage

As with the earlier Uno boards, as well as many other Arduino boards, there is a connection for an analog reference voltage.

By default, the ADC uses the power supply voltage of 5 volts as its reference. However, you can apply a precision voltage that does not exceed 5 volts to this pin to change the analog reference point.

This can be useful to expand the range of the ADC when using low voltages, or to increase the precision of the ADC results.

  • AREF – Analog Reference Voltage

Status LEDs

There are three status LEDs on the top right of the board; these are identical in function to the ones on the older Arduino Uno R3 boards.

  • L – Status indicator for data pin D13. Referred to as LEDBUILTIN in code.
  • TX – Transmit status for USB port.
  • RX – Receive status for USB port.

ESP32 Header (WiFi Only)

The ESP Header allows direct access to a few of the GPIO pins on the onboard ESP32-S3 MCU. You can use this connection, or some of the pads on the underside of the board, to program the ESP32 independently of the Renesas RA4M1.

LED Matrix (WiFi Only)

Other than its wireless capabilities, the feature that distinguishes the Arduino Uno WiFi board from all others is the large 12 x 8 LED display matrix that occupies about a quarter of the printed circuit board real estate.

Using the Arduino Uno R4 Minima

We will begin by examining the Arduino Uno R4 Minima. Keep in mind that, aside from the SWD connector, every feature on the Minima is also included on the WiFi board. You can use these instructions with the WiFi board if you don’t have a Minima; note the difference in CAN Bus connections between the boards.

Getting started with the Minima

The first thing you’ll need to do with any of these boards is to install the boards manager. Both of the boards use the same one, and it is easily installed within the Arduino IDE.

I’ll illustrate everything with Version 2 of the Arduino IDE, but you can also use the board with the classic version 1.8 if you prefer.

IDE Setup

I’ll assume that you already have the Arduino IDE installed and working on your computer.  You can use Windows, macOS, or Linux; everything is operating system independent.

Open the IDE and then open the Boards Manager by clicking the second icon from the top on the left sidebar of the IDE (the one that looks like a microcontroller board). 

In the search box, type “uno”. This should return a list of board managers, including one by Arduino for the Arduino Uno R4 boards. Just click the Install button to add it to your IDE.

You can test the installation by attaching your board and configuring the IDE for the correct port. Select the Uno Minima or WiFi board, depending upon which one you have.

Now open the File menu and go to Examples. Scroll down to the “Examples for Arduino R4 Minima” (or WiFi ) and take a look at the wealth of sample sketches you can run and learn from!

DAC – Sine Wave Generation

One of the new features in both Arduino Uno R4 boards is the inclusion of a single 12-bit DAC. This can generate discrete output voltages from 0 to 5 volts. It can also be used to generate waveforms, as our example here will illustrate.

This sketch will generate a sine wave or, rather, a “simulated” sine wave.  You can control the frequency of the sine wave with a potentiometer.

Sine Wave Hookup

We will use an oscilloscope to view our sine wave, so the hookup is pretty simple. All we really need is a potentiometer, any linear-taper (if it doesn’t specify a taper, it is probably linear) pot with a resistance of 5k or higher will work. I used a 10k potentiometer.

If you don’t have access to a scope, you could send the output to an audio amplifier so that you could listen to the tones generated.  If you choose to go this route, make sure your amplifier has a volume control and that it is down all the way when you first test everything!

Sine Wave Code

This first example, as with all of the example code today, was installed when you installed the board manager for the Arduino Uno R4 boards.

You can find this example, which is called “SineWave,” in the following location:

  • File/Examples/Examples for Arduino R4…/AnalogWave/SineWave

You may want to save the sketch under a different name, as it has an error in it that you will need to fix! More on that in a moment.

Here is the Corrected Version of the SineWave code:

The code is pretty simple, as it makes use of the “analogWave” library. You already have this library; it was installed with the board manager installation.

After including the library, we create an object called “wave” and attach it to the DAC pin. The DAC pin is referenced by its built-in constant of “DAC.”

We also define an integer to hold the frequency.

Now we move to the Setup, where we need to correct our first error (there are actually two errors, the same one twice).

In Setup, we initialize the serial monitor. The next line is where the issue is.

The code has a pinMode command, setting up pin A0 as an input. This is wrong, as A0 is the DAC output!  

A5 is the input from the potentiometer, and it really doesn’t require a pinMode command as it’s an analog input.  So you can either change “A0” to “A5” or just erase the whole line!

The next command defines the type of waveform we want to generate, as well as its frequency. As written, it will generate a sine wave, but you can change this if you wish. You have three choices:

  • sine – Sine wave.
  • square – Square wave.
  • saw – Sawtooth wave.

Now on to the Loop!

The first thing we do is read the potentiometer and determine the frequency; it’s all done in one line with a map and analogRead command. And, of course, this is where the other error is!

Once again, A0 needs to be changed to A5.  Had they defined a constant for this at the beginning of the sketch, you would have only needed to fix this in one place!

After getting the pot value and converting it to a frequency value, we print the frequency to the serial monitor. Then, we call our wave object and generate a waveform as specified. 

We finish with a one-second delay, then repeat the Loop.

Sine Wave Demo

Running the demo is as simple as loading the sketch to the Arduino Uno R4 Minima (or WiFi) board and observing the scope. You may have to adjust your scope settings.

If you also observe the Serial Monitor, you’ll see the frequency displayed, updated every second.

Turn the potentiometer and observe the waveform.  You’ll see how the frequency changes, with a maximum frequency of 10 kHz.

When you look at the waveform, you’ll see that it is actually a stepped approximation of a sine wave. Great for generating tones for a game or system alarm!

Experiment with the code by changing the type of generated wave, and observe the results on the scope.

Using the CAN Bus

Another feature of the new Arduino Uno R4 boards is the inclusion of a CAN Bus interface.

CAN Bus

The Controller Area Network Bus, or CAN Bus, was originally created for the automotive industry to allow sensors and devices to easily “talk” to one another using a simple protocol.  As it was created for automotive applications, it is electrically and physically robust, requiring low-cost components.

The CAN Bus is not limited to automotive applications; it can be used whenever you need to have microcontrollers exchange small amounts of information.  It can be used over longer distances than I2C or SPI, and is also virtually immune to electrical noise when wired correctly with twisted pair wires and terminators.

Physically, the bus consists of two wires labeled CAN_HIGH and CAN_LOW.  Each end of the bus has a termination resistor, usually 120 ohms.  CAN Bus cables are twisted pairs, and the connectors often are DB(s.

The node of the CAN Bus are often called ECUs for Electronic Control Units. Each ECU can transmit to the bus, and every ECU receives all the traffic.

Each CAN Bus packet has an ID. When an ECU receives a data packet, it uses the ID to filter it. If the packet is filtered, it is ignored; only packets that make it through the filter are acted upon.

The bus itself is a differential design; this eliminates induced electrical noise as the amplitude of the noise on each line is equal and is thus canceled out.

You can use the CAN Bus feature of the Arduino Uno R4 to join an existing CAN Bus (i.e. the one in your own vehicle) or to create a new network, which doesn’t have to be for automotive use.

CAN Bus Data Structure

CAN Bus data is packaged into a frame and can be broken down as illustrated in the following diagram:

The elements of the frame are as follows:

  • Start of Frame (SOF) – This is one bit set to “0” at the beginning of a frame.
  • Frame Identifier (ID) – This is an identification bit used to determine who the frame is intended for. In the CAN 2.0A spec, this is 11 bits; in CAN 2.0B it is 29 bits).
  • Remote Transmission Request (RTR) – This is a single bit used to determine if this is a request to another ECU for data.
  • Control (CTRL) – This is a six-bit sequence that has two components, the Identifier Extension Bit (IDE) and Data Length Code (DLC).
  • Data – This is the actual data we send, with a length of zero to 64 bits. Zero is a perfectly valid amount as if the frame is a request for data, it isn’t likely that you will need to send data as well.
  • Cyclic Redundancy Check (CRC) – This s a checksum to ensure the validity of the data. It is 16-bits long.
  • Acknowledgment (ACK) – An acknowledgment that the node has received the data successfully. 
  • End of Frame (EOF) – 7 bits signifying the end of the frame.

The Arduino_CAN Library handles the logic for the CAN Bus

Minima and WiFi CAN Bus Connections

Oddly enough, although the Minima and WiFi boards have the same CAN Bus capabilities, they use different I/O pins for their receive (CAN RX) and transmit (CAN TX) connections.

On the Minima, the CAN Bus connection is as follows

  • CAN RX – Pin D5
  • CAN TX – Pin D4

And on the Arduino Uno R4 WiFi board, they are on different pins:

  • CAN TX – Pin TX
  • CAN RX – PIN 13

Naturally, you’ll want to remember this when hooking up a CAN Bus Transceiver!

CAN Bus Transceiver

There are many CAN Bus Transceivers that you can use with the Arduino Uno R4 boards.  One that I have had success with is the Waveshare SN65HVD230 module, which is an inexpensive CAN Bus transceiver.

 

One issue with this transceiver is that it operates on 3.3 volts, and although it can withstand being powered by a 5-volt power supply, the recommended supply voltage is between 3.0 and 3.6 volts.  

So while you can operate this on 5 volts and save an additional component, I have decided to run mine on the recommended 3.3-volts and use a logic-level converter to handle the 3.3-volt to 5-volt logic-level differences. 

This diagram shows the pinouts of both the WaveShare CAN Bus transceiver and a typical logic-level converter. Although a 4-channel converter is shown, you only require two channels, and you can use a different converter.

CAN Bus Hookup

Here is the hookup for the CAN Bus transceiver and the logic-level converter. As the pinouts for the CAN Bus are different between the Minima and WiFi boards, I have provided two hookup diagrams.

You will need to build two of these circuits for our experiment. You can use two of the same boards or “mix and match” them!

CAN Bus Code

Once again, we will use code provided by Arduino for our experiment.  Since we have two boards, we will need two sketches, one for the transmit side and the other for the receive.

CANWrite

The first sketch we will need is the one that transmits data, the CANWrite sketch. This can be found in the Example sketches under Arduino_CAN, which is the name of the library used in the sketch.

The sketch is pretty simple, as the Arduino_CAN library does most of the work.  

After including the library, we define an ID that will be used in the transmission.

In Setup we start the Serial Monitor and the CAN Bus. The bus is run at 250 kBps.

And in the Loop we compose a message and send it on the CAN Bus. After that, we increment the counter, add a one-second delay and then do it again.

CANRead

The second sketch is the one for the receive side.  The CANRead sketch, also included with the code samples, is a simple sketch that will do this nicely.

The beginning of the sketch is almost identical to the CANWrite sketch; the only difference is that we don’t need to define an ID.

In the Loop, we simply read the incoming CAN Bus traffic for a message. If one is received, it is displayed on the Serial Monitor.

CAN Bus Demo

To run the demonstration, you’ll need to have two Arduino Uno R4 boards (Minima or WiFi) connected to CAN Bus transceivers, which in turn are connected together.

Load CANWrite onto one of the boards and CANRead onto another. You can open two instances of the Arduino IDE on one computer and use the two serial monitors to observe the results.

The CAN Bus itself can simply be two pieces of wire. If they are not too long, you won’t require the 120-ohm terminator resistors.

If all is working, you should observe the CAN Bus data on the receive side, changing every second. Resetting the transmit side will restart the counter.

The transmit side Serial Monitor usually does not display anything unless the packets are not being received. Pull the USB cord out of the receive one temporarily to observe this message.

Although this is just a basic demonstration, it illustrates how simple it is to use the CAN Bus with the new Arduino Uno R4 boards.

Using the Arduino Uno R4 WiFi

The Arduino Uno R4 WiFi boards bring the power of an ESP32 to the Arduino Uno.  

The ESP32 S3 used in the Arduino Uno R4 WiFi can also be used independently, programmed using the ESP Header connector described earlier.  

The ESP32 is also used when programming or communicating with the board. In normal operation, USB traffic is routed to the ESP32, which routes it to the Renesas RA4M1 via a “bridge”.

If you decide to program the ESP32 independently, you will wipe its bootloader and will therefore need to connect directly to the Renesas RA4M1. This can be done in two ways.

The first method is to pull GPIO pin D40 on the RA4M1 HIGH.  This essentially “flips the switch” and will cause traffic to be directly routed from the USB port to the RA4M1.

The second method is to solder a jumper between the two “RA4M1-UYSB” jumper pads underneath the board.  This also “flips the switch”.

WiFi Access Point

Of course, the reason many people will pick up the board is for its WiFi capabilities, and the new WiFiS3 library makes this very easy to use.

There are several sample sketches included that will get you started with the WiFi.  One that I ran in the video was to set up a WiFi Access Point.

WiFi Access Point Code

You’ll find this sketch in the Examples section under the WiFiS3 section, the AP_SimpleWebServer example. As with many of the example sketches, this code is an adaptation of an earlier sketch, in this case, one written by Tom Igoe in 2012.

The purpose of this sketch is to create a WiFi Access point, which can then display a webpage. The webpage has two links, one to turn the built-in LED on and another to turn it off.

As with all the example sketches, this one includes an “arduino_secrets.h” file. The purpose of this file, with most of the sketches, is to hold your WiFi credentials (SSID and password), but on this sketch, it serves a different purpose. With this sketch, the “arduino_secrets.h” file holds the SSID and password for the Access Point you’re setting up. You can leave it as it is or change it. 

The code is a bit long, but essentially it establishes an access point and then looks for a client connection. When it sees one, it monitors the URL returned when a client clicks one of the links. It then uses the URL address to determine which link has been activated and sets the LED accordingly.

 

No hookup is required to test this sketch out, although you can tie an LED with a dropping resistor (remember, 470 ohms or higher) onto pin D13 to observe the results.

WiFi Access Point Demo

Load the sketch and then go to a phone, tablet, or computer with WiFi capabilities. Open the WiFi settings and look for your access point network; if you didn’t edit “arduino_secrets.h,” then the SSID will be “testAP” and the password will be “123456789”.

After you connect to the access point, open a web browser at the IP address specified in the sketch. If you didn’t edit line 56, then it should be 192.48.56.2.

You should see a web page with very large text and two links. Clicking the links should control the built-in LED on the Arduino Uno R4 WiFi board.

Try out a few of the other sample sketches in the WiFiS3 section to get a feel for how to program WiFi applications on your new Arduino Uno R4 WiFi board.

LED Matrix

Probably the most distinguishing feature of the new Arduino Uno R4 WiFi board is the 12×8 LED matrix that occupies about a third of the board’s real estate.  It’s an interesting and unexpected addition, in fact, when Arduino was initially easing about the release of the new board, they covered the LED matrix up, so we couldn’t see it!

LED Matrix Wiring

The LED Matrix consists of 96 LEDs controlled by only 11 GPIO pins. To accomplish this, a technique called “Charlieplexing” was used in the design.

The Charlieplexing technique was developed by Charles “Charlie” M. Allen, an applications engineer at Maxim Electronics. It takes advantage of there being three states in a microcontroller’s digital output lines:

  • HIGH
  • LOW
  • HIGH-Z (High Impedance)

That third state is achieved by turning the I/O pin into an input.

Given these three states, you can control multiple LEDs by arranging them in groups of two, wired in reverse polarity.  In fact, with 11 I/O pins, you can actually control 110 LEDs!

You can address the LEDs individually; they are numbered as illustrated in the following diagram:

LED Matrix Sample Code

In the example sketches, you’ll find several different code samples that you can use to try out the LED matrix.

  • Display Single Frame – Loads individual frames. You can exchange the included data with your own data
  • Game of Life – A cellular automaton devised by the British mathematician John Horton Conway in 1970.
  • Matrix Frame Buffer – Illustrates how to compose a frame and then alter its contents
  • Play Animation – Illustrates how to do animation with multiple frames.

You’ll also find the PlayAnimation sketch as well, this is the sketch initially loaded onto the Arduino Uno R4 WiFi boards when they are shipped from the factory.

LED Matrix Editor

Arduino has provided a tool that allows you to create patterns on the LED matrix, patterns that you can then download to use in your own code.

All you need to do to use this tool is to load a sketch onto your Arduino Uno R4 WiFi board. You keep the board connected to the computer, make sure no other instances of the Serial Monitor are running, and go to the Arduino LED Matrix Editing tool and connect to your computer.

The matrix editor will then use your USB port to communicate to the Arduino board, setting it’s LED matrix.

LivePreview Sketch

The first step is to install the LivePreview sketch onto your Arduino Uno R4 WiFi board.  You’ll find this sketch among the other LED Matrix example sketches.

The sketch uses the new ArduinoLEDMatrix library and is very simple. It sets up the serial port and a matrix object that represents a frame of the display. It then goes into the Loop, where it monitors the serial monitor port and captures its data to fill the frame object. The object is then written to the display.

LED Matrix Editor Website

After you have loaded the sketch onto the Arduino Uno R4 WiFi board, head over to the Arduino LED Matrix Editor. I recommend using Google Chrome for this, as some other browsers don’t work properly with the editor.

When you arrive at the page, you will be prompted to allow the site to interact with your computer. Allow this, as it is essential for the product to work.

Now click the icon on the top of the page. A dialog box will open, explaining that you are about to connect to your computer.  Follow the steps, and you will come to a page listing the serial devices on your system. Select the one with the Arduino Uno R4 WiFi board and allow connections to it.

And now the fun begins!  Try clicking on the boxes in the editor, while observing the LED matrix on the Arduino board. You should see the pattern you draw on the screen replicated on the display.

The download button allows you to download a ZIP file with the frame code for the display you have drawn. You can then use this code with the Display Single Frame sketch.

You can also save and download multiple frames to try with the Play Animation example sketch.

I think it’s great that Arduino has provided this tool, as it will make designing cool LED matrix displays a lot easier!

Uno R4 vs. Uno R3

To finish things off, I wanted to compare the performance of the new Arduino Uno boards against their predecessors.

I also decided to throw in a few other popular microcontrollers to get a “ballpark” figure to see where the new Arduino’s stand in terms of performance.

Of course, benchmark tests don’t precisely simulate “real-life” situations and should be treated as just one element in evaluating a microcontroller.

Benchmarking Setup

Finding a benchmark program that would run on all the microcontrollers I selected proved to be a bit of a challenge. I finally settled on the Dhrystone Benchmark Sketch, an older program that has been recompiled to use with microcontrollers.

However, the sketch wasn’t perfect, as it doesn’t run long enough to test some more modern microcontrollers. It can be fixed, though, by increasing the number of iterations that it runs through. By default, it goes through 300,000 iterations, but for the most powerful microcontroller I tested (the Arduino Giga R1), I had to bump that up to 5 million iterations!

Test Results

Here are the RAW results for the benchmarks:

Arduino Uno R3:

300000 runs through Dhrystone

Microseconds for one run through Dhrystone: 57.78

Dhrystones per Second: 17306.53

VAX MIPS rating = 9.85

 

Arduino Uno R4

300000 runs through Dhrystone

Microseconds for one run through Dhrystone: 16.04

Dhrystones per Second: 62333.22

VAX MIPS rating = 35.48

 

ESP32-S2

900000 runs through Dhrystone

Microseconds for one run through Dhrystone: 3.83

Dhrystones per Second: 260998.10

VAX MIPS rating = 148.55

 

ESP32-PICO

900000 runs through Dhrystone

Microseconds for one run through Dhrystone: 3.18

Dhrystones per Second: 314080.44

VAX MIPS rating = 178.76

 

Arduino Giga R1

5000000 runs through Dhrystone

Microseconds for one run through Dhrystone: 0.64

Dhrystones per Second: 1567465.44

VAX MIPS rating = 892.13

 

And here is a chart summarizing those results.

The tests show that the new Arduino Uno R4 board is about four times as powerful as the original R3 board.  The ESP32 boards were almost four times as powerful as the new Uno R4 boards, which was not surprising considering their clock speed.  And the Arduino Giga R1 is a monster, nearly 100 times more powerful than the original Uno R3.

Again, I wouldn’t get too hung up on benchmark results, but it does show that you should expect a substantial performance improvement when upgrading an older Uno R3 design with a new Arduino Uno R4.

Conclusion

The new Arduino Uno R4 boards are an improvement over the older Arduino Uno R3 boards. They are faster, have more memory, and sport many intriguing features. The USB-C port is a welcome update from the older type-A port. Including CAN Bus connectivity and a DAC will inspire many exciting applications and projects.

You need to keep the 8mA pin current limitation in mind when porting older designs to this board, but it shouldn’t be much of an issue, except for driving LEDs directly.

The price of both boards is reasonable, although WiFi-enabled microcontrollers like the Pico W and ESP32 are available for less. However, those boards are smaller, circuit board-mounted designs, whereas the Uno is a stand-alone board made for experimenters. 

For experimenters, students, and those working with CAN Bus, these boards are a bargain and are certainly an exciting addition to the Arduino family.

 

Parts List

Here are some components that you might need to complete the experiments in this article. Please note that some of these links may be affiliate links, and the DroneBot Workshop may receive a commission on your purchases. This does not increase the cost to you and is a method of supporting this ad-free website.

Arduino Uno R4 Minina – Arduino Store

Arduino Uno R4 WiFi – Arduino Store

Waveshare SN65HVD230 – Amazon

 

 

Resources

Arduino Uno R4 Wifi – Arduino main page for WiFi board.

Arduino Uno R4 WiFi Cheat Sheet – An Arduino page linking to multiple WiFi board resources.

Arduino Uno R4 WiFi Datasheet – Official datasheet from Arduino (PDF Document).

 

Arduino Uno R4 Minima – Arduino main page for Minima board.

Arduino Uno R4 Minima Cheat Sheet – An Arduino page linking to multiple Minima board resources. 

Arduino Uno R4 Minima Datasheet – Official datasheet from Arduino (PDF Document).

 

Arduino DAC Guide – Guide to the 12-bit DAC on the Minima and WiFi boards.

Arduino LED Matrix Guide – Guide to the 12 x 8 LED Matrix on the Arduino Uno R4 WiFi board.

Arduino CAN Bus Guide – Guide to the CAN Bus on the Arduino Uno R4 Minima – also applies to WiFi with pin changes.

Arduino USB HID Guide – Guide to using the USB connector in Human Interface Device mode.

Arduino WiFi Network Examples – Code examples for the Arduino Uno R4 WiFi board.

 

Arduino Uno R4 WiFi Firmware Update – (Instructions for updating the firmware in the Arduino Uno R4 WiFi. Thai update resolves issues with Bluetooth and joining the Arduino IoT Cloud.

Dhrystone Benchmark Sketch – The sketch which I used to obtain the benchmark figures.

DigiKey LED Calculator – An online utility to determine the resistance of an LED dropping resistor. Great for keeping the current draw under 8 mA.

WaveShare SN65HVD230 Wiki – More info regarding the CAN Bus transceiver.

 

Arduino Uno R4 – Minima & WiFi
Summary
Arduino Uno R4 - Minima & WiFi
Article Name
Arduino Uno R4 - Minima & WiFi
Description
Arduino has updated the Uno with two boards, the Uno R4 Minima and Uno R4 WiFi. In this article, we'll look at the specifications of the two boards and experiment with some of their exclusive new features.
Author
Publisher Name
DroneBot Workshop
Publisher Logo
Tagged on:
Subscribe
Notify of

2 Comments
Oldest
Newest
Inline Feedbacks
View all comments
EzAng
5 months ago

Thanks for the info

Jon
1 month ago

On the CAN demo, why did you use a 5v to 3v converter, just to run power from the 3.3v pin and splice it in with the converter output? Please excuse my ignorance, I’m new to Arduino.