emonHub ttyUSB0 USB serial adapter

Thank you for your reply Glyn.

The result of the git branch command is:
git branch
environ-master
master

  • stable

The result of the git pull command is:
git pull
Already up-to-date.

The emoncms version is 9.8.8:

Your answer give me a clue.
I change the branch to master and now is OK, the floating palette is correct and I can build the dashboard again.

An other question:
Can emonhub service to read simultaneous from two ports: e.g. AMA0 and USB0 ?
I can collect data from a couple of sensors with an USB to SERIAL adapter.

Thanks again.

1 Like

I hope you don’t mind, I moved this question to a new topic.

The short answer is yes; you will just need to create a new entry in emonhub.conf in the [interfacers] section, you can edit this via the local Emoncms web interface.

There are two options depending on serial format:

1. EmonHubTx3eInterfacer

This interface handles name value key pairs e.g. name:value,name:value. This is the default serial output for latest emonTx V3 and emonTH FW.

Config example:

[interfacers]
### This interfacer manages the EmonTx3 ESP format serial
[[SerialTx3e]]
     Type = EmonHubTx3eInterfacer
      [[[init_settings]]]
           # Un-comment line below if using RS485 adapter
           #com_port = /dev/ttyRS485-0
           # default com port if using USB to UART adapter
           com_port= /dev/ttyUSB0
           com_baud = 115200
      [[[runtimesettings]]]
           pubchannels = ToEmonCMS,

2. EmonHubSerialInterface

This interfacer handles serial with space operators e.g NODEID VAR1 VAR2 VAR3

Config example:

[[SerialDirect]]
     Type = EmonHubSerialInterfacer
      [[[init_settings]]]
           com_port = /dev/ttyUSB0      # or /dev/ttyAMA0 or/dev/ttyACM0 etc
           com_baud = 9600              # to match the baud of the connected device
      [[[runtimesettings]]]
           pubchannels = ToEmonCMS,

Hello,
I’m connecting an stm32 nucleo device directly to raspberry pi usb port. I’m trying to use the DirectSerial interface on the emonhub, but I get this log:

Am I missing some step???

thanks in advance

What does this command return?

ls -la /dev/{tty{AMA,S,USB},serial}*

I suspect an STM32 might use /dev/ttyACM0 rather than /dev/ttyUSB0 if it has an on-board USB serial adapter.

1 Like

hello, I tried the command and got this:

pi@emonpi(rw):~$ ls -la /dev/{tty{AMA,S,USB},serial}*
ls: cannot access /dev/ttyUSB*: No such file or directory
ls: cannot access /dev/serial*: No such file or directory
crw-rw---- 1 root dialout 204, 64 Jan 31 23:30 /dev/ttyAMA0
crw-rw---- 1 root dialout   4, 64 Jan 31 23:24 /dev/ttyS0

Sorry that command should have been

ls -la /dev/{tty{ACM,AMA,S,USB},serial}*

Can you run it with the STM32 connected and then again with it disconnected. The entry that disappears when disconnected is the one you want.

Do you have anyother serial/usb devices connected?

either connected or disconnected I get the following:

pi@emonpi(ro):~$ ls -la /dev/{tty{ACM,AMA,S,USB},serial
ls: cannot access /dev/{ttyACM,serial: No such file or directory
ls: cannot access /dev/{ttyAMA,serial: No such file or directory
ls: cannot access /dev/{ttyS,serial: No such file or directory
ls: cannot access /dev/{ttyUSB,serial: No such file or directory

3rd time lucky maybe.

Sorry the last 2 characters got lost in transit when doing a copy and paste on the mobile.

I have corrected the typo now.

I appreciate your help!, Finally got it I had to use /dev/tty/ACM0.

thank you so much!!

Great! Sorry for the false starts, late night, tired and fiddly mobile are not a good combination.

For future readers, the command is basically a search for serial or USB devices with commonly used address prefixes eg “ttyAMA” “ttyACM” “ttyUSB” “ttyS” and “serial”.

ls -la /dev/{tty{ACM,AMA,S,USB},serial}*

would have returned something like (in this instance)

pi@emonpi(rw):~$ ls -la /dev/{tty{AMA,S,USB},serial}*
ls: cannot access /dev/ttyUSB*: No such file or directory
ls: cannot access /dev/serial*: No such file or directory
crw-rw---- 1 root dialout 204, 64 Jan 31 23:30 /dev/ttyACM0
crw-rw---- 1 root dialout 204, 64 Jan 31 23:30 /dev/ttyAMA0
crw-rw---- 1 root dialout   4, 64 Jan 31 23:24 /dev/ttyS0

with the STM32 attached and then

pi@emonpi(rw):~$ ls -la /dev/{tty{AMA,S,USB},serial}*
ls: cannot access /dev/ttyACM*: No such file or directory
ls: cannot access /dev/ttyUSB*: No such file or directory
ls: cannot access /dev/serial*: No such file or directory
crw-rw---- 1 root dialout 204, 64 Jan 31 23:30 /dev/ttyAMA0
crw-rw---- 1 root dialout   4, 64 Jan 31 23:24 /dev/ttyS0

with it disconnected

in the first “connected” result the line

crw-rw---- 1 root dialout 204, 64 Jan 31 23:30 /dev/ttyACM0

tells us there is a device using the /dev/ttyACM0 address and then in the second “disconnected” result that line no longer exists, but there is a new line showing no devices were found with an address prefix ttyACM

ls: cannot access /dev/ttyACM*: No such file or directory

In this example '/dev/ttyS0andttyAMA0` are the Pi3’s 2 inbuilt UART serial ports, used by the bluetooth and GPIO.