Sie sind auf Seite 1von 6

Food Living Outside Play Technology Workshop

An easy way to control your Arduino from Internet :)


by nearbus on April 1, 2013

Table of Contents

An easy way to control your Arduino from Internet :) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Intro: An easy way to control your Arduino from Internet :) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 1: Sing up a new user . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 2: Define a New Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Step 3: Download and Install the NearAgent code library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Step 4: Set the Agent's configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Step 5: Verify that your Arduino is UP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Step 6: Wire your Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Step 7: Control the LED from the Cloud . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Step 8: Testing More Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

http://www.instructables.com/id/An-easy-way-to-control-your-Arduino-from-Internet-/
Intro: An easy way to control your Arduino from Internet :)
This instructive describes step by step how to configure an Arduino Ethernet board tocontrol a LED from the Cloud, (the "Hello World" example in the microcontroller's
world). This trivial example is intended to introduce you the way how the NearBus connector works.

NearBus is a Cloud Connector that allows you to fully integrate in the cloud different MCU platforms (like Arduino, OpenPicus, etc.) in a very easy and transparent
way. Installing a light agent (the NearAgent) in your MCU hardware the NearBus system will allow you to see the MCU as a real extension of the cloud, controlling it
via the NearAPI (a very simple set of Web Services API functions).

There is no PC or gatewa y involved in this implementation. The Arduino will connect directly to the NearHub server through the internet access router and you will be
able to control it from your web browser.

The NearBus Concept


The NearBus system proposes a different paradigm to support a large deployment of simple controlled devices. Instead of the traditional concept of "connect" a
remote device to the cloud (to control it), the NearBus system "maps" the device into the cloud , doing a mirroring (or replication) of small part of the
microcontroller's memory into the cloud memory. Under this paradigm, reading or writing on the Cloud's memory will have the same effect as if you were reading or
writing directly into the microcontroller's memory, simplifying the way in which the device is controlled.

This mirroring process between the Microcontroller's memory and the Cloud memory is called the MemoryMap process, so under the NearBus paradigm we say that the
remote device more than "connected" to the Cloud will be "Mapped" into the Cloud.

Although this instructive only show how to control a LED, the NearBus system offers all the MCU's features (like ADC, PWM, etc).

Required Components

To implement this App Note you will need:


- 1 Arduino Ethernet Board
- 1 LED
- 1 Current limiter Resistor ( 330 Ohms or similar value)
- 1 Ethernet Internet connection (with a RJ45 cable)
- Implementation time: 20 min
- Difficulty Level: Low

Step 1: Sing up a new user


a- Go to the SIGN UP screen ( www.nearbus.net ) and set up a new user. Only the username , email and password are required to setup your new account.

b- Then, login into the NearBus website using your new user and password.

http://www.instructables.com/id/An-easy-way-to-control-your-Arduino-from-Internet-/
Step 2: Define a New Device
From the top menu bar select the NEW DEVICE option to create a new device.

To setup the new device you should configure the followings field in order to define it. Take in account that only the SHARED SECRET field is mandatory (the password).
The other fields are optional, so it is not necessary configure they for this first example.

- Device Name: optional (eg. My Device)


- Location: nothing
- Function: nothing
- Shared Secret: Mandatory (length of 8). It is the same as you should configure in the Arduino (eg. 12345678)
- Callback Function: nothing
- Refresh Rate: nothing (default 1000ms)

Note: When you create a new device, the NearBus system will generate a unique device ID (likeNB1xxxxx) that will be showed in the DEVICE LIST screen (do not
confuse it with the DEVICE NAME field !!).

Take in account that you will need to configure this ID in the Arduino's code as explained in the following step.

Step 3: Download and Install the NearAgent code library


a- Download the Arduino NearBus library from the following link:

Download Arduino Ethernet Agent

Note: This code only include a simple implementation of the NearBIOS features in order to simplify its understanding.

b- Upload it to the Arduino Ethernet board, you only have to unzip the file and copy it into the Arduino library folder (remember to restart the Arduino IDE).

c- Load the "Hello World" code from the example section in the IDE menu.

http://www.instructables.com/id/An-easy-way-to-control-your-Arduino-from-Internet-/
Step 4: Set the Agent's configuration
a- Change the configuration settings in the Arduino main code, as showed in the next picture:

- Device_ID: Unique device identifier generated by the system (you can find it in the Device List screen).
- Password: User generated (shared secret).
- Arduino Ethernet MAC: Ethernet MAC Address (you can find it printed in the Arduino Ethernet board).

b- Compile and upload the code "Hello World" to the Arduino Ethernet board.

Important: Because in this example the Arduino will work in VMCU mode, you will not need modify the Arduino's code. The Arduino will be controlled from the Cloud
through the NearBIOS.

Step 5: Verify that your Arduino is UP


In the Device List screen, your Arduino should go Up (green) in a few seconds.

Important: The screen does not refresh in an automatic way, so you should reload it in order to get the device status.

Troubleshooting :(
If your Arduino remains DOWN, make the following verifications:
1- Verify that the green light in the Arduino's Ethernet connector is flashing.
2- Verify that your internet connection if Up (if you can surf by internet).
3- Verify that your Arduino is configured Ok (the 8 character password, the Device_ID and the Arduino's MAC).
4- Reset the Arduino, to ensure that it is properly initialized.

http://www.instructables.com/id/An-easy-way-to-control-your-Arduino-from-Internet-/
Step 6: Wire your Arduino
Wire a LED with a current limiter resistor to the Arduino's Pin 3 (NearBus Channel 0).

Step 7: Control the LED from the Cloud


a- Select the "CONFIG DEVICE" option in the drop-down menu from the DEVICE LIST screen.

b- Put the Channel 0 in Manual Mode (check de MAN check-box for Channel 0).

c- Control your LED: Change the FUNCTION drop-down menu to UP, and the Arduino's Pin 3 should go UP and the LED will light :).

Step 8: Testing More Features


If you want to try more features available in the function drop-down menu please refer to the HELP section for a detailed description of the NearBIOS features.

If you are interested in know more about this App Note please contact us at info@nearbus.net or visit www.nearbus.net

Related Instructables

XMAS Internet How to tweet Intro to Arduino Arduino


Sequencer by from an Arduino by randofo Ethernet Shield
Real-time room Twitter
nearbus using the wifi Tutorial by
temperature on controlled
sheild by Arduino randofo
your Website echoalex
(no javascript or Outputs - no PC
server side - LCD Display +
Sensor data to
coding) by
Twitter by
apasiechnikov
XenonJohn

http://www.instructables.com/id/An-easy-way-to-control-your-Arduino-from-Internet-/
Advertisements

http://www.instructables.com/id/An-easy-way-to-control-your-Arduino-from-Internet-/

Das könnte Ihnen auch gefallen