0

I have an 8 channel USB Relay board which I have connected via USB. The manual for the board states that:

To use this product with Linux, USB CDC driver needs to be compiled in with the kernel. Fortunately, most Linux distributions (Ubuntu, Redhat, Debian etc..) has this driver pre-installed.

The chances of you requiring to rebuild the kernel to include the USB CDC driver is very slim.

When connected to a Linux machine, this product should appear as a serial port in the /dev directory. Usually the name of the device will be ttyACMx or similar. The name may be different depending on the Linux distribution you have.

In my case (running Gentoo), I did have to include the driver for USB CDC ACM to the kernel.

Plugging in my relay, I can see this using dmesg:

[76094.036163] usb 4-1: new full-speed USB device number 4 using uhci_hcd
[76094.618717] usb 4-1: New USB device found, idVendor=2a19, idProduct=0c02
[76094.618722] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[76094.618725] usb 4-1: Product: Numato Lab 8 Channel USB Relay Module
[76094.618728] usb 4-1: Manufacturer: Numato Systems Pvt. Ltd.

Running lsusb I see ttyACM0 appear. But sending command strings to it using echo -ne 'string' > /dev/ttyACM0 has no effect. Additionally, ls -al of /dev shows that ttyACM0 is not a character device file. In fact it shows:

-rw-rw-rw- 1 root root 13 Nov 9 09:38 ttyACM0

Is there some other driver or module which I need to enable? Why doesn't ttyACM0 show as a character device? Is there something wrong with the way I am sending the commands to ttyACM0?

I have the relay running successfully on Windows after I install the Windows driver provided by the company. I can send it commands using PuTTY with no problems, but I can't find out what I haven't done right on Linux.

1

The device /dev/ttyACM0 is a virtual serial port. You'll need to use a terminal emulator to connect to it such as PuTTY, minicom, or screen. With screen you would run something like

screen /dev/ttyACM0 9600

where 9600 is your baud rate. That will give you an interactive session to communicate with the board.

  • I've tried screen and PuTTY on Linux and no joy. I think an interesting thing is that it doesn't show as a character device when I ls /dev, where the other tty* show as either character or block devices. – CaptJak Nov 9 '15 at 21:53
  • That's because you just echoed something to /dev/ttyACM0 while it was not created, and you created that regular file with echo. It clearly shows that either you don't have USB CDC support in your kernel, or you have to create such a node with mknod manually (old Linux), or your dynamic node manager - udev / mdev rules are out of date. – user140866 Nov 10 '15 at 7:26
  • Also please edit your question and attach output of lsusb. – user140866 Nov 10 '15 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.