Project Description

Configure CoAP Server and CoAP Client using two WizArduino.

Configure the system to be able to turn On/Off the LED

according to the sensing value by connecting CDS sensor to LED.

 

1. What is CoAP?

coap_main

The initials CoAP stand for Constrained Application Protocol. CoAP is an application protocol for low specification module. In other words, this is a lightweight version for WPAN device with limited resources although we want to use HTTP. It supports low power and the main purpose is to transfer sensor data. It also has asynchronous request/response design structures.

 

2. Arduino IDE Setup

sed two WizArduino for Server and Client configuration.

 

coap_proc

It will turn ON/OFF LED on the server side after reading the data value of illuminance sensor at Client to determine the light ON/OFF and sending it to the server.

 

First of all, we have to add M0 board since WizArduino is based on M0.
board

 

We can select the M0 board as searching for and installing M0 in the board manager.

 

 

Next, we need to add a library.

We need to add Ethernet2 library separately and install CoAP library because it is not compatible with Ethernet library based on W5500.

Ethernet2

As with adding a board, we can install the library at the top by searching for Ethernet2 and CoAP.

 

3. CoAP Server

 

CoAP Server is responsible for receiving the data from CoAP Client.

Run the example of [file-examples-CoAP Simple library-server].

 

Add 2 in the red boxes for the same reason we installed Ethernet2 library. (Ethernet2.h, EthernetUdp2.h)
CoAP_header

In coapserver source code, we create request(goap.put()) of CoAP as comments and use only coap.get() to make CoAP Server only receive.

CoAP_server_loop

 

Then, add code to control the connected LED that analyzes the receiving messages.

CoAP_server_led

 

3. CoAP Client

Read illuminance sensing data of CDS Sensor by connecting illuminance sensor to Arduino A1.

The read sensing value will send ON/OFF data information to CoAP Server based on the specific threshold value.

 

 

 

CoAP_client_loopCoAP_mac CoAP_Serial