52pi Arduino UNO R4 Minima smart farming kit with Projects
Hello and welcome back. This article introduces an Arduino UNO R4 Minima starter kit for smart farming. I’ve created four simple projects using this kit. That is LED chaser, push-button control, DHT11 sensor with RGB display, and IR remote with relay module control. You can make a lot of projects with this kit. Also, In the future, I plan to develop a smart farm project using this kit.
The kit includes a variety of sensors, components, and advanced modules, making it easy to build a smart and efficient farm system. It also comes with demo codes, tutorials, and documentation, making it user-friendly for anyone. For more information about the Arduino UNO R4 MINIMA board and a step-by-step guide on how to use it, please visit this link.
Ok, let’s make projects step by step. You can buy this kit using the links below.
- 52pi official website — Click on me
- Amazon — Click on me / Click on me / Click on me / Click on me / Click on me / Click on me
Step 1
Firstly, unbox this kit, and let’s identify the components in the box.
Step 2
Secondly, install the Arduino UNO R4 MINIMA board on the experiment holder platform. For that use the screws. Then put the breadboard on the other side. You can also stick it permanently by removing the sticker.
Now let’s make projects one by one with this kit. I have done four projects.
LED Chaser
Step1
Firstly, identify these components.
Step 2
Secondly, install LEDs and Resistors on the breadboard. Then connect them to the Arduino MINIMA board. For that, use the circuit diagram below.
Step 3
Now connect the Arduino UNO R4 MINIMA board to the computer. Then copy and paste following program to the Arduino IDE.
- Code and circuit diagram — Download
void setup() {
// Set the LED pins as the output pins
for (byte a = 2; a <= 6; a++) {
pinMode(a, OUTPUT);
}
}
//Call the functions
void loop() {
one(4);
two(4);//VIP light pattern
three(6);
four(6);
}
//Pattern one
void one (byte y) {
for (byte x = 0; x < y ; x++) {
for (byte a = 2; a <= 6; a++) {
digitalWrite(a, HIGH);
delay(50);
digitalWrite(a, LOW);
}
for (byte a = 6; a > 2; a--) {
digitalWrite(a, HIGH);
delay(50);
digitalWrite(a, LOW);
}
}
}
//Pattern two
void two(byte y) {
for (byte x = 0; x < y ; x++) {
for (byte a = 0; a <= 4; a++) {
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
delay(50);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
delay(50);
}
for (byte a = 0; a <= 4; a++) {
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
delay(50);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
delay(50);
}
}
}
//Pattern three
void three(byte y) {
for (byte x = 0; x <= y; x++ ) {
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
delay(80);
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
delay(80);
}
}
//Pattern four
void four(byte y) {
for (byte x = 0; x <= y; x++) {
for (byte a = 2; a <= 6; a++) {
digitalWrite(a, LOW);
digitalWrite(a + 1, LOW);
delay(50);
digitalWrite(a, HIGH);
digitalWrite(a - 1, HIGH);
}
for (byte a = 6; a > 2; a--) {
digitalWrite(a, LOW);
digitalWrite(a - 1, LOW);
delay(50);
digitalWrite(a, HIGH);
digitalWrite(a - 1, HIGH);
}
}
}
Step 4
Finally, select the board and port. After, click the upload button. If Arduino UNO R4 boards are not installed yet, please visit this tutorial for that.
Now, you can test this project and also change the LED patterns.
Push button control
Step 1
Firstly, identify these components.
Step 2
Secondly, place the components on the breadboard. Then connect them to the Arduino board. For that, use the circuit diagram below. I have used the Pull-up method.
Step 3
Now connect the Arduino UNO R4 MINIMA board to the computer. Then copy and paste the following program to the Arduino IDE.
- Code and circuit diagram — Download
#define button1 2
#define button2 3
#define LED1 8
#define LED2 9
void setup() {
Serial.begin(9600);
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
}
void loop() {
bool value1 = digitalRead(button1);
bool value2 = digitalRead(button2);
if (value1 == 0) {
digitalWrite(LED1, HIGH);
} else if (value2 == 0) {
digitalWrite(LED2, HIGH);
} else {
digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW);
}
}
Step 4
Finally, select the board and port. After, click the upload button. If Arduino UNO R4 boards are not installed yet, please visit this tutorial for that.
Now you can test this project.
DHT11 sensor with RGB display
Step 1
Firstly, identify these components.
Step 2
Secondly, place these components on the breadboard. Then, connect them to the Arduino UNO board. For that, use the circuit diagram below.
Step 3
Now connect the Arduino UNO R4 MINIMA board to the computer. Then copy and paste the following program to the Arduino IDE.
#include <Arduino_GFX_Library.h>
#include "DHT.h"
#define DHT11_PIN 2 // Define the pin used to connect the sensor
Arduino_DataBus *bus = new Arduino_HWSPI(9 /* DC */, 10 /* CS */);
Arduino_GFX *gfx = new Arduino_ST7796(bus, 8 /* RESET */, 0, true);
DHT dht11(DHT11_PIN, DHT11); // Create a DHT object
void setup() {
// initialize the sensor
Serial.begin(9600);
dht11.begin();
pinMode(7, OUTPUT);
digitalWrite(7, LOW);
// Serial.setDebugOutput(true);
// while(!Serial);
Serial.println("Arduino_GFX Hello World example");
pinMode(7, OUTPUT);
digitalWrite(7, HIGH);
// Init Display
if (!gfx->begin()) {
Serial.println("gfx->begin() failed!");
}
delay(1000);
}
void loop() {
// read humidity
float humidity = dht11.readHumidity();
// read temperature as Celsius
float temperature = dht11.readTemperature();
// read temperature as Fahrenheit
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT11 sensor!");
}
String humi = String(humidity) + " %";
String temp = String(temperature) + " C";
gfx->setCursor(10, 10);
gfx->setTextColor(DARKGREEN);
gfx->setTextSize(3, 3);
gfx->println("Temperature");
gfx->setCursor(10, 40);
gfx->setTextColor(PURPLE);
gfx->setTextSize(3, 3);
gfx->println(temp);
gfx->setCursor(10, 80);
gfx->setTextColor(DARKGREEN);
gfx->setTextSize(3, 3);
gfx->println("Humidity");
gfx->setCursor(10, 110);
gfx->setTextColor(PURPLE);
gfx->setTextSize(3, 3);
gfx->println(humi);
gfx->fillScreen(BLACK);
}
Step 4
Finally, select the board and port. After, click the upload button. If Arduino UNO R4 boards are not installed yet, please visit this tutorial for that.
Now you can test this project using the heated soldering iron.
Relay module control using an IR remote
Step 1
Firstly, identify these components.
Step 2
Secondly, connect these components to the Arduino board. For that, use the circuit diagram below.
Step 3
Now connect the Arduino UNO R4 MINIMA board to the computer. Then copy and paste the following program to the Arduino IDE.
#include <IRremote.h>
#define RELAY_PIN 2 // the Arduino pin, which connects to the IN pin of relay module
int RECV_PIN = 3; //define input pin on Arduino
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup(){
pinMode(RELAY_PIN, OUTPUT); // initialize digital pin as an output.
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode()) {
if (irrecv.decodedIRData.protocol == UNKNOWN) {
Serial.println(F("Received noise or an unknown (or not yet enabled) protocol"));
// We have an unknown protocol here, print extended info
irrecv.printIRResultRawFormatted(&Serial, true);
irrecv.resume(); // Do it here, to preserve raw data for printing with printIRResultRawFormatted()
} else {
irrecv.resume(); // Early enable receiving of the next IR frame
irrecv.printIRResultShort(&Serial);
irrecv.printIRSendUsage(&Serial);
}
Serial.println();
Serial.println(irrecv.decodedIRData.command);
if (irrecv.decodedIRData.command == 0x45) { // 1 Change status
toggleRelay();
delay(300);
}else if(irrecv.decodedIRData.command == 0x46){ // 2 turn on the relay
digitalWrite(RELAY_PIN, HIGH);
}else if(irrecv.decodedIRData.command == 0x47){ // 3 turn off the relay
digitalWrite(RELAY_PIN, LOW);
}
}
}
void toggleRelay() {
digitalWrite(RELAY_PIN, !digitalRead(RELAY_PIN)); // change the status
}
Step 4
Finally, select the board and port. After, click the upload button. If Arduino UNO R4 boards are not installed yet, please visit this tutorial for that.
Now you can turn on and off the relay module using the number 1,2 and 3 keys on the remote control.
OK, enjoy these projects. Also, you can try the other projects on the USB drive. The full video guide is below. So we hope to see you in the next project. Have a good day.
Troubleshooting
- Check the breadboard connections.
- Check the jumper wire connections.
- Install the necessary library files.
- Install the Arduino UNO R4 boards.
- Select the correct board and port.
52pi Arduino UNO R4 Minima smart farming kit with Projects