Hi,
I've just built up an OKG base according to the instructions with Wiznet 5200
http://wiki.openenergymonitor.org/index.php?title=Open_Kontrol_Gateway#Using_OKG_with_Wiznet_W5200
I have a enonTx running and have confirmed that the OKG is getting the Power data by commenting out the ethernet setup in the example shield.
I'm not sure what to do next !
With the full sketch running I get the following on the serial monitor:
openenergymonitor.org RFM12B > OKG > Wiznet, > emoncms
Failed to configure Ethernet using DHCP
Local IP address: 224.129.181.55.
Node: 15 Freq: 868Mhz Network: 210
Cant connect to send data
Cant connect to send data
Cant connect to send data
Cant connect to send data
Cant connect to send data
Cant connect to send data
Cant connect to send data
Cant connect to send data
Cant connect to send data
Cant connect to send data
This is repeated every 8 seconds due to the watchdog I presume.
I would like to display my power data on the Emoncms.org dashboard.
Thanks
Paul
Re: OKG getting started.
Register with emoncms.org and get your APIkey.
Then reinstate the Ethernet part of the sketch. You need to put your own settings into the constants. mac must be unique on your local net, the rest are my ISP's/my router's, you'll get yours from your router:
byte mac[] = {0x00, 0x14, 0xa4, 0x23, 0xa4, 0x3c };
byte dnsserver[] = {212,159,6,10}; // DNS Server
byte gateway[] = {192, 168, 1, 254}; // Gateway
byte dnss[] = {212,159,6,10}; // DNS Server
byte subnet[] = {255, 0, 0, 0}; // Subnet mask
Put your APIkey into the character strings - without the [ ] :
char apiurl[] = "http://emoncms.org/api/post.json?apikey=[YOURAPIKEY]";
char timeurl[] = "http://emoncms.org/time/local.json?apikey=[YOURAPIKEY]";
Re: OKG getting started.
Hi Robert,
Thanks for the reply.
Excuse my ignorance, I am using the example sketch:
https://github.com/openenergymonitor/Open-Kontrol-Gateway/blob/master/OKG_Wiz5200_RFM12B_emoncms/OKG_Wiz5200_RFM12B_emoncms.ino
could you point out exactly what I need to change from the ethernet settings.
Also how do I find out my
byte mac[] = {0x00, 0x14, 0xa4, 0x23, 0xa4, 0x3c };
byte dnsserver[] = {212,159,6,10}; // DNS Server
byte gateway[] = {192, 168, 1, 254}; // Gateway
byte dnss[] = {212,159,6,10}; // DNS Server
byte subnet[] = {255, 0, 0, 0}; // Subnet mask
settings.
Thanks in advance
Paul
Re: OKG getting started.
I get exactly the same with that sketch - and now the sketch I lifted those settings from doesn't work either! There's something else that has changed ... I'm working on it.
Re: OKG getting started.
OK, I've located my problem - the "special" Ethernet and JeeLib libraries for the OKG had got overwritten when I updated the Arduino IDE. If that's your problem too, details and links are in Modules - emonBase -Open Kontrol Gateway.
The total changes to the file you linked to:
RF frequency,
mac (Choose one that does NOT exist on your local network)
apikey - in two places, apiurl & timeurl
and you also need to change apiurl to
char apiurl[] = "http://emoncms.org/input/post.json?apikey=YOUR-API-KEY";
You can ignore everything I wrote earlier as you're starting from a different place.
Re: OKG getting started.
Thanks for your reply Robert,
Unfortunately I've tried all that and still get the same result on the serial monitor. Any other ideas?.
Paul
Re: OKG getting started.
Can we go through what you have done so far:
1. You've registered with emoncms.org and got an APIkey.
2. You've built your OKG base and done the reset mod.
3. You've thrown away the Ethernet library that came with your Arduino IDE, and any Jeelib library you'd previously downloaded, and replaced them with the special ones downloaded from the links on the our OKG page download from OpenEnergyMonitor GitHub. (And you must have restated the IDE since installing the libraries, they are only read - or at least recognised - on startup of the IDE. All instances of the IDE must be closed.)
4. You've plugged your API read/write key into the sketch, and changed the other things I mentioned (not that this would prevent you connecting to the Internet).
How are you powering your OKG - 5 V via the coaxial d.c. connector?
Note the FTDI connector parallels the 5 V and 3.3 V lines, so if your programmer gives 5 V, you must NOT close the optional link to power it from the FTDI programmer as this over-volts the Wiznet adapter.
Is your router blocking it?
Re: OKG getting started.
Hi Robert,
As far as I know I have done all mentioned in 1,2,3,4 and powered the OKG from the 5V dc connector. ( I don't have the link fitted).
How do I know if my router is blocking it?. it is a TalkTalk D-Link.
Is there anything I can do to confirm that the ethernet is working?.
Paul.
Re: OKG getting started.
How do I know if my router is blocking it?. it is a TalkTalk D-Link.
I don't know your router. All I can suggest is you go thought the router setup pages and check to see if there is anything that looks as if it might stop it, for example a list of permitted/restricted IP/MAC addresses, firewalls and the like.
Is there anything I can do to confirm that the ethernet is working?.
I suspect the Ethernet connection isn't working, and I have found no information that can even tell me how to find out why. All I've been able to find is "This works for me".
I've got to repeat that with the wrong libraries, a sketch that was known to work failed, apparently in exactly the same way as you describe. Now it's working, I see on the Wiznet Ethernet socket a continuous orange LED, and a green LED that goes out for each message whichever the direction. (If I sabotage the special libraries and restore the original ones, I get both LEDs on continuously. And in doing this test, I discovered that the libraries need to be deleted - renaming the directory isn't enough.) On my router (a BT/Thompson), I see, listed under devices:
WIZnet213032 192.168.1.66
The IP address is allocated by the router, the 6 digits after WIZnet are the last 6 of the MAC address you gave it. But of course if it isn't connecting, you won't get this far even.
Edit: You do have DHCP turned on, in your router?
If none of that helps, we'll ask Glyn or Trystan for help, because I've run out of ideas.
Re: OKG getting started.
Thanks for the tips,
I erased the old re-named libraries anr re-compiled. Now when powered up there is quite a long delay before the below appears on the monitor:
Failed to configure Ethernet using DHCP
Local IP address: 192.168.1.99.
Node: 15 Freq: 868Mhz Network: 210
Cant connect to send data
Cant connect to req time
Cant connect to send data
Cant connect to send data
Cant connect to send data
Cant connect to send data
Cant connect to req time
Cant connect to send data
Cant connect to send data
Cant connect to send data
Cant connect to send data
Cant connect to req time
Cant connect to send data
Cant connect to send data
Cant connect to send data
Cant connect to send data
Cant connect to req time
Cant connect to send data
Now the watchdog is not resetting every 8 seconds and the ethernet leds are behaving as you mentioned ie. orange on and green flashing. Progress in a way I think!
BTW I have no time data being broadcast so I would not expect to see that anyway, I presume it would work with just the 4 power values.
Paul.
Re: OKG getting started.
Progress:
I re-loaded the original example and updated the two API keys, increased the line char line_buf[512 (was 50) ]; and updated the line if (strcmp(line_buf,"ok")==0) to if (strcmp(&line_buf[pos-2],"ok")==0)
I now get:
disconnecting.
Sent: {rf_fail:0,power1:675,power2:0,power3:0,voltage:24078}
disconnecting.
Sent: {rf_fail:0,power1:691,power2:0,power3:0,voltage:24085}
disconnecting.
Sent: {rf_fail:0,power1:680,power2:0,power3:0,voltage:24077}
disconnecting.
Sent: {rf_fail:0,power1:674,power2:0,power3:0,voltage:24075}
So I assume I am now outputing the values to the ethernet.
One last hurdle I think, How do I see the values on Emoncms. I've setup a couple of inputs but they come up as inactive.
Paul.
Re: OKG getting started.
That does indeed look as if data is getting out. If you go back to your emonTx, you gave it a Node number (probably 10, it's not 15 because that is your OKG).
Did you set up Inputs or Feeds?
You should have under Input a "Node 10". Click + to expand that and your inputs should be there, in the order they are in PayloadTX: power1, power2, power3, voltage. The names are "1", "2" etc which you can't change, but you can click the pen icon to add a description "Power 1" maybe, etc. Click the tick when done. If you click the spanner icon, the easiest thing is Log to Feed, give the feed a name and "create new" (or send it to an existing feed if that's what you made earlier) and click "add". When you've done that it should show up on the feeds page.
(Mine works fine with line_buf[50] ! )
&line_buf[pos-2] means that the headers aren't being parsed out correctly! Maybe your router is stripping something out - or adding something. Or might it be your ISP? Weird. I'll bounce that one off G&T.
Re: OKG getting started.
I Only put this in as i saw It on some post somewhere if (strcmp(&line_buf[pos-2],"ok")==0)
It may not be correct.
When i look at the input screen of emoncms i only get the message no inputs created. Should they just appear?
Also i noticed that the api key is slightly different in the feed screen compared to the input screen, which should i use?
Thanks Paul
Re: OKG getting started.
It may not be correct. I think that is right - it should not be correct! The incoming data is parsed and copied such that "ok" is all there is in the string. I'd need to work through parsing the headers again to check whether the two are equivalent.
But that won't affect data getting into emoncms - but it will cause the OKG to think the data didn't get through and reset.
i only get the message no inputs created. Should they just appear? Yes they should.
Also i noticed that the api key is slightly different in the feed screen compared to the input screen, which should i use?
I don't believe you - it might be masked by the size of the window but if you click somewhere on the key and do [ctrl]+[A] then [ctrl]+[C] you should have the same key wherever you get it from. DO use the read & write key, not the read-only one. A wrong APIkey will mean your data is refused, so that might explain why "No inputs created".
Re: OKG getting started.
Ahhh.... I was using the read API key.
I am now getting values in Emoncms. It took quite a while for the inputs to appear after resetting the OKG 2 mins say.
Thanks again for spoon feeding me through this process!!
Much appreciated.
Paul
Re: OKG getting started.
Phew ! ! ! I'm glad you got there in the end.
I'll bet you can put line_buf back as it was now.