fails to connect to emoncms.org

Hi,
I'm stucked on a problem since several days and I cannot find a solution.
I need to connect the Industruino D21G with ethernet module to EmonCms.
Unfortunately, I don't succeed in connecting to "emoncms.org" neither using url nor the ip address.

I used as reference the example reported here: https://industruino.com/blog/our-news-1/post/4-20ma-sensor-4
(I use ethernet2 library because the industruino is D21G model)

note that, in comparison with the above mentioned example sketch, the ip address I tried to use for emoncms is different:
it is 80.243.190.58 that corresponds to http://emoncms.org and works fine in a test I didi with esp8266.
in fact, the one used in the example (213.138.101.177) is not reachable in any way, not only by industruino connection but also using ping from my pc.

Can anybody help me?
thank you in advance.

Giancarlo Bacchio
Giancarlo Bacchio
4
| 1 1 1
Asked on 8/20/18, 4:45 PM
0
vote
2179 Views

Hi Tom,
Thank you for your prompt reply.
Yes, I use your fork for ethernet2 library.
Yes, I can connect to others sites (www.google.com, www.emoncms.org)
Yes, I already use the lines you suggest to connect to emoncms.org.

The problem, is with the first line: "client.connect("emoncms.org", 80)"
after few seconds stuck, the function returns "0" i.e. fail to connect.
As I wrote, I tried also using the IpAddress (80.243.190.58 ) instead of the URL, but with the same result.
please, find here the code I wrote.
https://github.com/Gianbacchio/Industruino-EmonCms-test/blob/master/emon_test1.ino

Giancarlo Bacchio
Giancarlo Bacchio
4
| 1 1 1
Answered on 8/21/18, 8:24 AM
0
vote

Hi Giancarlo, i assume you are using our fork of the Ethernet2 library as https://github.com/Industruino/Ethernet2 and you are able to connect to other web servers. For EmonCMS it seems the API has changed since that 2015 blog post, you can use these lines:

  if (client.connect("emoncms.org", 80)) {     // for emoncms.org

 

    client.print("GET /input/post.json?apikey=");      // for emoncms.org
    client.print(APIKEY);
    client.print("&node=");
    client.print(NODE_ID);
    client.print("&json={temp:");

 

 

 

Tom
Tom
5675
| 1 1 3
Answered on 8/20/18, 11:46 PM
0
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

46 follower(s)

Stats

Asked: 8/20/18, 4:45 PM
Seen: 2179 times
Last updated: 8/21/18, 8:24 AM