Help Needed getting NodeRF & Emoncms Talking

Hi I am hoping someone can help me get my NanodeRF & EmonCMS talking. I have spent some time reading the forum but unfortunately I have not progressed.

I have built my EmonTX & EmonGLCD and they seem to be working fine however I am having problems receiving data through my local EmonCMS server via my NanodeRF base station.

Firstly following an upload of "NanodeRF_Power_RTCrelay_GLCD.ino" to my base station I was expecting to see the red LED start blinking every 2 seconds. The Red LED however stays fixed and only blinks every time the serial port starts a new cycle beginning with  [webClient]

My EmonCMS does not update when Data arrives into the NanodeRF base nor does the EmonGLCD receive time updates back the other way.

These are my setting changes for the NanodeRF_Power_RTCrelay_GLCD.ino file
//--------------------------------------------------------------------------
// Ethernet
//--------------------------------------------------------------------------
#include <EtherCard.h>  //https://github.com/jcw/ethercard

// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x42,0x31,0x42,0x21,0x30,0x31 };
//Unchanged

// 1) Set this to the domain name of your hosted emoncms - leave blank if posting to IP address
char website[] PROGMEM = "";     //Blanked

// or if your posting to a static IP server:
static byte hisip[] = {10,0,0,115};
//This is the IP of my Local Host which runs the Emoncms server.

// change to true if you would like the sketch to use hisip
boolean use_hisip = true; 
//I assume I set this to true to utilize my EMONCMS Server running on 10.0.0.115.

// 2) If your emoncms install is in a subdirectory add details here i.e "/emoncms3"
char basedir[] = "/wamp/www/emoncms /";
// Not sure what I should put here. My files exist here C:\wamp\www\emoncms. Will my entry work?

// 3) Set to your account write apikey
char apikey[] = "46c34bc2833697e8d856175f7be36f3e";

Monitoring the Serial Port I see the following

[webClient]
DHCP status: 1
IP:  10.0.0.99

This confuses me since I thought this should be the address of my local server. In my case 10.0.0.115. This seems to be a DHCP assignment for the NanodeRF Card is this correct?

GW:  10.0.0.138
DNS: 8.8.8.8
Data sent: /wamp/www/emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:1}

emonTx data rxData sent: /wamp/www/emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:31,power2:0,power3:0,voltage:3293}
emonGLCD temp recv: 1950

emonTx data rxData sent: /wamp/www/emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:32,power2:0,power3:0,voltage:3293,temperature:19.50}

emonTx data rxData sent: /wamp/www/emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:31,power2:2,power3:0,voltage:3293}

emonTx data rxData sent: /wamp/www/emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:32,power2:0,power3:0,voltage:3293}

emonTx data rxData sent: /wamp/www/emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:32,power2:0,power3:0,voltage:3293}
Time request sent

emonTx data rxData sent: /wamp/www/emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:36,power2:3,power3:0,voltage:3293}

emonTx data rxData sent: /wamp/www/emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:31,power2:0,power3:0,voltage:3293}

emonTx data rxData sent: /wamp/www/emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:33,power2:0,power3:0,voltage:3293}

emonTx data rxData sent: /wamp/www/emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:32,power2:0,power3:0,voltage:3293}

emonTx data rxData sent: /wamp/www/emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:32,power2:0,power3:0,voltage:3293}

The Whole process then repeats and my Red LED Flashes at this point
[webClient]
DHCP status: 1
IP:  10.0.0.99
GW:  10.0.0.138
DNS: 8.8.8.8

Note I have temporarily turned off my firewall and I can get to my local Emoncms server from a different PC on my network by entering 10.0.0.115/emoncms in a browser
If I click
http://localhost/emoncms-master/input/post.json?node=1&csv=100,200,300
on the Input api page I see my feeds get an update so I believe my server is functioning.
Can anyone see what I am doing wrong?

Cheers 

Martin

Robert Wall's picture

Re: Help Needed getting NodeRF & Emoncms Talking

You have a wrong directory setting. What you want is the directory as seen from the web side, not the machine side, viz

char basedir[] = "emoncms/";

(and there should be no space before the '/')

I've found the safest is to instruct your router to use a static IP address for the NanodeRF, and use that rather than allowing DHCP to assign one.

Other than that, it all looks OK. (Unless I've missed something).

The red LED is turned on when the data is sent out, and turned off when emoncms replies "ok". So even if the data is getting through, the reply still needs to get back, or the LED stays on and eventually the timeout resets everything, which is what is happening at the moment.

Martin's picture

Re: Help Needed getting NodeRF & Emoncms Talking

Thanks Robert.

I have corrected my directory setting and now seem to be getting Time Updates to my EmonGLCD however my local EmonCMS still cant pick up the data being sent.

I have configured my router to allocate the same IP for the NanodeRF now so it should no longer be DNS assigned.

I can manually send input data from a different pc to my server which is seen by my current EmonCMS setup.

I notice that if I send

http://localhost/emoncms/input/post.json?node=1&csv=100,200,300 the data gets through. 

If I try any of the other example JSON post data commands my server responds with ok but the data does not arrive on the feed page.

Do you have any other thoughts as to where my problem may lie?

Thanks again

Martin

 

My adjusted settings

// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x42,0x31,0x42,0x21,0x30,0x31 };

// 1) Set this to the domain name of your hosted emoncms - leave blank if posting to IP address
char website[] PROGMEM = "";

// or if your posting to a static IP server:
static byte hisip[] = { 10,0,0,115 };

// change to true if you would like the sketch to use hisip
boolean use_hisip = true; 

// 2) If your emoncms install is in a subdirectory add details here i.e "/emoncms3"
char basedir[] = "/emoncms";

// 3) Set to your account write apikey

char apikey[] = "46c34bc2833697e8d856175f7be36f3e"; 

My Current Serial Output

[webClient]
DHCP status: 1
IP:  10.0.0.106
GW:  10.0.0.138
DNS:8.8.8.8
Data sent: /emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:1}

emonTx data rxData sent: /emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:178,power2:6,power3:0,voltage:3293}

emonTx data rxData sent: /emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:166,power2:4,power3:0,voltage:3293}

emonTx data rxData sent: /emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:175,power2:6,power3:0,voltage:3293}

emonTx data rxData sent: /emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:164,power2:6,power3:0,voltage:3293}
emonGLCD temp recv: 1712

emonTx data rxData sent: /emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:173,power2:7,power3:0,voltage:3293,temperature:17.12}
Time request sent
Time: t09,54,58  //This Now Works

emonTx data rxData sent: /emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:166,power2:9,power3:0,voltage:3293}

emonTx data rxData sent: /emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:173,power2:4,power3:0,voltage:3293}

emonTx data rxData sent: /emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:167,power2:9,power3:2,voltage:3293}

emonTx data rxData sent: /emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:175,power2:3,power3:0,voltage:3293}
emonGLCD temp recv: 1712

emonTx data rxData sent: /emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:0,power1:167,power2:3,power3:0,voltage:3293,temperature:17.12}

[webClient]
DHCP status: 1
IP:  10.0.0.106
GW:  10.0.0.138
DNS: 8.8.8.8
Data sent: /emoncms/api/post.json?apikey=46c34bc2833697e8d856175f7be36f3e&json={rf_fail:1} //Still getting a fail here.
 

 

Robert Wall's picture

Re: Help Needed getting NodeRF & Emoncms Talking

That is your read & write apikey, not the read-only one? (because if you're getting the time back, the time request is getting through but that responds to either apikey).

What do you have on the Input page? The inputs should pop up there automatically and it's from there you send them on to the Feeds page.

[EDIT]

Argh!  I missed that one: Your syntax is wrong. The new emonCMS only responds to

/emoncms/input/post.json......

.... api/post .... was OK for the old version. (I'll flag that to G&T - you got your example from Github, didn't you! The example on the emonCMS API help page is correct.)

Martin's picture

Re: Help Needed getting NodeRF & Emoncms Talking

Excellent! Thanks Robert I did indeed grab my files from Git Hub. Is there a better place to grab them from?

I now have NanodeRF_Power_RTCrelay_GLCDtemp working. I have (as you spotted)  replaced the term api with input in

line 195

str.print(basedir); str.print("/input/post.json?");             //*************  removed api and replaced with local

and Line 225

str.print(basedir); str.print("/input/post.json?");

I left my api key as the Read/Write version as the Read only version did not allow posts to my server.

My server is now happily logging data. I really appreciate your help, 

 

Robert Wall's picture

Re: Help Needed getting NodeRF & Emoncms Talking

"I did indeed grab my files from Git Hub. Is there a better place to grab them from?" No, that's the only place for a complete sketch. The new emonCMS was only recently released, and the Github examples hadn't been updated. I've emailed Glyn & Trystan so they should be on the case soon.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.