Skip to content

Commit 95409f7

Browse files
authored
Merge pull request #1139 from arduino/jacobhylen/VRTC-OFF-tutorial
[MKC-1011] [UNO R4 WiFi] VRTC & Off Pin tutorial
2 parents d629529 + c6a59de commit 95409f7

File tree

4 files changed

+85
-0
lines changed

4 files changed

+85
-0
lines changed
71.9 KB
Loading
72.3 KB
Loading
1.72 MB
Loading
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
title: 'Arduino UNO R4 WiFi VRTC & OFF Pins'
3+
description: 'Learn how to use the VRTC and OFF Pins on the UNO R4 WiFi.'
4+
tags:
5+
- VRTC
6+
author: 'Jacob Hylén'
7+
---
8+
9+
The Arduino UNO R4 WiFi features 2 pins that have not been seen before on UNO boards, the VRTC pin and the OFF pin.
10+
11+
They are used to control some of the boards electrical functions. The VRTC pin can be used to keep the onboard RTC (Real Time Clock) running even when the boards main power supply is turned off, and the OFF pin is used to turn off the board by cutting off the power.
12+
13+
14+
## Goals
15+
16+
In this tutorial you will learn how to use the VRTC and the OFF Pins on the Arduino UNO R4 WiFi.
17+
18+
You will learn about how you can use them, why you would use them, and some of the limitations that come with them.
19+
20+
![VRTC and OFF Pin header](./assets/headers.png)
21+
22+
## Hardware & Software Needed
23+
24+
- [Arduino UNO R4 WiFi](https://store.arduino.cc/uno-r4-wifi)
25+
- A small battery or other power supply
26+
- Jumper cables
27+
28+
## VRTC Pin
29+
30+
***This guide will not go in detail on how to use the RTC feature itself, only how to use the VRTC Pin. If you're looking for how to use the RTC features of the board, check out the [RTC Guide](/tutorials/uno-r4-wifi/rtc)***
31+
32+
The UNO R4 WiFi has a built in RTC (Real Time Clock) that can accurately keep track of time. RTCs are found in many of your gadgets, although often connected to them will be a small battery, to keep the clock running even when the gadget is turned off. This is for example how your laptop knows what time it is when you start it up, even if it's disconnected from the internet.
33+
34+
The UNO R4 WiFi provides the option for you to build a system similar to this in function, by exposing the RTCs power lines so that you can keep it running, even when the boards main power supply is disconnected.
35+
36+
On the header that is located by the barrel jack, you'll find the VRTC pin. And to use it, just apply a voltage within the range of 1.6 - 3.3 V to that pin. This can be done either with a battery pack like shown in the circuit diagram below, but also with other power supplies that slot within the required voltage range.
37+
38+
![Battery Pack Powering the UNO R4 WiFi RTC](./assets/Circuit.png)
39+
40+
The following sketch will start the RTC but only set the time if it is not already running.
41+
42+
```arduino
43+
#include "RTC.h"
44+
45+
void setup() {
46+
// put your setup code here, to run once:
47+
Serial.begin(9600);
48+
RTC.begin();
49+
RTCTime mytime(24, Month::MAY, 2023, 11, 8, 0, DayOfWeek::THURSDAY, SaveLight::SAVING_TIME_ACTIVE);
50+
51+
RTC.setTimeIfNotRunning(mytime);
52+
53+
}
54+
55+
void loop() {
56+
// put your main code here, to run repeatedly:
57+
58+
RTCTime currenttime;
59+
RTC.getTime(currenttime);
60+
61+
int hours = currenttime.getHour();
62+
int minutes = currenttime.getMinutes();
63+
64+
65+
Serial.print("Hours: ");
66+
Serial.println(hours);
67+
Serial.println("Minutes: ");
68+
Serial.println(minutes);
69+
70+
}
71+
72+
```
73+
74+
## OFF Pin
75+
The OFF pin on the Arduino UNO R4 WiFi board lets you turn the boards onboard 5 V power supply off, basically turning off the board.
76+
77+
However, it will only turn off the board when it is powered through the VIN pin, or the barrel jack. Why is this? Because by using this pin, you are turning off the step down converter that generates 5 V from whatever voltage you are providing it with. If you are powering the board from USB, 5 V is provided from the USB cable, and there is no need for this step down converter to begin with.
78+
79+
To use the OFF pin, all you need to do is to create a short circuit from it to a GND connection, like in the diagram below. To experiment, you can do this with a jumper cable, but for your finished projects you may want to incorporate a button or switch that will turn the board on or off in this way.
80+
81+
![OFF Pin Shorted to GND](./assets/OFF.png)
82+
83+
## Summary
84+
85+
This short tutorial showed how to use the VRTC and OFF pins that are found on the new header on the Arduino UNO R4 WiFi. These features are brand new to the UNO family.

0 commit comments

Comments
 (0)