Hi! I have some questions related to hardware and software.
Hardware: Connections:
Establishing firmware to emontx: PC--(usb)-->USBtoSERIALadapter---->EmonTXV3----->(CT1,CT2,CT3,CT4) connected to some electrical components for getting data.
I have charge the emonTXV3_DirectSerial sketch that prints:
Serial.print("1 ");Serial.println(ct1.realPower);
Serial.print("2 ");Serial.println(ct2.realPower);
Serial.print("3 ");Serial.println(ct3.realPower);
Serial.print("4 ");Serial.println(ct4.realPower);
Serial.println(ct1.Vrms);
I could connect via putty, and see the ouput. That's ok.
Next step, configuring raspberry pi.
Pc ---(eth)-->RaspBerryPI (supplied by microUSB) ----(serial)---->emontx(supplied by AC 9v)----->(CT1,CT2,CT3,CT4) connected to some electrical components for getting data.
Software.
Devices:
- EmonTXV3 is the resource collector.
- Raspberry had installed emonHUB, and emoncms was disabled
- EmonCms in http://emoncms.org/
So i want to see my nodes and inputs, when i log in http://emoncms.org/
The question is ... i cant see nothing:
The emontx is sending it data to raspberry?
How can i see them before them was sended to http://emoncms.org/?
I think this could be a configuration problem, so i have change /boot/emonhub.conf and /home/pi/emonhub/emonhub.conf (dont know who works)
I can upload my emonhub.conf if you need.
Thank you all!
Re: Emon v3 Direct Serial
To input data directly to emonHub via serial you will need to need to undo your changes to the the serial print in the sketch and add a preceding node id, emonHub and emonCMS expect data in the format of nodeid value1 value2 value3 etc.
The line breaks indicate the end of the payload so additional line breaks yoy have added effectively split the payload into 5 payloads and the numbers 1 to 5 wil just significantly confuse things as the payload is read in byte order to reconstruct the values.
You should also disable the rfm2pi (EmonHubJeeInterfacer) and set up a serial interfacer in emonhub.conf, see http://openenergymonitor.org/emon/node/6048 for more info.
Usually on the sdcard image the conf file is on the boot partition ( /boot/emonhub.conf ) you can check this by changing the "loglevel" setting from "WARNING" to "DEBUG" in just the one conf file and see if it changes the logging if it does that is the correct conf file (if not try the other) only one is used by emonhub. By changing the loglevel and typing
you will be able to see what is being received by emonhub and what it is doing with the received payloads, ie it will discard anything that does not conform to the required structure.
Paul
Re: Emon v3 Direct Serial
Hi,
I'm planning to test the same config but I didn't try yet.
I understand why you modified the emonTXV3_DirectSerial sketch. It looks like the node ID is missing at the beginning of the frame. Is it a mistake ? But I would not modify it like you did. I would just add Serial.print("10 "); on line 68 to set the nodeId to 10 (it's an example).
Then you have to configure the emonhub.conf file like this
[[10]]
codes = f,f,f,f,f
as this sketch should send 5 floats (not sure, to be verified usinf minicom : minicom -b 9600 -o -D /dev/ttyAMA0)
For futur request please join the emonhub log file (var/log/emonhub/emonhub.log) and the emonhub config file ( /boot/emonhub.conf file)
Eric
Re: Emon v3 Direct Serial
Paul, it looks like it takes you less time to write in english than me ...
Can we know on that forum whether someone is replying to avoid this kind of duplicate answers ?
Re: Emon v3 Direct Serial
Eric: "Can we know on that forum whether someone is replying to avoid this kind of duplicate answers ?"
I know how you feel, Paul & I do the same - frequently. I don't think what you ask will be possible to do automatically, else it would surely have been done. For example, what happens if I start an answer and then lose my Internet connection? You would wait forever for me to post my reply.
You could post a one-line "I'm replying", then continue to edit it, but then the rest of the thread is hidden unless you open it again in another browser tab.
Re: Emon v3 Direct Serial
Hi Eric, This has been suggested before, Robert and I frequently clash replies. Although a good idea it may not always work, I frequently start writing a reply and the phone rings or something else distracts me and it could be several hours before I get back :-)
Paul
Re: Emon v3 Direct Serial
I see you won't need to look far for an example !!!!
Re: Emon v3 Direct Serial
Thanks all!
Well, i have fixed the emonhub.conf interface and nodeid like that:
[[SerialDirect]] Type = EmonHubSerialInterfacer [[[init_settings]]] com_port = /dev/ttyAMA0 com_baud = 9600 [[[runtimesettings]]] [nodes][[10]]
datacode = h
datacodes = h,f,f,f,f And change loglevel=DEBUG.
cmdline.txt content:
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait And this is the output of emonhub.log while theorically emontxV3 is sending data over serial port (The red led is flashing each 10 seconds. (After these changes and restart the emonhub daemon)
2014-11-25 15:43:56,272 DEBUG Closing serial port2014-11-25 15:43:56,274 INFO Exiting hub...
2014-11-25 15:43:57,904 INFO EmonHub Pre-Release Development Version (rc1.0)
2014-11-25 15:43:57,907 INFO Opening hub...
2014-11-25 15:43:57,910 INFO Logging level set to DEBUG
2014-11-25 15:43:57,912 INFO Creating EmonHubEmoncmsReporter 'emonCMS'
2014-11-25 15:43:57,918 INFO Set up reporter 'emonCMS' (buffer: memory | size: 1000)
2014-11-25 15:43:57,922 INFO Creating EmonHubSerialInterfacer 'SerialDirect'
2014-11-25 15:43:57,925 DEBUG Opening serial port: /dev/ttyAMA0
2014-11-25 15:43:57,929 INFO Opened serial port: /dev/ttyAMA0 9600 bits/s (No warnings)
My sketch prints
Serial.print("10 ");Serial.print(ct1.realPower); Serial.print(" ");
Serial.print(ct2.realPower); Serial.print(" ");
Serial.print(ct3.realPower); Serial.print(" ");
Serial.println(ct4.realPower);
Im not using cms in raspberry pi, so in emonhub.conf:
[[emonCMS]]Type = EmonHubEmoncmsReporter
[[[init_settings]]]
[[[runtimesettings]]]
url = http://emoncms.org
apikey = ...
Also, i cant read anything in minicom
Re: Emon v3 Direct Serial
Did you also comment out the line in /etc/inittab ?
You will need to reboot the pi for the serial port access changes to take effect
also you won't need the "h" in the datacodes as the node id is handled separately just the values need "datacodes" if they are not the default ints, So if you send node id and 4 floats you just need "datacodes = f, f, f, f"EDIT - no decoding is required as "real numbers" are passed, therefore the preset default datacode of 0 will pass values as they are.
Re: Emon v3 Direct Serial
Haha, thank you for all guys. The last problem was my serial cable. Ground and Voltage were ok, but data cable was broken.
I have fixed it.
Now the problem is:
In minicom the serial output is:
10 0.03 0.00 0.00 0.00
10 0.02 0.00 0.00 0.00
10 0.02 0.00 0.00 0.00
10 0.04 0.00 0.00 0.00
10 -0.00 0.00 0.00 0.00
But emonhub.log:
2014-11-25 20:23:48,272 WARNING 16 RX data length: 4 is not valid for datacodes ['f', 'f', 'f', 'f']2014-11-25 20:23:56,625 DEBUG 17 NEW FRAME : 1416947036.63 10 0.02 0.00 0.00 0.00
2014-11-25 20:23:56,629 WARNING 17 RX data length: 4 is not valid for datacodes ['f', 'f', 'f', 'f']
2014-11-25 20:24:06,385 DEBUG 18 NEW FRAME : 1416947046.39 10 0.03 0.00 0.00 0.00
2014-11-25 20:24:06,389 WARNING 18 RX data length: 4 is not valid for datacodes ['f', 'f', 'f', 'f']
What is the first number of the array?
Re: Emon v3 Direct Serial
Ok, the values are actually "real numbers" and not transmitted in bytes so no decoding is required. if you remove the "datacode" and/or "datacodes" from the node section in the conf it should work correctly as the default datacode is preset to "0" to pass values as is.
Re: Emon v3 Direct Serial
OK the first number is the time. But dont know why appear that warning.
Output: 10 0.03 0.00 0.00 0.00
So .. its a integer, float, float, float float
emonhub.conf:
[[10]]
datacode:h
datacodes:h,f,f,f,f
Re: Emon v3 Direct Serial
It works pb66! Tank you very much!
Now i can see the values at the webpage!
You rules guys! Real thank you!