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?
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.
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.
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.
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].
In coapserver source code, we create request(goap.put()) of CoAP as comments and use only coap.get() to make CoAP Server only receive.
Then, add code to control the connected LED that analyzes the receiving messages.
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.