Network

Network

Many of the projects you've created so far have interacted with the physical world using sensors, buttons, displays, motors, and LEDs.

But what if your project needs to:

  • Connect to the internet?
  • Talk to another device?
  • Send information wirelessly?
  • Receive information from another computer?
  • Get the current date and time online?

To do all of these things, your D1 R32 first needs access to a network.

The Network category provides the tools required to connect to Wi-Fi, communicate with other devices, exchange information across a network, and access online services.

Think of networking as giving your project a way to communicate beyond its own hardware.

 A network connection is like a passport to the digital world.

Without it, your device can only interact with the hardware directly connected to it.

With it, your device can communicate with computers, phones, websites, cloud services, and other smart devices around the world.


Introduction

Imagine trying to send a text message without a cellular network.

Or trying to browse a website without internet access.

No matter how powerful your device is, it cannot communicate with other devices unless it has a connection.

The same is true for the D1 R32.

Before it can use HTTP requests, cloud services, network time, or socket communication, it must first connect to a network.

The process looks like this:

D1 R32

↓

Wi-Fi Network

↓

Internet or Local Network

↓

Other Devices and Services

This lesson focuses on the technology that makes that connection possible.


What Is a Network?

A network is a group of devices that can communicate with one another.

Examples include:

  • Home Wi-Fi networks
  • School networks
  • Office networks
  • The internet itself

When a D1 R32 joins a network, it becomes part of that connected system.

This allows it to:

  •  Send information
  • Receive information
  • Access online services
  • Communicate with other devices
  • Synchronize data
  • Control remote systems

Understanding Network Layers

To understand networking, it helps to think in stages.

Layer 1: Connection

Join a network.

D1 R32

↓

Wi-Fi


Layer 2: Verification

Check that the connection worked correctly.

Connected?

↓

True or False


Layer 3: Communication

Send and receive information.

Device

↔

Device


Layer 4: Services

Use internet-based services.

Network Time

HTTP Requests

Cloud Services


Network Learning Model

CONNECT

↓

VERIFY

↓

COMMUNICATE

↓

USE SERVICES

This is the same learning progression used throughout this section.


Network Category

[INSERT CATEGORY IMAGE HERE: Network Category]

Figure 11.1 - Blocks available in the Network category.

The Network category contains tools for:

  • Connecting to Wi-Fi
  • Configuring network interfaces
  • Access Points
  • Socket communication
  • Network servers
  • Sending data
  • Receiving data
  • Network time synchronization

Connecting to Wi-Fi

[INSERT BLOCK IMAGE HERE: Connect Wi-Fi]

The simplest network block connects directly to a Wi-Fi network using a name and password.

Example:

Wi-Fi Name

Password

Conceptually:

Network Name

+

Password

↓

Connect

This is the networking equivalent of joining the Wi-Fi on a phone or laptop.


Why Is Wi-Fi Important?

Many advanced Clu-Blocks categories depend on a network connection.

Examples include:

  • HTTP
  • Cloud services
  • Socket communication
  • Network time
  • Remote control systems

Without Wi-Fi, these features cannot communicate beyond the device itself.


Wi-Fi Modes

[INSERT BLOCK IMAGE HERE: Configure Wi-Fi Mode]

The D1 R32 supports two operating modes:

STA Mode (Station Mode)

D1 R32

↓

Connects to Router

This is the most common mode.

The D1 R32 joins an existing Wi-Fi network.

Examples:

  • Home Wi-Fi
  • School Wi-Fi
  • Mobile hotspot

For beginners, STA mode is where most projects should begin.


AP Mode (Access Point Mode)

D1 R32

↓

Creates Its Own Wi-Fi

Instead of joining an existing network, the device creates a new network that other devices can connect to.

Think of AP mode as turning your D1 R32 into a small Wi-Fi hotspot.


STA vs AP

ModePurpose
STAConnect to an existing network
APCreate your own network
Beginner Friendly STA
Advanced Projects AP

Activating and Deactivating Wi-Fi

[INSERT BLOCK IMAGE HERE: Activate Network Interface]

Before a network interface can be used, it must be activated.

Conceptually:

Configure Interface

↓

Activate

↓

Connect

The Network category includes controls that allow the interface to be:

Activate

or

Deactivate


Real World Comparison

Think of the network interface like a phone.

If the phone is switched off:

No Calls

No Messages

No Internet

If the phone is switched on:

Ready to Communicate


Checking Network Status

[INSERT BLOCK IMAGE HERE: Connection State]

Connecting to a network and actually being connected are not always the same thing.

A program should verify whether a connection was successful.

Conceptually:

Attempt Connection

↓

Connected?

↓

True / False

This information works naturally with Logic blocks.


Example

Connected?

↓

TRUE

↓

Continue Program

or

Connected?

↓

FALSE

↓

Try Again


Important Programming Habit

 Always check the connection before assuming it worked.


Scanning for Available Networks

[INSERT BLOCK IMAGE HERE: Scan Wi-Fi]

The Scan block searches for nearby Wi-Fi networks.

Conceptually:

D1 R32

↓

Scan

↓

Available Networks

Scanning is useful when:

  • Diagnosing connection problems
  • Finding available networks
  • Learning about the local wireless environment

Beginner Workflow

Scan

↓

Display Result

↓

Serial Monitor

This makes network activity visible while students learn.


Getting Network Information

[INSERT BLOCK IMAGE HERE: Get Wi-Fi Information]

Once connected, the D1 R32 can retrieve information about the network connection.

Examples include:

  • IP Address
  • Subnet Mask
  • Gateway
  • DNS Server

What Is an IP Address?

An IP address is the unique address that identifies a device on a network.

It works similarly to a street address.

Just as a house needs an address to receive mail, a device needs an IP address to send and receive network information.


Example

Wi-Fi Connected

↓

IP Address

↓

192.168.x.x


Why Is This Useful?

IP addresses help:

  • Troubleshoot network issues
  • Identify devices
  • Connect systems together

Disconnecting from Wi-Fi

[INSERT BLOCK IMAGE HERE: Disconnect Wi-Fi]

A device can also intentionally leave a network.

Conceptually:

Connect

↓

Use Network

↓

Disconnect

This completes the basic network lifecycle:

CONFIGURE

↓

CONNECT

↓

VERIFY

↓

USE

↓

DISCONNECT


Access Point Configuration

[INSERT BLOCK IMAGE HERE: Access Point Configuration]

When using AP mode, the D1 R32 can create its own wireless network.

The Access Point configuration blocks allow you to set:

  • Network Name (ESSID)
  • Channel Number

Example

MyRobotNetwork

Other devices can then connect directly to that network.


Real-World Example

Phone

↓

Robot Access Point

↓

Wireless Connection

No router is required.


Network Communication

Once devices are connected, they can begin exchanging information.

This introduces a new concept:

Sockets

A socket is a communication channel between devices.

Think of a socket like a digital conversation line.


Communication Example

Device A

↔

Socket

↔

Device B

Sockets allow information to move between systems.


TCP and UDP

The Network category supports two major communication methods.

  • TCP
  • UDP

TCP Communication

TCP focuses on reliability.

Conceptually:

Send Data

↓

Confirm Delivery

↓

Continue

TCP is commonly used when information must arrive correctly.

Examples:

  • Web communication
  • Login systems
  • File transfers
  • Cloud services

Student-Friendly Explanation

TCP is like sending a registered package.

You expect confirmation that it arrived.


UDP Communication

UDP focuses on speed.

Conceptually:

Send Data

↓

No Confirmation Required

↓

Continue

UDP is typically faster than TCP but less reliable.

Examples:

  • Games
  • Live sensor data
  • Streaming applications

Student-Friendly Explanation

UDP is like shouting a message across a room.

It is fast, but you may not know if everyone heard it.


TCP vs UDP

TCPUDP
ReliableFast
Confirms deliveryDoes not confirm delivery
More overheadLess overhead
Web communicationReal-time communication
Beginner starting pointAdvanced projects

Sending and Receiving Data

Once a connection exists, information can move between devices.


Sending Data

Device

↓

Network

↓

Destination

Examples:

  • Temperature readings
  • Sensor values
  • Commands
  • Messages

Receiving Data

Network

↓

Device

↓

Program

Examples:

  • Control commands
  • Messages
  • Configuration settings

Starting a Server

[INSERT BLOCK IMAGE HERE: Start Server]

Servers wait for incoming communication.

Conceptually:

Start Server

↓

Wait for Connection

↓

Receive Information

Instead of asking another device for information, the server waits for other devices to contact it.


Simple Comparison

ClientServer
Requests informationWaits for requests
Starts communicationListens for communication

Network Time (NTP)

[INSERT BLOCK IMAGE HERE: Network Time]

One of the most useful network services is NTP.

NTP stands for:

Network Time Protocol

It allows a device to obtain the current time from internet time servers.


Conceptual Flow

D1 R32

↓

NTP Server

↓

Current Time


Why Is This Useful?

Projects may need:

  • Clocks
  • Alarms
  • Data logging
  • Time stamps
  • Scheduling systems

Without NTP, the device would not know the correct time after restarting.


Network and HTTP

Networking and HTTP are closely related.

Students often confuse these concepts.

They are not the same thing.


Network

Provides the connection.

Connect to Wi-Fi


HTTP

Uses that connection.

Make Web Request


Relationship

D1 R32

↓

Wi-Fi

↓

Network Connection

↓

HTTP Request

↓

Web Service

A device must connect to a network before it can use HTTP successfully.


Using the Serial Monitor While Learning Networks

Networking happens mostly behind the scenes.

Because of this, the Serial Monitor becomes extremely important.

A recommended beginner workflow is:

Connect to Wi-Fi

↓

Check Connection

↓

Display IP Address

↓

Print Status Messages

↓

Test Communication

This helps students see exactly what is happening.


Key Distinction: Connect vs Connected

Students often assume these mean the same thing.


Connect

Attempt to Join Network


Connected

Successfully Joined Network


Memory Tip

 Connect = Try

 Connected = Success


Key Distinction: Wi-Fi vs Internet

Another common misunderstanding is assuming Wi-Fi automatically means internet.

Not always.


Wi-Fi

Connected to Network


Internet

Network Can Reach Online Services

A device may have Wi-Fi access but still be unable to reach the internet.


Key Vocabulary

TermDefinition
NetworkA group of connected devices
Wi-FiWireless network communication
STA ModeConnect to an existing Wi-Fi network
AP ModeCreate a Wi-Fi network
IP AddressA unique network address for a device
SocketA communication channel between devices
TCPReliable network communication
UDPFast network communication
ServerA system that waits for incoming connections
ClientA system that initiates communication
NTPNetwork Time Protocol
ESSIDThe name of a Wi-Fi network

Summary

In this lesson, you learned how networking allows a D1 R32 to communicate with other devices and online services.

You explored how to:

 Connect to Wi-Fi

 Verify a connection

 Retrieve network information

 Use STA and AP modes

 Understand TCP and UDP communication

 Send and receive network data

 Work with servers

 Obtain accurate time using NTP

 Prepare devices for internet communication

Networking is the foundation of modern IoT systems. Before a project can use cloud services, HTTP requests, remote control, or online data, it must first establish a reliable network connection.


Key Takeaway

A network connection allows your D1 R32 to communicate beyond its own hardware.

Once connected to Wi-Fi, your projects can exchange information with other devices, access online services, synchronize time, communicate across networks, and become part of the growing world of Internet of Things (IoT) technology.