Mastering Arduino Serial Communication

Mastering Arduino Serial Communication
1 / 19
next
Slide 1: Slide
ArduinoHigher Education (non-degree)

This lesson contains 19 slides, with interactive quizzes and text slides.

time-iconLesson duration is: 60 min

Items in this lesson

Mastering Arduino Serial Communication

Slide 1 - Slide

This item has no instructions

Learning Objective
At the end of the lesson, you will be able to understand and use Arduino Serial communication functions and analogRead.

Slide 2 - Slide

This item has no instructions

Text
What do you already know about Arduino Serial communication?

Slide 3 - Mind map

This item has no instructions

Arduino Serial.print()
The Serial.print() function is used to send data from Arduino to the computer for debugging and monitoring.

Slide 4 - Slide

This item has no instructions

Practical Example: Serial.print()
Write a program to send sensor readings to the serial monitor using Serial.print().

Slide 5 - Slide

This item has no instructions

Practical Example: Serial.print()
 +5V --------------------- VCC (Motion Sensor)
 GND --------------------- GND (Motion Sensor)
 D2 (Digital Pin 2) ------- OUT (Motion Sensor)


Slide 6 - Slide

This item has no instructions

Practical Example: Serial.print()

Slide 7 - Slide

This item has no instructions

Understanding Serial.available()
Serial.available() checks if there are any incoming serial data available for reading.

Slide 8 - Slide

This item has no instructions

Arduino Serial.read() and Serial.write()
Serial.read() reads the incoming serial data, while Serial.write() sends binary data to the serial port.

Slide 9 - Slide

This item has no instructions

Practical Exercise: Serial.read() and Serial.write()
Create a program to read and write data through the serial port using Serial.read() and Serial.write().

Slide 10 - Slide

This item has no instructions

Practical Exercise: Serial.read() and Serial.write()

Slide 11 - Slide

This item has no instructions

Practical Exercise: Serial.read() and Serial.write()
Equipment Needed:
Two Arduino boards (e.g., Arduino Uno)
Two USB cables for programming and power
Two LEDs and resistors (e.g., 220Ω) for indicating the received data
Jumper wires

Slide 12 - Slide

This item has no instructions

Practical Exercise: Serial.read() and Serial.write()

Slide 13 - Slide

This item has no instructions

Practical Exercise: Serial.read() and Serial.write()

Slide 14 - Slide

This item has no instructions

Practical Exercise: Serial.read() and Serial.write()

Slide 15 - Slide

This item has no instructions

Practical Exercise: Serial.read() and Serial.write()
Observation:

Open the Serial Monitor for both Arduino boards (Tools -> Serial Monitor).

Observe how the potentiometer data is transmitted from the first Arduino to the second Arduino, controlling the LED brightness based on the received values.

This exercise helps you practice using Serial.read() and Serial.write() for communication between Arduino boards. You can further modify and extend this exercise by experimenting with different sensors, adjusting the control logic, or adding more components.

Slide 16 - Slide

This item has no instructions

Introduction to analogRead
Arduino analogRead() is used to read analog voltage values from analog pins.

Slide 17 - Slide

This item has no instructions

Write down 3 things you learned in this lesson.

Slide 18 - Open question

Have students enter three things they learned in this lesson. With this they can indicate their own learning efficiency of this lesson.
Write down 2 things you want to know more about.

Slide 19 - Open question

Here, students enter two things they would like to know more about. This not only increases involvement, but also gives them more ownership.