Hello Guys,
i am not an expert on programming with the arduino. I have built the emontx and emonbase. Now i have downloaded the scetches and arduino 1.0.1. And put the libraries on the right spot.
the libraries i have are downloded from this link
http://openenergymonitor.org/emon/modules/emontx/firmware
Now when i want to program the emontx.....WHAT do i do with the software arduino1.0.1?
I have tryied to open a sketch by going to 'file' 'open' then select emontx_lib.ino. When i want to verify it give me loads of errors.
I can though upload a 'example' from 'examples' -- 'openenergymonitorEmonLib' --'current_only'. This will upload without any problem.
so i know i am doing something wrong or forgot something....but i do not know what..
I cannot find a clear programming manual that clearly explaines how to do this and witch file to use or upload.
hope someone can help me.
thanks
Re: searching for good and clear programming manual
If I understand you correctly, you are trying to compile and upload the library?
The library is not designed to work on its own. It provides support to your sketch. The Arduino IDE ("arduino.exe") will find the libraries when you "verify" or "upload", pick out and combine those parts in the library that your sketch needs, and make one program out of the parts it has pulled together.
This why you can upload a sketch correctly:
It has found the libraries and linked them with your sketch.
Re: searching for good and clear programming manual
Robert, thank you for your reply, but i am still stuck. I understand your first part that arduino.exe has found my libraries. But i still do not know how to put the sketch in my emontx/emonbase.
for the emontx i only work with 2 x ct clamps. So i need to open the file emonTx_CT123.ino. When this is opened and i click on 'verify' it gives many errors. What do i have to do to get this sketch to be uploaded in my emontx...
thanks
Re: searching for good and clear programming manual
It will not load the sketch until you have removed all the errors. It you have errors, I think it has not found the libraries. What are the first few errors?
Here is a screenshot of the libraries that I have (this is Windows XP).
Re: searching for good and clear programming manual
here is a my library
Re: searching for good and clear programming manual
The first thing I would do is rename the directory "openenerymonitorEmonLib" to "EmonLib". If you still get errors, please copy and paste the first few complete error messages so that I can see what is wrong - for example, I do not which line the error is in so it is little help to me.
Re: searching for good and clear programming manual
these are the first errors...
Re: searching for good and clear programming manual
I think the file you are looking at is not the one I am looking at (from here: https://github.com/openenergymonitor/emonTxFirmware/tree/master/emonTx_C...). Has the file been corrupted when you downloaded it? According to me, lines 1 - 17 are one comment /* starts a comment and it ends */ so you should not have errors on those lines, neither should you have 253 lines.
I downloaded the file from Github less than an hour ago, I have a directory emonTx_CT123 and in that I have two files, emonTx_CT123.ino and emontx_lib.ino. When I open arduino.exe and do File -> Sketchbook -> emonTx_CT123 the file appears in the edit window and I can verify with no errors. The file looks like this:
Re: searching for good and clear programming manual
Robert, i downloaded it from the link you gave me and it works now...
thanks you.
p.s sorry for the later reply. I am VERY bussy.
Re: searching for good and clear programming manual
I am now busy with Emon base (NanodeRF). But i get almost the same errors...
NanodeRF_singleCT_Pachube:76: error: 'Stash' does not name a type
NanodeRF_singleCT_Pachube.cpp: In function 'void setup()':
NanodeRF_singleCT_Pachube:131: error: 'ether' was not declared in this scope
NanodeRF_singleCT_Pachube:131: error: 'Ethernet' has not been declared
NanodeRF_singleCT_Pachube.cpp: In function 'void loop()':
NanodeRF_singleCT_Pachube:168: error: 'ether' was not declared in this scope
etc.
I have downloaded it from github in ZIP format. What am i doing wrong this time...
Re: searching for good and clear programming manual
Error problem solved...i uploaded a new librarie called Ethercard from this page https://github.com/jcw/ethercard
and i can compile emonbasee now...
But when i try to upload.....is compiles the sketch, uploads it, but hangs....
Re: searching for good and clear programming manual
Problem found. As i am programming these chips with an arduino and putting them into the emon i forgot that the emon uses arduino uno bootloader. I am programming with a arduino deumilanove, so i have to select the uno board. Now i could upload it.
Now i have to see if my soldering was good....and the emons work....i will let you know.
Thanks Robert for the help...
Re: searching for good and clear programming manual
It looks as if you don't have the EtherCard library that you need. The clue is in the error messages mentioning "ether" and "Ethernet" and on line 69:
Check again my list of libraries and you'll see that I have it listed. Go to Github and download the library, put it with the other libraries.
[I admit it is not very clear that you need it - I must talk to Glyn about this].
Re: searching for good and clear programming manual
All is good now Robert, I programmed all emontx and emonbase (nanodeRF)
but i am now trying to get the thing online..and that is not easy unitll now...having some difficulties.
Re: searching for good and clear programming manual
How do i get the emonbase (nanodeRF) connecte to my database.
I read this in the emonbase sketch:
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 };
//IP address of remote sever, only needed when posting to a server that has not got a dns domain name (staticIP e.g local server)
byte Ethernet::buffer[700];
static uint32_t timer;
//Domain name of remote webserver - leave blank if posting to IP address
char website[] PROGMEM = "http://myserver/emoncms"; (this is a local server i run on my qnap, but the database is online on a hosting site)
do i need to fillin something at ' byte Ethernet::buffer[700]' ????
How does this thing connect without asking password or something like that.
Re: searching for good and clear programming manual
This is not something I know much about. Someone else will need to answer this for you.
Re: searching for good and clear programming manual
oke....hoping someone will see this, because you are the only who respond...
Re: searching for good and clear programming manual
Hello nawikre
First to clarify.
Is your local installation of emoncms working ok? Have you set the Includes/settings.php file to point to your database?
If after creating an account you go to 'account' and then scroll down to the API URL example and click 'try me' does that create two inputs under the 'inputs' tab?
If the answer is yes to all of the above, all you need to do is point the Nanode at the emoncms installation.
Uncomment line 86 and set to your server ip:
static byte hisip[] = { 192,168,1,5 };
On line 226 enter in your write apikey:
ether.browseUrl(PSTR("/emoncms3/api/post.json?apikey=YOURAPIKEY&json="),str.buf, website, my_callback);
Re: searching for good and clear programming manual
Yes, it works good and settings.pgp is set up to my database with password etc.
i have not done the API 'try me'
i will get back to you...
the emontx works, because i get this out of my serial monitor of the emonbase
DHCP status: 0
2 {rf_fail:1}
DHCP status: 0
DHCP status: 0
2 {rf_fail:1}
DHCP status: 0
emonTx data rx2 {rf_fail:0,power1:5,voltage:3264}
DHCP status: 0
2 {rf_fail:1}
DHCP status: 0
emonTx data rx2 {rf_fail:0,power1:7,voltage:3264}
DHCP status: 0
2 {rf_fail:1}
DHCP status: 0
emonTx data rx2 {rf_fail:0,power1:0,voltage:3264}
Re: searching for good and clear programming manual
Great, Are you connecting via a router that has DHCP enabled?
Re: searching for good and clear programming manual
yes the router gives dhcp
Re: searching for good and clear programming manual
how should i procede??
can you tell me what to program if it is dhcp? To check if i got it right.
Re: searching for good and clear programming manual
can no one help me a bit further..i am stuck....
Re: searching for good and clear programming manual
I assembled the Emon GLCD and that works fine. It can connect with the emonTX because i can read Watt usage.
But it says -emonbase fail-
I also added the API write key to the NanodeRF_Power_RTCRelay_GLCDtemp script. But still it cannot connect with emoncms.
Any idea??