[srejbi] shares a new, programming-free, API-based way to programming Arduino: the APDuino project (minimum hw requirements: Arduino Mega 2560 + W5100 EtherShield). The Apduino relates to a peculiar approach towards Arduino that I noticed in the last years: using Arduino and making things without coding. This is a good thing for people that can’t code, but has to be simpler than learning code itself.
The APDuino Project provides a turn-key software solution for building custom monitoring and automation systems with custom rulesets (featuring expression evaluator with access to sensor and control arrays), cron-like scheduler, remote access and management via HTTP, SD and online logging and more…
All *without* programming (if using supported hardware components) … allowing DIY’ers to build their own automation systems much quicker and easier.
– The image collage attached is showing parts of 1 realization I built (I have 4 completely different systems running, all using the same software ) — This one pictures an aquaponics monitoring system with 16 physical sensors (lots of 1-wire DS18B20′s chained, DHT-11, photoresistors, HY-SRF05 with mechanically inverted reading surface providing tank level monitoring, radio-controlled sockets allow pump and fan controls).
Other systems feature components such as vibration detector, pH probe, BMP085,DS1307 RTC.
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
You will need an Arduino Uno (or compatible) board and Ethernet shield with the Wiznet chip – or a Freetronics EtherTen (a much neater solution). At this stage Teleduino doesn’t support other boards such as the Mega.
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.
Request an API key. This identified your particular Arduino from the rest.
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.
Don’t forget the ethernet cable from your Arduino stack to the router!
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
TeleduinoEthernetClientProxy.ino
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:
… 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
// User configurable variables
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
output=0
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.
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 twitter, Google+, 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.
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
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.
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.
Request an API key. This identified your particular Arduino from the rest.
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.
Don’t forget the ethernet cable from your Arduino stack to the router!
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.
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 twitter, Google+, 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.
Planet Arduino is, or at the moment is wishing to become, an aggregation of public weblogs from around the world written by people who develop, play, think on Arduino platform and his son. The opinions expressed in those weblogs and hence this aggregation are those of the original authors. Entries on this page are owned by their authors. We do not edit, endorse or vouch for the contents of individual posts. For more information about Arduino please visit www.arduino.cc
You are currently browsing the archives for the api category.