Connecting emonTx via serial

Can anyone confirm if the default sketch for emonTx_V3.4 (the one that ships with the fully assembled unit from the Shop) writes to the serial port output (labeled UART Programming Header on the PCB)? I read somewhere that it writes there by default as well as to the RF out.

I am trying to do the serial connection to a Raspberry Pi running the latest emonPi/emonBase image. To get the serial connection working would I only need to connect Tx< -->GPIO10   and GND<-->GND?



Robert Wall's picture

Re: Connecting emonTx via serial

If a serial connection is detected, it writes whatever is in the "Serial.print" statements. (Check the source on Github.) It starts with "emonTx V3.4 Discrete Sampling V3.4" etc and some test & diagnostic data, then for each sample, powers and temperatures separated by spaces.

The pin labelled as "Tx" on the EmonTx V3.4 is the pin that connects to Tx on the programmer - it is actually connected to the Rx pin on the processor (see the schematic). Could that be your problem?

pb66's picture

Re: Connecting emonTx via serial

Hi Brandon,

The 3 main elements to using a serial-direct interface are,

1) The 'sender' must provide the data as space separated values with a leading node id, As far as I'm aware all but the "serial-direct" versions of the emonTx sketches send debug information to the serial port in a non specific human readable form, this output  is difficult to parse so not catered for in emonHub, 

So the quick answer to your question re the default sketch is ,Yes it does output serial but not in a form that can be used as an input to emonhub or emoncms

2) The physical connection, as Robert points out the Rx pin of the emonTx should be connected to the GPIO pin 10.

3) emonHub needs to be configured to receive the packet from serial, the existing "default" rfm2pi EmonHubJeeInterfacer can be configured to do the job but it is heavily biased towards the rfm2pi (and other Jee based devices) in the way it works and handles data/settings etc so you should be looking at changing the "Type" of interfacer to a EmonHubSerialInterfacer and remove the rfm settings (freq, group & baseid)

The data passed via a "serial-direct" method is normally real values and this is the default setting for the EmonHubSerialInterfacer where as the EmonHubJeeInterfacer is configured to decode the typedef struct's defined in the sketch and passed via the rfm2pi as byte values.

There are several threads on this topic and it is quite easy to do and tried and tested on all but the "latest emonPi/emonBase image", this is unchartered waters, it should work but there may be differences using the emon-pi variant of emonhub and you will probably need to explicitly define the node in [nodes] for it show up in the new emoncms node page.

Firstly you should move the link wire from tx to rx then try using minicom to view the serial output from the emonTx, this will test the connection and provide a means to view the raw serial input to see what you have and test what you do.

Then you need to change the sketch, there are some you can use or you can "roll your own", once you are confidently recieving a properly formatted stream of packets in minicom you can experiment with emonhub if it doesn't work first time.


baldockery's picture

Re: Connecting emonTx via serial

I noticed that on my emonTx PCB the labels for Rx and Tx are reversed from the wiki schematic. Anyone know which will be correct?

Robert Wall's picture

Re: Connecting emonTx via serial

Which version of the PCB do you have? The V3.2 Oct 2013 version has the connector labelled conventionally, i.e. Tx is the line that data is transmitted on. The V3.4 Oct 2014 version has the connector labelled as the programmer is, i.e. the pin labelled Rx is the line that connects to Rx on the programmer and is the line that the programmer receives the data on.

I've added an explanatory note to the Wiki.

Comment viewing options

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