-
Notifications
You must be signed in to change notification settings - Fork 0
Arduino Documentation
Arduino
Arduino UNO R4 WiFi
Microcontroller - heart of Arduino

Features:
CPU:
-
The CPU is the brain of the microcontroller responsible for executing instructions.
-
In Arduino boards, the CPU is usually based on the AVR architecture (e.g., ATmega series) or ARM architecture (e.g., SAMD series). The CPU's clock speed determines how fast it can execute instructions.
Oscillators:
-
Oscillators provide the clock signal to synchronize the operations of the microcontroller.
-
Arduino boards typically have a crystal oscillator or a ceramic resonator to generate a stable clock signal. The clock frequency affects the execution speed of the program and the accuracy of time-related functions.
SRAM (Static Random Access Memory):
-
SRAM is used for temporary data storage during program execution.
-
In Arduino, SRAM is where variables are stored, including those created by your program. The amount of SRAM available varies between different Arduino models and affects the complexity and size of programs that can be executed.
EEPROM (Electrically Erasable Programmable Read-Only Memory):
-
EEPROM is non-volatile memory that retains data even when the power is turned off.
-
Arduino boards often have a small amount of EEPROM for storing data that needs to be preserved between power cycles, such as configuration settings or calibration values. It allows for data to be written and rewritten, but the process is slower compared to other types of memory.
Timers:
-
Timers are essential for time-related operations and creating delays.
-
Arduino microcontrollers come with built-in timers/counters that can be used for various purposes, such as generating PWM signals, measuring time intervals, or triggering events at regular intervals. These timers are crucial for controlling the timing of your program and interfacing with external devices.
USB-C Port - used to upload code
Software
1.Software needed - Arduino IDE/VSCode extension
To use the Arduino UNO R4 WiFi board, you will need to install the UNO R4 WiFi board package, which is part of the Arduino UNO R4 Core (https://github.com/arduino/ArduinoCore-renesas) .
2.Install Board Package in IDE (Arduino has to be connected to laptop via USB-C)
- Every program has 2 basic functions:
void setup {
}
void loop { }
Setup - runs once on startup or reset
Loop - runs continuously to react to devices and/or changes to the program
4.Servo motor library
Usage
This library allows an Arduino board to control RC (hobby) servo motors. Servos have integrated gears and a shaft that can be precisely controlled. Standard servos allow the shaft to be positioned at various angles, usually between 0 and 180 degrees. Continuous rotation servos allow the rotation of the shaft to be set to various speeds. The Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega. On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins.
To use this library: #include <Servo.h>
Circuit
Servo motors have three wires: power, ground, and signal. The power wire is typically red, and should be connected to the 5V pin on the Arduino board. The ground wire is typically black or brown and should be connected to a ground pin on the Arduino board. The signal pin is typically yellow, orange or white and should be connected to a digital pin on the Arduino board. Note that servos draw considerable power, so if you need to drive more than one or two, you’ll probably need to power them from a separate supply (i.e. not the 5V pin on your Arduino). Be sure to connect the grounds of the Arduino and external power supply together.
Examples
-
Knob: control the shaft of a servo motor by turning a potentiometer
-
Sweep: sweeps the shaft of a servo motor back and forth
Methods
5.Adafruit LiquidCrystal library - https://github.com/adafruit/Adafruit_LiquidCrystal
Used for controlling complex LCD screens.
This library is compatible with all architectures so you should be able to use it on all the Arduino boards.
What’s needed for Looney:
Micro Servo Motor:

How does it work:
A servo motor is any type of actuator which uses sensor feedback to control the position, velocity or acceleration of the output. This type of system is commonly used in industrial automation, and there are a wide variety of different sensors, motors and control algorithms to choose from. However, in hobby electronics the term “servo motor” usually refers to a specific type of motor commonly used in small robots and radio-controlled vehicles.
Hobby servo motors usually consist of a small DC motor, a gearbox, a controller chip and a potentiometer (rotary variable resistor) connected directly to the output shaft. As the output shaft turns, the resistance of the potentiometer changes which allows the controller to determine how far the motor has moved. When you send a new position command to the servo motor (usually in the form of a PWM signal), the controller moves the motor until the error between the target position and the current position is zero.
Most servo motors can only turn up to 180°. This limitation is caused by the potentiometer within the servo, which cannot rotate much more than this without breaking. It is possible to buy “continuous rotation” servo motors, but these aren’t quite the same; the name is actually a bit misleading. In continuous rotation servo motors, the potentiometer is removed so that the output shaft can rotate more than 180°. However, this also removes the motor’s ability to figure out how far it has turned.
When you send a new position command to the servo motor, it quickly jumps to the target position at maximum speed (see Example 1). While this is very simple to program, it is only useful in a small number of applications where the speed of the motion doesn’t matter. For example, if you are trying to control a humanoid robot, you want to joints to move slowly and smoothly, rather than creating a robot which wildly flails its arms around! To get around this limitation, most programs split the movement down into small steps, which get sent to the servo motor individually over time. This is how the standard “Sweep” servo example sketch works (see Example 2). The code splits the movement into smaller but equal steps, making the servo move at a constant slower speed.
Example 1:
// Include servo library
#include <Servo.h>
Servo myservo;
void setup() {
myservo.attach(9);
}
void loop() {
// Move to 180°
myservo.write(180);
delay(2700);
// Move back to 0°
myservo.write(0);
delay(2700);
}
Example 2:
#include <Servo.h>
Servo myservo;
int pos = 0;
void setup() {
myservo.attach(9);
}
void loop() {
// Move to 180° in steps of 1°
for (pos = 0; pos <= 180; pos += 1) {
myservo.write(pos);
delay(15);
}
// Move back to 0° in steps of 1°
for (pos = 180; pos >= 0; pos -= 1) {
myservo.write(pos);
delay(15);
}
}
Timing:
The class is relatively fast, making it useful for controlling systems which need a high refresh rate. The table below records the approximate times taken by a variety of micro-controllers to run the main functions of the class. The results show that using an Arduino Uno at an update rate of 100Hz, the class should be able to control up to 30 servo motors before slowing down. The Arduino Uno and Pro Mini both use the same ATmega 328P micro-processor, which explains why their speed is identical:

Multisim Software - to simulate circuit (https://www.multisim.com)
Eagle Software - to design circuit board (more research needed)
Connection to web server: https://docs.arduino.cc/tutorials/uno-r4-wifi/wifi-examples - Web client section
Example of how to connect to some host (google.com in this case):
GET request to the host:
Serial.println("\nStarting connection to server...");
// if you get a connection, report back via serial:
if (client.connect(server, 80)) {
Serial.println("connected to server");
// Make a HTTP request:
client.println("GET /search?q=arduino HTTP/1.1");
client.println("Host: www.google.com");
client.println("Connection: close");
client.println();
}Read the response:
/* just wrap the received data up to 80 columns in the serial print*/
/* -------------------------------------------------------------------------- */
void read_response() {
/* -------------------------------------------------------------------------- */
uint32_t received_data_num = 0;
while (client.available()) {
/* actual data reception */
char c = client.read();
/* print data to serial port */
Serial.print(c);
/* wrap data to 80 columns*/
received_data_num++;
if(received_data_num % 80 == 0) {
Serial.println();
}
}Resource: Servo Motor Connection Video: https://www.youtube.com/watch?v=8Q8W5RzEscM&ab_channel=ElectronicsStuff This might be an Insight for the WiFi: https://www.youtube.com/watch?v=EYrEjC3QEew&ab_channel=MakerTutor