Posts | Comments

Planet Arduino

Archive for the ‘ethermega’ Category

Introduction

If you’re awake and an Internet user, sooner or later  you’ll come across the concept of the “Internet of Things”. It is the goal of many people and organisations to have everything connected to everything for the exchange of data and the ability to control things. And as time marches on, more systems (or “platforms”) are appearing on the market. Some can be quite complex, and some are very easy to use – and this is where our interests lay. In the past we’ve examined the teleduino system, watched the rise of Ninja Blocks, and other connected devices like the lifx bulb and more.

However the purpose of this article is to demonstrate a new platform – XOBXOB (pronounced “zob-zob”) that gives users (and Arduino users in particular) a method of having remote devices connect with each other and be controlled over the Internet. At the time of writing XOBXOB is still in alpha stage, however you’re free to give it a go. So let’s do that now with Arduino.

Getting Started

You’ll need an Arduino and Ethernet shield – or a combination board such as a Freetronics EtherTen, or a WiFly board from Sparkfun. If you don’t have any Ethernet hardware there is a small application you can download that gives your USB-connected Arduino a link to the XOBXOB service. However before that, visit the XOBXOB homepage and register for an account. From there you can visit the dashboard which has your unique API key and a few controls:

XOBXOB dashboard

Now download the Arduino libraries and copy them into the usual location. If you don’t have an Ethernet shield, also get the “connector” application (available for all three OSs). The connector application is used after uploading the XOBXOB-enabled sketches to your Arduino and links it to the XOBXOB service.

Testing with exanples

Moving on, we’ve started with the basic LED control Ethernet sketch which is included in the XOBXOB library. It’s a fast way to check the system is working and your Internet connection is suitable. When using the examples for the first time (or any other XOBXOB sketch, don’t forget to enter your API key and Ethernet MAC address, for example:

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x12, 0x01 };
String APIKey = "cc6zzzzz-0494-4cd7-98a6-62cf21aqqqqq";

We have the EtherTen connected to the ADSL and control via a cellular phone. It’s set to control digital pin 8 so after inserting an LED it worked first time:

The LED is simply turned on and off by using the ON/OFF panel on the XOBXOB dashboard, and then clicking “SET”. You can also click “GET” to retrieve the status of the digital output. The GET function is useful if more than one person is logged into the dashboard controlling what’s at the other end.

Now for some more fun with the other included example, which controls a MAX7219 LED display driver IC. We used one of the boards from the MAX7219 test a while back, which worked fine with the XOBXOB example in the Arduino library:

If this example doesn’t compile for you, remove the line:

#include <"avr/pgmspace.h">

Once operating, this example is surprisingly fun, and could be built into a small enclosure for a simple remote-messaging system.

Controlling your own projects

The functions are explained in the Arduino library guide, which you should download and review. Going back to the LED blink example, you can see how the sketch gets and checks for a new on/off message in the following code:

if (!lastResponseReceived && XOB.loadStreamedResponse()) {

    lastResponseReceived = true;

    String LED = XOB.getMessage("switch");
    if (LED == "\"ON\"") {
      digitalWrite (8, HIGH);
    } 
    else {
      digitalWrite (8, LOW);
    }

So instead of the digitalWrite() functions, you can insert whatever you want to happen when the ON/OFF button is used on the XOBXOB dashboard.  For example with the use of a Powerswitch Tail you could control a house light or other device from afar.

If you want to control more than one device from the dashboard, you need to create another XOB. This is done by entering the “advanced” dashboard and clicking “New”. After entering a name for the new XOB it will then appear in the drop-down list in either dashboard page. To then assign that XOB to a new device, it needs to be told to request that XOB by name in the Arduino sketch.

For example, if you created a new XOB called “garagelight” you need to insert the XOB name in the XOB.requestXOB() function in the sketch:

XOB.requestXOB("garagelight");

and then it will respond to the dashboard when required. Later on we’ll return to XOBXOB and examine how to upload information from a device to the dashboard, to allow remote monitoring of temperature and other data.

Conclusion

Experimenting with XOBXOB was a lot of fun, and much easier than originally planned. Although only in the beginning stages, I’m sure it can find a use with your hardware and a little imagination. Note that XOBXOB is still in alpha stage and not a finished product. For more information, visit hte XOBXOB website. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

The post Arduino and the XOBXOB IoT Platform appeared first on tronixstuff.

Introduction

If you’re awake and an Internet user, sooner or later  you’ll come across the concept of the “Internet of Things”. It is the goal of many people and organisations to have everything connected to everything for the exchange of data and the ability to control things. And as time marches on, more systems (or “platforms”) are appearing on the market. Some can be quite complex, and some are very easy to use – and this is where our interests lay. In the past we’ve examined the teleduino system, watched the rise of Ninja Blocks, and other connected devices like the lifx bulb and more.

However the purpose of this article is to demonstrate a new platform – XOBXOB (pronounced “zob-zob”) that gives users (and Arduino users in particular) a method of having remote devices connect with each other and be controlled over the Internet. At the time of writing XOBXOB is still in alpha stage, however you’re free to give it a go. So let’s do that now with Arduino.

Getting Started

You’ll need an Arduino and Ethernet shield – or a combination board such as a Freetronics EtherTen, or a WiFly board from Sparkfun. If you don’t have any Ethernet hardware there is a small application you can download that gives your USB-connected Arduino a link to the XOBXOB service. However before that, visit the XOBXOB homepage and register for an account. From there you can visit the dashboard which has your unique API key and a few controls:

XOBXOB dashboard

Now download the Arduino libraries and copy them into the usual location. If you don’t have an Ethernet shield, also get the “connector” application (available for all three OSs). The connector application is used after uploading the XOBXOB-enabled sketches to your Arduino and links it to the XOBXOB service.

Testing with exanples

Moving on, we’ve started with the basic LED control Ethernet sketch which is included in the XOBXOB library. It’s a fast way to check the system is working and your Internet connection is suitable. When using the examples for the first time (or any other XOBXOB sketch, don’t forget to enter your API key and Ethernet MAC address, for example:

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x12, 0x01 };
String APIKey = "cc6zzzzz-0494-4cd7-98a6-62cf21aqqqqq";

We have the EtherTen connected to the ADSL and control via a cellular phone. It’s set to control digital pin 8 so after inserting an LED it worked first time:

The LED is simply turned on and off by using the ON/OFF panel on the XOBXOB dashboard, and then clicking “SET”. You can also click “GET” to retrieve the status of the digital output. The GET function is useful if more than one person is logged into the dashboard controlling what’s at the other end.

Now for some more fun with the other included example, which controls a MAX7219 LED display driver IC. We used one of the boards from the MAX7219 test a while back, which worked fine with the XOBXOB example in the Arduino library:

If this example doesn’t compile for you, remove the line:

#include <"avr/pgmspace.h">

Once operating, this example is surprisingly fun, and could be built into a small enclosure for a simple remote-messaging system.

Controlling your own projects

The functions are explained in the Arduino library guide, which you should download and review. Going back to the LED blink example, you can see how the sketch gets and checks for a new on/off message in the following code:

if (!lastResponseReceived && XOB.loadStreamedResponse()) {

    lastResponseReceived = true;

    String LED = XOB.getMessage("switch");
    if (LED == "\"ON\"") {
      digitalWrite (8, HIGH);
    } 
    else {
      digitalWrite (8, LOW);
    }

So instead of the digitalWrite() functions, you can insert whatever you want to happen when the ON/OFF button is used on the XOBXOB dashboard.  For example with the use of a Powerswitch Tail you could control a house light or other device from afar.

If you want to control more than one device from the dashboard, you need to create another XOB. This is done by entering the “advanced” dashboard and clicking “New”. After entering a name for the new XOB it will then appear in the drop-down list in either dashboard page. To then assign that XOB to a new device, it needs to be told to request that XOB by name in the Arduino sketch.

For example, if you created a new XOB called “garagelight” you need to insert the XOB name in the XOB.requestXOB() function in the sketch:

XOB.requestXOB("garagelight");

and then it will respond to the dashboard when required. Later on we’ll return to XOBXOB and examine how to upload information from a device to the dashboard, to allow remote monitoring of temperature and other data.

Conclusion

Experimenting with XOBXOB was a lot of fun, and much easier than originally planned. Although only in the beginning stages, I’m sure it can find a use with your hardware and a little imagination. Note that XOBXOB is still in alpha stage and not a finished product. For more information, visit hte XOBXOB website. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

The post Arduino and the XOBXOB IoT Platform appeared first on tronixstuff.

Jun
12

Interact with Arduino over the Internet with Teleduino

api, arduino, control, ethermega, ethernet, etherten, freetronics, internet, ip, lesson, remote, teleduino, tutorial Comments Off on Interact with Arduino over the Internet with Teleduino 

Introduction

Recently a new method of interacting with an ethernet-enabled Arduino board and the Internet was brought to my attention – a new system called Teleduino. In this article we test a few of the basic features and see what is possible. Please note that these are my own experiments and that Teleduino is a work in progress. So follow along and see for yourself.

Getting Started

  1. You will need an Arduino Uno (or compatible) board and Ethernet shield with the Wiznet chip – or a Freetronics EtherTen (a much neater solution). Teleduino now supports Arduino Mega and the awesome EtherMega.
  2. Download and install the Teleduino Arduino library. This is available from the resources section of the home page. You will also need to be running Arduino IDE v1.0 or greater.
  3. Request an API key. This identified your particular Arduino from the rest.
  4. Get together some basic electronics components for testing, such as some LEDs and 560R resistors; sources of analog input such as an LDR or TMP36 temperature sensor; and a solderless breadboard.
  5. Don’t forget the ethernet cable from your Arduino stack to the router!
  6. Finally, some rudimentary knowledge about networking will be useful. (IP address, DHCP, etc.)
The Teleduino system uses pin D8 for a status LED, so you may find connecting one up now useful while experimenting. Connect as such:

Controlling digital outputs

In this example we control an LED, turning it on and off. For demonstration purposes, connect another LED with a resistor to D6 in the same method as shown above. Next, you need to upload a sketch to the Arduino. It is the

which is included with the library examples. Before uploading, you need to make some modifications. The first of these is to add your API key. Go back to the email you received from Teleduino, and click on the link provided. It will take you to a website that shows a byte array variable named byte key[]. You will copy this into the sketch, replacing the same array full of hexadecimal zeros in the sketch – as shown below – with your own:

Next, scroll down to

… and change one of the hexadecimal numbers to 0×00… just in case there is a clash with other addresses on your network. You never know. Finally – depending on your network router, you may need to manually allocate the IP address for your Ethernet shield and/or set the DNS server to use. To do this, scroll down to

where you can change the useDHCP and/or useDNS variables to false, and update those values below. However if you’re not sure, just leave them be unless you need to change them. Finally – upload the sketch to your Arduino, get the hardware together and plug it into the network.

Watch your status LED – it will blink a number of times, depending on the status of things. The blink levels are:

  • 1 blink – initialising
  • 2 blinks – starting network connection
  • 3 blinks – connecting to the Teleduino server
  • 4 blinks – authentication successful
  • 5 blinks – session already exists for supplied key (sometimes happens after a quick restart – will work on next auto-restart)
  • 6 blinks – Invalid or unauthorised key – check your API key is correctly entered in the sketch as described earlier
  • 10 blinks – connection dropped

If all is well, after a minute yours should be on blink level 4, then it will idle back to blink level 1. Now to test the connection with our first command.

You send commands to the Arduino using a set of URLs that will contain various parameters. You will need your API key again for these URLs which is then inserted into the URL. The first will report the version of software on the Arduino. Send

however replace 999999 with your API key (and in all examples shown here). If successful, you should see something similar to the following in the web browser:

However if something is wrong, or there are connection difficulties you will see something like:

Before using digital outputs, and after every reset of the Arduino) you need to set the pin mode for the digital output to control. In our example, we use:

Note that the pin number and mode are set with single digits, as you can see above this is for pin 6, and we use mode=1 for output. You should save this as a bookmark to make life easer later on. When the command has been successfully sent, a message will be shown in the webpage, for example:

Moving forward – you turn the digital output on with the following:

and to turn it off, set the final part of the URL to

Easy. How did you go? It really is amazing to see it work. Now you can control your Arduino from almost anywhere in the world. Again, saving these as bookmarks to make things easier, or a URL shortening service.

At this point you should now have the gist of the Teleduino service and how it is operated.

There is so much more you can do, and currently the list includes (From the author):

  • Reset, ping, get version, get uptime, get free memory.
  • Define pin modes, set digital outputs, set analog outputs, read digital inputs, read analog inputs, or read all inputs with a single API call.
  • Define up to 2 ‘banks’ of shift registers. Each ‘bank’ can contain up to 32 cascaded shift registers, giving a total of 512 digital outputs.
  • Shift register outputs can be set, or merged, and expire times can be set on merges (you could set an output(s) high for X number of milliseconds).
  • Define, and read and write from serial port.
  • Read and write from EEPROM.
  • Define and position up to 6 servos.
  • Set preset values for the above functions, which get set during boot. Preset values are stored in the first 160ish bytes of the EEPROM.

[22/09/2012] New! You can also control the I2C bus – check out this tutorial for more information. For more information check the Teleduino web site, and further tutorials can be found here. Here is a simple example of Teleduino at work – controlling a light switch:

Conclusion

At this moment Teleduino is simple, works and makes a lot of ideas possible. We look forward to making more use of it in future projects, and hope you can as well. Kudos to Nathan Kennedy, and we look forward to seeing Teleduino advance and develop over the future. If all this Arduino is new to you, check out the tutorials.  Thanks to Freetronics for the use of their Ethernet-enabled hardware.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

The post Interact with Arduino over the Internet with Teleduino appeared first on tronixstuff.



  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook