0% found this document useful (0 votes)
167 views

Coap Tutorial Arduino Eclipse

This document provides instructions for running a CoAP server using Eclipse and viewing CoAP resources through the Copper user agent. It details downloading Eclipse and the Californium CoAP library, importing Californium into an Eclipse project, running the Hello World example to start a CoAP server, and using the Copper add-on for Firefox to access resources on the server.

Uploaded by

Suniel G Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
167 views

Coap Tutorial Arduino Eclipse

This document provides instructions for running a CoAP server using Eclipse and viewing CoAP resources through the Copper user agent. It details downloading Eclipse and the Californium CoAP library, importing Californium into an Eclipse project, running the Hello World example to start a CoAP server, and using the Copper add-on for Firefox to access resources on the server.

Uploaded by

Suniel G Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

CoAP Tutorial for Eclipse

This tutorial shows how to run a CoAP server using Eclipse, and view the CoAP resources
through Copper, the CoAP user-agent.

1. Download Eclipse for Java developers.

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.

2. Install Maven plugin for Eclipse

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

Then unzip it.

4. Import the Californium to Eclipse:

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.

You will see the output as the following:

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/

Then simply click the “Add to Firefox” button to install Copper.

8. Access the “HelloWorld” server through Copper

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!”:

You might also like