Step 4: Upload Sketch to the Arduino

Now for the moment we've all been waiting for. Time to make some magic happen and upload the Teleduino sketch to your Arduino.

Please note that the unique API key from Step 1 is required to proceed.

Open up the Arduino IDE. Click 'File' -> 'Examples' -> 'Teleduino328' -> 'TeleduinoEthernetClientProxy'. This will open up the sketch that we'll be using.

Near the top of the file you'll see some network configuration variables. If you're feeling adventurous you can play with these, but the default should work fine. The only thing we recommend changing is the MAC address declaration, even if it's just a matter of changing the last byte to something like 0x01. MAC addresses must be unique on your network (which is why we recommend you change it from the default). If you are setting up two or more Teleduino devices, you must ensure their MAC addresses are different.

The one thing that must be set is the unique key. See the attached image as a reference. By default they are set to a bunch of zeros. To make it easier, when you receive your unique API key, you'll also receive a URL to a tool which outputs your key in a format that can be copied and pasted into the sketch.

Once your key is set, connect your Arduino (if you haven't already), ensure the correct serial port is selected, and click 'Upload'. All going well the sketch will compile and upload.

I just wanted to say that you can download an early version of Teleduino Controller for Android devices on Google Play :<br> <a href="https://play.google.com/store/apps/details?id=appinventor.ai_ssslzc.Teleduino_Controller" rel="nofollow">https://play.google.com/store/apps/details?id=appinventor.ai_ssslzc.Teleduino_Controller</a><br> <br> And like the info says, if you miss any functions please contact me and I will try to add it in future releases.
<p>Have you tried to link it through wifi instead of eathernet </p>
Hi oalharbi3. It's not officially supported (yet), but I understand that people have successfully adapted it to work with the wifi shield. The methods for the Wifi shield are a close match to the ethernet shield so it should be too difficult. We're currently developing an improved library with support for a far greater range of boards, including the ESP8266 and the Raspberry Pi. Please stay tuned!
<p>hi, </p><p>when I run the compilation of the sketch this message:</p><p><strong>Tama&ntilde;o binario del Sketch: 28.978 bytes (de un m&aacute;ximo de 28.672 bytes)</strong></p><p><strong>processing.app.debug.RunnerException: Sketch demasiado grande; ver <a href="http://www.arduino.cc/en/Guide/Troubleshooting#size" rel="nofollow"> http://www.arduino.cc/en/Guide/Troubleshooting#si...</a> para consejos de como reducirlo.</strong></p><p><strong>at processing.app.Sketch.size(Sketch.java:1653)</strong></p><p><strong>at processing.app.Sketch.build(Sketch.java:1586)</strong></p><p><strong>at processing.app.Sketch.build(Sketch.java:1562)</strong></p><p><strong>at processing.app.Editor$DefaultRunHandler.run(Editor.java:1899)</strong></p><p><strong>at java.lang.Thread.run(Thread.java:619)</strong></p><p><strong><br></strong></p><p><strong>arduino software version 1.0.6</strong></p><p><strong><br></strong></p><p>what i am doing wrong?</p><p>thanks</p><p><strong><br></strong></p>
<p>Hi Carlos, you are compiling a little bit big program than your device is made for. You have to reduce some sentences or avoid some routines.</p><p>Bye.</p>
<p>I keep getting the following error message:</p><p>Teleduino328EthernetClientProxy.ino:15:26: fatal error: Teleduino328.h: No such file or directory</p><p>compilation terminated.</p><p>Error compiling.</p>
<p>It's a very good idea, but it's to much instable.... You could send also on the serial monitor the connection status, not only on the led (pin 8)</p>
<p>hi, can anyone tell me how to use set serial, get serial, define serial and flush serial?? what im trying to do is that i want my teleduino to read the serial (im using mega 2560). i tried to define it first, then get serial but i get only empty. i dont know if i did it wrong or what. can help? or send me tutorial link for that. thanks</p>
<p>I was able to get the first URL to work, but the second and all related to LED control on next steps give me the following error message.</p><p>{&quot;status&quot;:400,&quot;message&quot;:&quot;Invalid request syntax. Visit http:\/\/www.teleduino.org for protocol reference.&quot;,&quot;response&quot;:[]}</p><p>I input the string you reference with my key inserted as show below (and shown in quotes so you can see the syntax)</p><p><a href="https://us01.proxy.teleduino.org/api/1.0/328.php?k=E388CF5348746D3951FC80C3E198759&r=getUptime" rel="nofollow">https://us01.proxy.teleduino.org/api/1.0/328.php?k...</a></p><p>&quot;https://us01.proxy.teleduino.org/api/1.0/328.php?k=E388CF5348746D3951FC80C3E198759&amp;r=getUptime&quot;</p><p>Any ideal what I can do to correct this?</p>
<p>Hello,</p><p>Need help. The link LED on the W5200 ethernet shield is always red. The Led on pin 8 blinks: 1, 1-2. That is all that is happening. Please assist in resolving. Thank you.</p>
<p>Excuse me why my UNO LED just blink 6 times....</p><p>and manage presets say <strong>Key is offline or invalid.</strong></p><p>I had changed 3 keys... </p>
<p>Hello! I have this problem: Everything works well until the power is in charge of Arduino. But if you turn the power off and back on, the connection to the server Teledyne not happening! The led is burning. If you press the reset button on the Board, then everything begins to work as it should! What you need to do to when power is turned off,then I could then press the button on the Board. Thank you!</p>
<p>Can new values for variables (as set temps in a thermostat) be sent to the Arduino?</p>
<p>The ethernet shield is based on the W5100 ic. By any chance, was anyone able to make teleduino work using the much cheaper ENC28J60 ethernet controller chip?</p>
<p>got {&quot;status&quot;:403,&quot;message&quot;:&quot;Key is offline or invalid.&quot;,&quot;response&quot;:[]} this msg..help me out kindly...</p>
<p>Hi ikumar5,</p><p>This message means one of two things. First off, please check to ensure that the key you're using is correct. Secondly, please check that your device is connecting successfully. Have you attached an LED to pin 8 to read the status output? This will provide clues as to whether or not the device is connecting to the server ok.</p><p>Hope that helps!</p>
thanx nathen it worksn one more thing am using teleduino cotroller app i want to read a sensor data but i am getting struck with that stuf could u help me how to read a data through the app..https://play.google.com/store/apps/details?id=appinventor.ai_ssslzc.Teleduino_Controller_Pro&amp;hl=en_GB this is tha app
<p>Hi ikumar5,</p><p>Great to hear you got it up and running. In regards to your question about the Teleduino Pro app, it's written by a third party and is not directly related to the Teleduino project. Please contact the author of the app with any questions. Thanks!</p>
<p>Hi, I have a strange problem. Initially everything was looking good, but suddenly the board does not complete the login. It stops after three flashes of the status LED. Regardless of this I get response when i send an instruction.</p><p>I even get an OK response when i have unplugged the board!!!</p><p>The response looks like this:</p><p>{&quot;status&quot;:200,&quot;message&quot;:&quot;OK&quot;,&quot;response&quot;:{&quot;result&quot;:1,&quot;time&quot;:0.042306900024414,&quot;values&quot;:[]}}</p><p>I get this regardless of which instruction I send.</p><p>In this case I asked for &quot;getAllInputs&quot;...</p><p>Any ideas on how this can happen?</p><p>Regards from Leif in Sweden</p>
<p>Hi Leif,</p><p>This is definitely strange. I suspect the response you're seeing is a result of a browser cache? It should definitely not return 'OK' if the device is not connected.</p><p>Failing after 3 flashes indicates that your device is failing to connect to the server. I would suggest trying a different MAC address (so that your router will see it as a new device), and possibly even trying changing the serverPort value in the sketch (the server listens on ports 53 and 5353).</p><p>If you continue to experience trouble, feel free to contact me directly for further diagnosis.</p>
can any one help me please ?? <br> <br>i wont to use arduino in my project .. <br>i wont ardino send alarm to my androin phone 'by internet ' whin the Bell home is ring <br>What are the pieces that will I need ?? <br>remember by internet no IRir no blotooth <br>thank you
Hi <br>Cant upload the sketch to the arduino rev 3 <br>error say: <br>teleduino was not declared in this scope <br> <br>what i am doing wrong? <br> Thanks
fix it,it was not in right dir. <br>Load up ok now. <br>Next i change the mac address and copy the coded key in place of the zeros. did not change any of the ip numbers or subnet. <br> but now i cant connect to: <br>https://us01.proxy.teleduino.org/api/1.0/328.php?k={key}&amp;r=getVersion <br>and yes i change the key. <br>I know it me lol i am realy new in arduino but love to have this working <br> <br>Regards Lope 12
Hi All. <br>Forget all my questions ask. <br>it works like a champ now. <br>i did all ok but ms explorer dont display the text from server, just want me to download or open it. <br>Use chrome now and all works like it should. <br> <br>Perfect Thanks <br>Regards Lope
Hi Lope, <br> <br>Thanks for the confirmation. Great to hear you got it working! <br> <br>Thanks, <br>Nathan.
Hi Lope12, <br> <br>That error would occur for one of two reasons: <br>1) The library is not in the correct libraries folder, or <br>2) The Arduino software was not restarted after copying the library into the libraries folder <br> <br>Let me know if you continue to have trouble after checking those two points. <br> <br>Thanks! <br>Nathan
Sorry I forgot the error message. &quot;Website Declined to show this Webpage&quot; <br>Most likely cause - Website requires you to log in<br><br>What should I see if I can get to site?<br><br>Do you know of a customisable webpage that will work with Teleduino to give realtime feedback on input/outputs &amp; allow remote readings and configuration?<br>The reason I ask is I would like to remotely monitor voltages of a battery bank, get alerts when issues arise &amp; even start/stop a generator if solar input is too low.<br><br>Cheers,<br>Bruce
Hi Bruce, <br> <br>If you use a different browser (such as Google Chrome), or turn off the friendly HTTP error pages in Internet Explorer then you should be able to see the response in full. <br> <br>I know of people that have successfully integrated with Cosm and ThingSpeak, as well as custom applications for doing monitoring and control. There is also an unofficial Android app available to operating your Teleduino.
Where can I download the sketch? I can't see a link in the Instructable. <br>Thanks, <br>Bruce
Hi Bruce.<br> <br> Thanks for the comment. Once you've installed the library (Step 3) and restarted the application, the sketches are listed under the examples.<br> <br> <em>Open up the Arduino IDE. Click 'File' -&gt; 'Examples' -&gt; 'Teleduino328' -&gt; 'TeleduinoEthernetClientProxy'. This will open up the sketch that we'll be using.</em><br> <br> Thanks!
Hi Nathan,<br><br>Thanks for clarifying that. I can now see the TeleduinoEthernetClientProxy in Examples. I opened sketch and loaded my Teleduino code that I got from their site.<br>I did not change any other settings. I the plugged Arduino Uno Ethernet shield into my ADSL2+ router which is connected to Internet.<br><br>I copy &amp; pasted the Teleduino URL shown in Instructable inserting my key (the original one, not the one generated to enter into sketch.<br>When I enter on this https://us01.proxy.teleduino.org/api/1.0/328.php?k={F06EB5D9B8CFF1C5972CAA934E89D53E<br>}&amp;r=getVersion I get error that can't show site.<br><br>Any idea why I can't connect to Teleduino? Could it be blocked by my Billion 7404VNPX router?<br>Cheers..Bruce
Hi Bruce. <br> <br>It sounds like you're seeing 'friendly HTTP status errors' in Internet Explorer. <br> <br>The underlying problem, however, is that your device is not connected to the Teleduino cloud service. Have you connected a status LED to pin 8? This will flash codes during startup which helps with troubleshooting.
Everything works as explained in the tutorials. Thanks for all the hard work developing this service. Would love more tutorials in the future if you ever find time. I do have one question. Not sure if I should ask here but I will anyway. I have two Teleduino's hooked up at the same time from two different ports from my router and they seem to conflict with each other. What steps would I take to eliminate this problem? Thanks again for unlimited future projects. Joe
Hi dslrmotion, <br> <br>Thanks for the kind words! <br> <br>There is no limit to how many devices you can run on the same network (and you can run them all with the same serverPort). You just need to ensure that the mac[] variable is different for each device, and if you're not using DHCP (it is enabled by default), then you'll need to set unique network settings for the device. <br> <br>Thanks!
Hi again, <br>I have tried many times and wonder about TeleduinoEthernetClientProxy sketch. <br>if i upload it as it is except replace the key, it works. But as i make some change even a single statement of declaring a variable e.g. int pin=4; it generate error of the following <br>{&quot;status&quot;:403,&quot;message&quot;:&quot;Key is offline or invalid.&quot;,&quot;response&quot;:[]}. if i remove the customize code it starts working again. Why is it exhibiting such behavior?
Hi siddiqov, <br> <br>Adding custom code shouldn't cause any problems unless it exceeds the devices flash memory or volatile memory (SRAM). <br> <br>The 403 is a response given by the server if either the key is incorrect or device has not connected to the server. <br> <br>If you're having trouble getting your device to connect to the server, I would recommend connecting a status LED to pin 8 and checking at which stage the connection is failing - this would help to find a solution. <br> <br>Thanks!
Hi NatahnKnz, <br>there is an example of fading. i want to run it through teleduino. but don't know how to do it. the example is using pin 9 for the LED, i can turn it on and off through teleduino but how to pass loop controlling variables. will be very grateful to you in this regards. <br>the code is here <br> for(int fadeValue = 0 ; fadeValue &lt;= 255; fadeValue +=5) { <br> // sets the value (range from 0 to 255): <br> analogWrite(ledPin, fadeValue); <br> // wait for 30 milliseconds to see the dimming effect <br> delay(30); <br> } <br> <br> // fade out from max to min in increments of 5 points: <br> for(int fadeValue = 255 ; fadeValue &gt;= 0; fadeValue -=5) { <br> // sets the value (range from 0 to 255): <br> analogWrite(ledPin, fadeValue); <br> // wait for 30 milliseconds to see the dimming effect <br> delay(30); <br>
Hi siddiqov,<br><br>Unfortunately fading is not natively supported in the standard Teleduino library.<br><br>You could, however, add the extra code to the library. The analogWrite function is being called at line 332 of the Teleduino328 library (version 328-0.6.7).<br><br>Thanks!
Thank you. how about if i send request to turn on PIN 4 and then in the loop i start checking in if(pin==0n){ then do my fading coding}else{do nothing} <br>OR <br>if (pin4==ON){ <br>set pin5 high <br>set pin6 high <br>delay();} <br>something like that. <br>is it possible to handle multiple pins while in one go. <br>Best regards
Hi siddiqov, <br> <br>An override like you've suggested should work fine. <br>If you just want to replicate the output of one pin to another, the following would probably work (untested): <br>digitalWrite(5, digitalRead(4)); <br>Just make sure you have the pin modes set to OUTPUT. <br> <br>Thanks, <br>Nathan.
Hi Nathanknz, <br>I used fade example for my two linear actuator to extract and retract simultaneously just like to open a box top at both ends and found that from pin 1-8 doesn't activating the linear actuators although i have checked with leds and serial monitors and both are showing that PINS are responding. but as i attached these linear actuators with pin 9 and on-wards, these are activating the actuators. just posting my stupid experiences to help someone who face same things in future. <br>
Hi NathanKnz, <br>I want to set more then one pin on for a specific time, but don't know how to do it in one go. there is a URL but only for only one pin like pin 4. <br>https://us01.proxy.teleduino.org/api/1.0/328.php?k=F37CF622F3DAE9AA3ACAE643177A93C7&amp;r=setDigitalOutput&amp;pin=4&amp;output=1&amp;expire_time=10000
Hi siddiqov,<br><br>Thanks again for your comments.<br><br>Your question was actually very well timed! In the current version of the firmware (328-0.6.7) you are not able to set multiple outputs with a single API call, but I'm currently testing the next version (328-0.6.8) which supports exactly that! It should be released within the next couple of weeks once I'm satisfied that it's tested out fine.<br><br>Setting multiple outputs on a shift register is already supported via a single API call, but requires further components.<br><br>Thanks!<br>Nathan.
Thank you Nathanknz, the problem in my case was an older version of arduino IDE. when i upgrade it to 1.0.1, every things went perfect.
Hi siddiqov, <br>Thanks for reporting back, and great to hear you got it working. Thanks for using Teleduino!
I uploaded the TeleduinoEhternetClientPoroxy sketch and set my key, obtained via email, but when i tried the following link <br>https://us01.proxy.teleduino.org/api/1.0/328.php?k=0D8554078235C27AD714A83F08D0DE31&amp;r=getUptime <br> got the following response <br>{&quot;status&quot;:403,&quot;message&quot;:&quot;Key is offline or invalid.&quot;,&quot;response&quot;:[]} <br> <br>please let me know where am i wrong. I am pasting my code where i have done sme changes <br>byte useDhcp = true; <br>byte useDns = true; <br>byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xAE, 0xED }; <br>IPAddress deviceIp(192, 168, 0, 100); // Only if useDhcp is false <br>IPAddress gatewayIp(192, 168, 0, 1); // Only if useDhcp is false <br>IPAddress dnsIp(192, 168, 0, 1); // Only if useDhcp is false <br>IPAddress subnet(255, 255, 255, 0); // Only if useDhcp is false <br>IPAddress serverIp(173, 230, 152, 173); // Only if useDns is false <br>char serverName[] = &quot;us01.proxy.teleduino.org&quot;; // Only if useDns is true <br>unsigned int serverPort = 5353; // Can be set to either 53 or 5353 <br>byte statusLedPin = 8; <br> <br>// User configurable key, this is used to authenticate with the proxy server <br>// This is checked against the EEPROM on boot and written if necessary <br>// The proxy server retreives the key from the EEPROM <br>byte key[] = { 0x0D, 0x85, 0x54, 0x07, <br> 0x82, 0x35, 0xC2, 0x7A, <br> 0xD7, 0x14, 0xA8, 0x3F, <br> 0x08, 0xD0, 0xDE, 0x31 }; <br>
Hi siddiqov, <br> <br>Looking at your code everything looks fine. The error your getting is most likely because something is preventing your device from connecting to the server (possibly firewall). <br> <br>You can try changing the serverPort variable to 53. If you continue to experience problems, take note of what status the status LED is indicating that you're getting up to. This will help to troubleshoot where the issue is. <br> <br>On a side note, you may want to request a new API key since you have published this one in a public forum :) Just fill in the form again and a new key will be sent to you. <br> <br>Thanks for trying Teleduino!
Thank you for the quick response, Nathanknz. I tried and attached the status LED with 1 k resistor and a new key. The LED didn't even a single flash, though there are many others build-in LED on Ethernet shield, some of them are blinking while two of them are constantly on. Moreover I checked the Status LED with simple Arduino LED sketch and it works. still getting the same error. <br>{&quot;status&quot;:403,&quot;message&quot;:&quot;Key is offline or invalid.&quot;,&quot;response&quot;:[]} <br> when i tried the following URL <br>https://us01.proxy.teleduino.org/api/1.0/328.php?k={MY KEY}&amp;r=getUptime <br> <br>i have tried with replacing 5353 with just 53 as well and get the status quo. <br>
Hi siddiqov, <br> <br>It's very bizarre that you're not getting anything on the status LED, because even if you didn't have the ethernet shield attached you should still at least see a status flash of '1 - pause - 2', and then it should eventually time out and fail and flash '2' for a while before it restarts and tries again. (1 flash means initialising, 2 flashes means establishing itself on the network). Have you definitely got the status LED connected to pin 8?
Thank you for your consistent replies. I just Noticed when i restart the teleduino, the status LED flash once and then immediately it flash two times (Flashes). Does it means it initialized and started network but couldn't connect to the server. I will appreciate your tips in this regards. I will appreciate your feed back.

About This Instructable


170 favorites


Bio: Developer of the telecontrol and telemonitoring system Teleduino, using the Arduino platform.
More by nathanknz: Control Servos over the Internet via Arduino with Teleduino Read Light Level over the Internet via Arduino with Teleduino Control a Relay over the Internet via Arduino with Teleduino
Add instructable to: