Coap Tutorial Arduino Eclipse
Coap Tutorial Arduino Eclipse
This tutorial shows how to run a CoAP server using Eclipse, and view the CoAP resources
through Copper, the CoAP user-agent.
http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/neon1a
If you already have Eclipse installed, then you don’t need to do this step. No need to install,
unzip the package and you can run Eclipse now.
Maven may have already come together with Eclipse, if not, install it as below.
Run Eclipse, click Help-> Install New Software…, in the Work with: field, enter the following
website:
http://download.eclipse.org/technology/m2e/releases
In the output, select Maven Integration for Eclipse, click Next, and Next, until it is installed. You
may need to restart Eclipse after the installation.
3. Download CoAP library
On windows, download the .zip file directly from the github page:
https://github.com/eclipse/californium
Click File -> Import…, you would see the following dialog.
Select Maven->Existing Maven Project, then click Next. You would see the following dialog. In
the Root Directory:, browse to your californium-master folder. Check all the pom.xml files, then
click Finish.
You would see all the Californium libraries and projects are listed on the left.
5. Run Hello World
Select the Hello World example, double click it, the code is already compiled automatically by
Eclipse. Click Run -> Run, you will have a Coap server running on your computer.
To stop the server, click the RED square near the Console.
Basically, you will modify this example for your Project 2. Add sensor readings as “resources” in
CoAP server. Refer to class “HelloWorldResource” in the hello-world-server
example.
You can also check the examples from the following Github repository:
https://github.com/jvermillard/hands-on-coap
7. Install Copper user-agent add-ons on Firefox.
You must have Firefox browser installed to run this CoAP client. Open your Firefox browser, and
load the following link from Firefox:
https://addons.mozilla.org/en-US/firefox/addon/copper-270430/
Type the following CoAP address to access the “HelloWorld” server. Suppose the ip address of
your computer is 192.168.1.17:
coap://192.168.1.17:5683/
Click “core”, then click , you will get all the resources on the server. In this example, the
resource name is “helloworld”:
Then click “helloworld” and , you will get the response which is sent back by the
“helloworld” resource, which is the string “Hello World!”: