
Sea Voyage
Robo Explorers 2
Arduino
What is Arduino
Imagine you have a tiny robot friend that listens to your instructions. That’s kind of like what an Arduino is!
Arduino is a small computer. It has a little brain (called a microcontroller) that can think and do tasks for you.
You write simple instructions (like a list of steps) and upload them to the Arduino. When you power it on, it follows your instructions exactly!
How It Works
Inputs and Outputs:
Think of inputs like buttons, sensors, or even a little microphone. They tell the Arduino, "Hey, something happened!"
Outputs are things like lights, buzzers, or motors. The Arduino tells them what to do like turning on a light or making a sound.Making Things Happen:
For example, you could tell your Arduino to:Turn on a light when you press a button.
Make a buzzer beep when it hears a clap.
Spin a motor when it gets a signal from a sensor.
Why Is It Cool?
Build Fun Projects:
You can use Arduino to build cool projects like a dancing robot, a simple game, or even a weather station to measure temperature!Learn by Doing:
With Arduino, you learn how electronics work, how to program, and how to bring your ideas to life, just like building with LEGO blocks but with lights, sounds, and movements.Easy to Use:
Even though it’s like a mini computer, Arduino uses simple commands. It’s designed so that kids and beginners can create amazing things without needing to be an expert.
In Short, Arduino is your little helper that listens to your ideas and makes them happen with lights, sounds, and motion. It’s like having a magic box that turns your cool thoughts into real-world projects!
How to connect Arduino and turn on Yellow Tyro Board
Components of Arduino
1. The LEDs
What They Are:
Little lights that turn on when the board is powered up.What They Do:
They tell you, "Hey, I’m awake!" Sometimes one LED might blink when the board is sending or receiving messages.
2. The Button (Reset Button)
What It Is:
A tiny button you can press on the board.What It Does:
It restarts the Arduino Nano—like rebooting a computer when you need a fresh start.
3. The Chip
What It Is:
The microcontroller chip (usually an ATmega328) is the brain of the Nano.What It Does:
It listens to the instructions (code) you write and tells the board what to do—like turning on an LED or making sounds.
4. The USB Socket
What It Is:
A small port where you plug in a USB cable.What It Does:
It connects your Arduino Nano to your computer. This lets you send your code to the Nano and sometimes even powers it.
Here's How the Pins Work
Digital Pins (labeled with D):
These are like simple on/off switches. When you tell a digital pin to turn on, it gives power to something (like lighting up an LED). When it’s off, nothing happens.Analog Pins (labeled with A):
These pins can read different amounts of power. Imagine a volume knob that can be turned up or down; analog pins can sense changes in things like light or temperature.Power Pins:
These pins give your Arduino power (like 5V or 3.3V) or help you connect the board to the ground (GND). They are like the battery and the plug of the board.
Code Breakdown
Its secret power lies in its code, a special language that brings it to life. Each line of code is like a command in a spaceship’s control system, guiding the board on how to read the world around it. Some instructions tell it to measure the waves using sensors, others help it display messages on its OLED screen, and some even make it move with precision using its servo motor. Just like an intelligent navigator, the Blue Elixir Board follows its code to make decisions, light up LEDs, and communicate with its surroundings. As you explore its code line by line, you'll uncover how technology and creativity come together—turning simple instructions into an incredible journey across the seas of innovation
Let's learn the line by line interpretition of our code!
These libraries enable communication with external components:
Wire.h
→ Handles I2C communication for the OLED.Adafruit_GFX.h
&Adafruit_SSD1306.h
→ Used to control the OLED display.dht11.h
→ Provides temperature and humidity sensor support.Servo.h
→ Enables servo motor control.
DHT
is used to read temperature and humidity.
myservo
is used to control a servo motor.
Pin 9 and pin 10 are for the motor. Pin 9 makes the motor turn forward, and pin 10 makes it turn backward.
Defines pin numbers for sensors, LEDs, and OLED display settings.
Creates an instance of the OLED display object.
Initializes serial communication at 9600 baud
for debugging.
Configures ultrasonic sensor pins.
Configures LED pins as outputs.
Attaches servo to pin 9, moves it to 90 degrees, then detaches it.
Initializes OLED display and checks if it’s working.
The loop()
part is where the Arduino keeps doing things again and again – it never stops until you turn it off.
Reads temperature & humidity from the DHT11 sensor.
Measures distance using the ultrasonic sensor.
Turns LEDs ON/OFF based on measured distance.
Some resources
For Windows
Open Your Internet Browser:
Open Chrome, Firefox, or another browser.Go to the Arduino Website:
Type https://www.arduino.cc/en/software in the address bar and press Enter.Download for Windows:
Click the "Windows Installer" button.
(You can also use the ZIP file if you like, but the installer is easiest.)Install Arduino:
When the file finishes downloading, double-click it.
Follow the simple instructions on the screen.Start Creating:
After installing, open Arduino and have fun making projects!
For Mac
Open Your Internet Browser:
Use Safari, Chrome, or another browser.Go to the Arduino Website:
Type https://www.arduino.cc/en/software in the address bar and press Enter.Download for macOS:
Click the "macOS" download button.Install Arduino:
When the download is done, open the ZIP file.
Drag the Arduino icon into your Applications folder.Start Creating:
Open the Arduino app from Applications and enjoy your new projects!
Fun Activity!
Fun Activity: The Arduino Heartbeat Simulator!
In this fun activity, you'll program your Arduino Nano to simulate a heartbeat using its built-in LED! Just like a real heartbeat, the LED will blink in a special rhythm—a short blink followed by a longer blink—mimicking the way a heart pumps blood. This is a great way to explore timing, loops, and simple coding concepts using just your Arduino Nano.
Code Explanation
setup() Function – Getting Ready!
This runs once when your Arduino starts.
This tells the Arduino, "We will control the built-in LED!" (which is usually connected to pin D13).
loop() Function – The Heartbeat!
This part runs forever, just like a real heartbeat!
First blink (200ms ON, 100ms OFF): A quick beat.
Second blink (500ms ON, 1000ms OFF): A stronger beat followed by a longer pause—just like a real heartbeat!
What Happens?
When you upload this code to your Arduino Nano, the built-in LED will blink in a heartbeat rhythm—a quick pulse followed by a stronger pulse. It's like giving your Arduino a heartbeat!
Challenge:
Try changing the delay values to make your Arduino "heartbeat" faster or slower. What happens if you make the pauses longer or shorter?