EmonTxV3CM firmware and Serial Direct – Help Please

I’m repurposing an EmonTx …

The Arduino IDE upload of the firmware reported as being OK.

The RPi is running great - ver 10.2.3 and the Admin webpage shows everything OK.

I’ve triple checked the serial connecting wires from RPi to emonTx.

EmonTx has an AC/AC adaptor and one CT connected.

I’ve deleted the radio Interfacer from emonhub.conf and added the recommended EmonHubTx3eInterfacer

But the emonhub log shows that no serial data is being printed …

2020-07-28 01:47:00,042 INFO MainThread EmonHub emonHub (emon-pi variant) v2.1.5
2020-07-28 01:47:00,042 INFO MainThread Opening hub...
2020-07-28 01:47:00,043 INFO MainThread Logging level set to DEBUG
2020-07-28 01:47:00,043 INFO MainThread Creating EmonHubTx3eInterfacer 'SerialTx'
2020-07-28 01:47:00,045 DEBUG MainThread Opening serial port: /dev/ttyAMA0 @ 115200 bits/s
2020-07-28 01:47:00,046 INFO MainThread Creating EmonHubMqttInterfacer 'MQTT'
2020-07-28 01:47:00,049 DEBUG MainThread Setting MQTT pubchannels: ['ToRFM12']
2020-07-28 01:47:00,049 DEBUG MainThread Setting MQTT subchannels: ['ToEmonCMS']
2020-07-28 01:47:00,049 INFO MainThread Setting MQTT node_format_enable: 1
2020-07-28 01:47:00,050 INFO MainThread Setting MQTT nodevar_format_enable: 1
2020-07-28 01:47:00,050 INFO MainThread Setting MQTT nodevar_format_basetopic: emon/

Then I noted that the firmware had to be altered to achieve serial printing as follows …

$ miniterm --rtscts /dev/ttyAMA0 115200
Use `+++` then `[Enter]` for config mode.
Available commands for config during start-up:
b<n>      - set r.f. band n = a single numeral: 4 = 433MHz, 8 = 868MHz, 9 = 915MHz (may require hardware change)
g<nnn>    - set Network Group  nnn - an integer (OEM default = 210)
i<nn>     - set node ID i= an integer (standard node ids are 1..30)
r         - restore sketch defaults
s         - save config to EEPROM
v         - show firmware version
w<x>      - turn RFM Wireless data on or off:
          - x = 0 for OFF, x = 1 for ON, x = 2 for ON with whitening
x         - exit and continue
?         - show this text again

Is it turn off radio with w0 or w<0>? I tried both in my failed attempts to make sense of minicom.

Please provide a few more details of how to use minicom in this instance. This is what I get …

pi@emonTx:~ $ miniterm --rtscts /dev/ttyAMA0 115200
--- Miniterm on /dev/ttyAMA0 115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

And I did stop emonhub with sudo systemctl stop emonhub.service.

Alternatively which line(s) in the firmware code need altering to turn off Radio – reflashing might be a quicker alternative.

TIA
[edited top correct formatting - MOD]

Sorry, I don’t use Minicom, it’s not part of my system, so I can’t give specific guidance on how to drive it.

But the pointy brackets ‘<’ & ‘>’ are NOT part of the syntax, so w0 or w 0 or even w should turn the radio off and the serial output on. But it is case sensitive, therefore W0 or similar alternatives won’t work.

You could always disconnect from the Pi and use the FTDI programmer to connect directly to a computer running the Arduino IDE, thus bypassing Minicom.

Or, you could edit the sketch: the radio/serial switch is a straightforward “if / else”.

@Robert.Wall @TrystanLea

Clearly my problem is serial communication. Then I realised, the minicom instructions in Resources will only solve the problem if you don’t have that problem in the first place :slight_smile: :frowning:

So I changed firmware line 64 to rf_whitening = 0;
Now all is running fine.

Out of interest, I then tried the suggested minicom command again but then just got the scrolling data lines. The +++ did nothing.

To get +++ to work, it actually needs the following cr/lf. If those are missing, or only cr or only lf is sent, or indeed if lf/cr is sent, then it doesn’t match and doesn’t let you in. The line that does it:

Serial.readString() == "+++\r\n"

If you could point out exactly where

is, I can take a look at it.

@Robert.Wall

And scroll down to Serial Cofiguration

Thx

You said “Resources” - that’s why I couldn’t find it, it’s actually Github. I don’t have an emonPi available at the moment (it’s in bits), I’ll look at that when I reassemble it. In the meantime, I’d point the accusing finger at the cr/lf not being sent as it expected it.

@Robert.Wall

I just googled cr/lf - now I’m really confused
What exact keys do I press & in what sequence on my Windows laptop when accessing emon via SSH/puTTy?

(You’ll have heard the very old joke … which is the Any key?)

I pass on that. I run Ubuntu Linux, and my emonPi is in bits, so I can’t offer any help for a few days.
In the Arduino IDE, it’s a setting in the serial monitor window.

A 10 second excursion into Google showed this:
https://arstechnica.com/civis/viewtopic.php?f=20&t=566236
It appears my hunch was right - Minicom sends only cr.

From the instructions

image

definitely works with miniterm. You do need to wait until it tells you it is looking for that input.

The instructions on that page are for miniterm (it gets installed with Python) - note the rtscts option; IIRC I found it was required.

miniterm --rtscts /dev/ttyAMA0 115200

The Enter key is the only key you need to hit.

However, puTTY needs to be set up correctly. Here’s how to do that:

After starting puTTY, click on terminal. That will bring up this configuration screen:

putty_crlf

Tick the box Implicit LF in every CR (to the left of the blue arrow in the picture above)

To save the change

  • Click on Session
  • Fill in the Host Name (or IP address) box with the appropriate data if it’s blank
  • Type a name as into the Saved Sessions box (can be anything you like)
  • Click the Save button
  • Done

@Bill.Thomson

That’s great - thx
Hopefully this explanation will find it’s way into the OEM Resources/GitHub documentation in due course.
However I’m conscious that there are not too many Serial Direct users.
But what’s simpler & more reliable than 3 connecting wires?

I don’t need to do this and it works fine.

Nothing!

And less susceptible to “interference” of all sorts?

Is that with puTTY running directly on Windows?
or is it running on Windows in a VM, etc.?
(Didn’t know you ran Windows. I Thought you were a Linux guy) :wink:

Yes.

My main machine is Win10. I did run an Ubuntu machine about 15 years ago in the Vista era, but Win 10 is actually pretty good; can’t remember the last BSOD and it has WSL so you have the best of both worlds. Almost all of my Linux recently has been Raspbian with a little Ubuntu VM thrown in :slight_smile:

I have Windoze 10 in a VM that I touch just occasionally, but never use in earnest.