Hi Paul
Thanks for the cable suggestion. Thought I would document here (for when I inevitably break something and want to refer back…) what I did to “wire” my two emonTx’s to the emonPi:
-
Get two of the cables you linked above, 2x male-female USB extenders, and connect straight to the UART ports of the emonTx’s and USB ports of the emonPi
-
Check they show up:
pi@emonpi:~ $ lsusb
Bus 001 Device 005: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
- Look for serial number details of the two devices
pi@emonpi:~ $ lsusb -v | grep Serial
Bus 001 Device 005: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
idProduct 0x6001 FT232 Serial (UART) IC
iSerial 3 AD0K0RW1
Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
idProduct 0x6001 FT232 Serial (UART) IC
iSerial 3 AQ00MFGH
- Create a new udev rule. I think writing udev rules is a dark art and I had to play around a bit
pi@emonpi:~ $ cat /etc/udev/rules.d/9-emon.rules
SUBSYSTEM=="tty", ATTRS{idProduct}=="6001", ATTRS{idVendor}=="0403", ATTRS{serial}=="AQ00MFGH", SYMLINK+="emonTX-AQ00MFGH"
SUBSYSTEM=="tty", ATTRS{idProduct}=="6001", ATTRS{idVendor}=="0403", ATTRS{serial}=="AD0K0RW1", SYMLINK+="emonTX-AD0K0RW1"
- Reload the rules and trigger them:
pi@emonpi:~ $ sudo udevadm control --reload
pi@emonpi:~ $ sudo udevadm trigger
- Check the symlinks have been created:
pi@emonpi:~ $ ls -al /dev/emon*
lrwxrwxrwx 1 root root 7 Nov 21 22:36 /dev/emonTX-AD0K0RW1 -> ttyUSB1
lrwxrwxrwx 1 root root 7 Nov 21 22:36 /dev/emonTX-AQ00MFGH -> ttyUSB0
- Run the following to check data can be read off the symlinked devices:
#!/usr/bin/env python
import time
import serial
ser = serial.Serial(port='/dev/emonTX-AQ00MFGH',baudrate = 115200,parity=serial.PARITY_NONE,stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS,timeout=1)
while 1:
x=ser.readline()
print x
- Messages are read every 10 secs so assume working. Now need to change emonhub configuration, so added to the interfacers section:
[[TxN1]]
Type = EmonHubTx3eInterfacer
[[[init_settings]]]
com_port= /dev/emonTX-AQ00MFGH
com_baud = 115200
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
[[TxN2]]
Type = EmonHubTx3eInterfacer
[[[init_settings]]]
com_port= /dev/emonTX-AD0K0RW1
com_baud = 115200
[[[runtimesettings]]]
nodeoffset = 1
pubchannels = ToEmonCMS,
- Give the whole thing a reboot! Now I can see two new inputs in EmonCMS, catchily named ‘0’ and ‘1’, which seem to be receiving the same data as is still arriving over radio from the emonTx’s. Happy days!
Do people generally disable radio on “wired” emonTx’s, or just leave them alone?
Thanks
Chris