Can I connect emonTx's to EmonPi via a wired connection instead of wireless?

Is that address correct on your machine? If you list the ports, ls -l /dev/tty* and it’s not listed, that’s why it can’t open the port.

If I do that, I see every number from tty0 to tty63, ttyS0 to ttyS31, and a few more besides, but not one with the format with “-0” on the end. But I don’t have a USB-RS485 adapter.

Thank you. I did the ls -l /dev/tty* and you are correct… USB -0 is NOT listed, BUT USB0 IS listed so I tried that and…
NO GOOD.
I wish glyn would take a look as something has changed since he posted, but he does say that he has not tried an RS485 adaptor.

"It should work for multiple USB devices, by duplicating and changing USB0 to USB1. I’ve not tested this"
This was back in July of 2017, so NOT current, and who knows WHAT changes have happened since then!

I sure wish there was a “dummy” guide somewhere, with examples… it might give me a clue as to what I am doing wrong. It can’t be THAT difficult, but the correct ports/names/etc MUST be correct or it ain’t gonna work!

I have turned the radio off on my Tx board, and the Rx led is flashing on my serial to RS485 adapter, so I believe the data is being sent to the Pi.

Also of note… there is no dev/ttyRS485 listed when I ls -l , therein lies the problem.
Like you, I do see tty0 to tty63 and 4 more including ttyUSB0, so there must have been a change to what glyn posted.

I’ll look around some more to see how to get the RS485 device added…

What does lsusb tell you? with and without the RS485 adapter plugged in?

Did anything that gives us a hint come with your RS485 to USB adapter?

Failing that, I would first try all the USB… addresses, because it won’t necessarily be the same as the one Glyn found/used.

I don’t think you’re doing anything wrong, it’s just that you haven’t got the information to enable you to do it right.

That’s very true. I can understand your frustration, but I’m seriously handicapped because I’ve never used one of those adapters so I’ve never been in the position of getting one to work. All I can do is give you a steer in what I hope will be the right direction. You at least have the thing in your hand and you’re able to try things.

1 Like

Well I DO VERY much appreciate the help!
I ran the lsusb command and my USB to RS485 adapter comes back as:

pi@emonpi:~ $ lsusb
Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter <----- THIS IS THE ADAPTER
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I tried plugging the adapter into a different USB port on the Pi, and the “device” number changed, just to verify that the Pi is actually seeing the adapter.

When I unplug the adapter, the QinHeng entry goes away, so it is being identified as a USB to serial adapter.
Nothing came with the adapter… it was a cheapie from Amazon, and the package sticker indicate “JBtek USB to RS485”.
The controller is a CH340G and drives a MAX485 (probably a clone though). There is a 12 Mhz xtal driving the controller chip, so it is probably a USB to serial converter and they are driving the 485 for the RS485 output.
That is why the ls command sees it as a USB to serial interface, so I will treat it as one.

I will try using USB5 in the Emonpic configuration and see if that works.

The bit you need is 1a86:7523

Look at this post How to match a ttyUSBX device to a USB Serial device

It tells you how to link that adapter - no matter which port you plug it in to - to a device name. You then refer to it by that name, in for example, Glyn’s Interfacer. My guess is this is the part he left out.

I’m not sure whether you need a restart for your machine to read and use the rule(s) you add.

Looked at the link you provided and THERE IT WAS!!!
Found the 99-com.rules and copied the line for the ch304 subsystem:

SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="CH340", MODE="0666"

but when I tried to save it, permission was denied… must be read only so I need to change that permission and then add the line and save it.

WE ARE GETTING CLOSER!!!

You might need sudo to edit the udev file.

I’m quitting now (I’m several hours ahead of you, in the UK), and I won’t be around tomorrow until your late afternoon.

Ok i will give that a try!
Once again, I really appreciate all your help and guidance!
I’ll let you know what happens… HOPEFULLY good news!
Have a good night.

well sudo pico 99-com.rules worked at least…
Added the line for the ch340 but got DIFFERENT errors in emonhub log views now…
Need to look further as to what i have missed, but things ARE changing at least!

Assuming you kept what our Bill wrote in the link I gave you, you did of course change Glyn’s Interfacer to

 com_port = /dev/CH340

If you do ls -l /dev/* again with the adapter plugged in, you should get yards and yards of listing and amongst them should be a device with the name you hope you gave it in the udev rules. In my case, I’ve plugged in two programmers for the purpose of illustrating, my udev rules say

SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="FTDI", MODE="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="8037", SYMLINK+="Arduino_Micro", MODE="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", SYMLINK+="FTDI_Micro", MODE="0666"

and buried in the output of the ls command, after the permissions etc is

 /dev/FTDI -> ttyUSB0
 /dev/FTDI_Micro -> ttyUSB1

and if I swap the connectors around I get

/dev/FTDI -> ttyUSB1
/dev/FTDI_Micro -> ttyUSB0

showing that I can use the name I gave the programmer to find it irrespective of the port it’s plugged in to.

I can do nothing with that, it doesn’t help me to help you. You need to say WHAT the error messages are.

GREAT NEWS!!!
I can now see the data from the EmonTx via RS485!!!
The Pi creates the interfacer:
2021-09-02 19:24:53,302 INFO MainThread Creating EmonHubTx3eInterfacer ‘SerialTx3e’

and if I reset the Tx, the startup serial data shows up on the Emonhub’s log:
2021-09-02 19:31:47,550 INFO SerialTx3e START MESSAGE: emonTx V3.4 EmonLibCM Continuous Monitoring V2.00
2021-09-02 19:31:47,656 INFO SerialTx3e START MESSAGE: OpenEnergyMonitor.org
2021-09-02 19:31:47,728 INFO MQTT Publishing ‘node’ formatted msg
2021-09-02 19:31:47,759 INFO SerialTx3e START MESSAGE: Loaded EEPROM config
2021-09-02 19:31:47,860 INFO SerialTx3e START MESSAGE: Settings:
2021-09-02 19:31:47,962 INFO SerialTx3e START MESSAGE: Group 210, Node 15, Band 433 MHz
2021-09-02 19:31:48,164 INFO SerialTx3e START MESSAGE: Calibration:
2021-09-02 19:31:48,266 INFO SerialTx3e START MESSAGE: vCal = 268.97
2021-09-02 19:31:48,367 INFO SerialTx3e START MESSAGE: assumedV = 240.00
2021-09-02 19:31:48,469 INFO SerialTx3e START MESSAGE: i1Cal = 90.90
2021-09-02 19:31:48,571 INFO SerialTx3e START MESSAGE: i1Lead = 4.20
2021-09-02 19:31:48,679 INFO SerialTx3e START MESSAGE: i2Cal = 90.90
2021-09-02 19:31:48,781 INFO SerialTx3e START MESSAGE: i2Lead = 4.20
2021-09-02 19:31:48,883 INFO SerialTx3e START MESSAGE: i3Cal = 90.90
2021-09-02 19:31:48,985 INFO SerialTx3e START MESSAGE: i3Lead = 4.20
2021-09-02 19:31:49,088 INFO SerialTx3e START MESSAGE: i4Cal = 16.67
2021-09-02 19:31:49,190 INFO SerialTx3e START MESSAGE: i4Lead = 6.00
2021-09-02 19:31:49,293 INFO SerialTx3e START MESSAGE: datalog = 9.96
2021-09-02 19:31:49,395 INFO SerialTx3e START MESSAGE: pulses = 1
2021-09-02 19:31:49,499 INFO SerialTx3e START MESSAGE: pulse period = 100
2021-09-02 19:31:49,601 INFO SerialTx3e START MESSAGE: temp_enable = 1
2021-09-02 19:31:49,722 INFO SerialTx3e START MESSAGE: Temperature Sensors found = 0 of 1
2021-09-02 19:31:49,832 INFO SerialTx3e START MESSAGE: Temperature measurement is NOT enabled.
2021-09-02 19:31:49,934 INFO SerialTx3e START MESSAGE:
2021-09-02 19:31:50,036 INFO SerialTx3e START MESSAGE: RF off
2021-09-02 19:31:50,140 INFO SerialTx3e START MESSAGE: USA Vcal active: 130.00
2021-09-02 19:31:50,243 INFO SerialTx3e START MESSAGE: POST…wait 10s
2021-09-02 19:31:50,347 INFO SerialTx3e START MESSAGE: ‘+++’ then [Enter] for config mode
2021-09-02 19:31:50,449 INFO SerialTx3e START MESSAGE: CT4 detected, i4Cal:16.67
2021-09-02 19:31:50,550 INFO SerialTx3e START MESSAGE: AC present

Now I just need to get the data from the Tx so I can process it and display it in my dashboards…

1 Like

yes:

[[SerialTx3e]]
     Type = EmonHubTx3eInterfacer
      [[[init_settings]]]
           # Un-comment line below if using RS485 adapter
           # com_port = /dev/CH340    
           # default com port if using USB to UART adapter
           com_port= /dev/CH340
           com_baud = 115200
     [[[runtimesettings]]]
         pubchannels = ToEmonCMS,

since the adapter came back as a USB to uart, I used it under the UART adapter portion of the interfacer…

yes, there are pages of listings, but I did find the CH340 and yes it does show up as:

lrwxrwxrwx 1 root root 7 Sep 1 23:44 /dev/CH340 → ttyUSB0

As far as the errors, I cannot duplicate them, and it was late last night, so probably over tired and over loaded…

To get around that, put three backticks (usually, the key is in the upper left corner of your keyboard)
on a line above your text, and three more on a line below your text.

I fixed your post, so it might be easier to just view it in the editor to see what I’m talking about…

Thank you Bill!

thumbsup thumbsup

It should continue from there. Do you see the output continuing every 10 s or so? “AC present” is actually sent not as part of the startup, but the first time it processes real data, so it is running.

And if you put the word text on the first line of backticks like so:
```text
then it doesn’t colour/highlight specific programming-language words.

Well I just had to do more digging, and the data from my Tx showed up in node 0!!!
I am creating processes to log, convert to F, and use the Tx’s data SERIALLY!!!
FINALLY with Mr. Wall’s help (thank you so very much), and looking around and just TRYING things, and with Bill’s examples and posts, I got it to work!!!
Just for reference, how would I get the data into a different INPUT (right now the data is in node 0).
Of course, when I log/massage the data, I can log it to a different, named feed, which is fine.

Yes, the data appears every 10 seconds like it should!
PROGRESS!!! You don’t know how “HAPPY” this makes me!
Always a learning process, and this has been a GOOD one!

1 Like

The problem seems to be that @glyn.hudson forgot to mention the bit about setting the udev rules to tie the serial adapter to /dev/ttyRS485-0 (in his case).

That was the source of all your confusion and trauma.

Yes, I agree. There was necessary information missing, but putting all the pieces together, and GREAT help, mission accomplished!

I hope that if someone else has the same problem they refer to this post and the other information about doing this, as it hopefully will help others that are trying to use hardwired connection.

I am just SO thrilled that this is working now!
Thank YOU!

I also appreciate that you didn’t treat me like I was a dummy and blow me off. Really shows what a great community this is and all the help that is available.