Orange Pi ttl serial port [SOLVED]
dbemowsk last edited by dbemowsk
So I have Domoticz set up on an Orange Pi PC board which has a 3 pin ttl serial port right next to the power connector. I was hoping that I could connect that to my gateway which would free up my USB serial adapter for other uses, not to mention making the setup less bulky. I have two main issues with it.
First, the port in linux that references it is /dev/ttlS0. When I try to open my serial monitor to use that port, it can't connect to it for some reason. However, if I go to a terminal and type "cat /dev/ttlS0" and reset the gateway, I see the gateway identification data come through.
Second, when I look at the setup of the gateway in Domoticz, I don't have the option of selecting that serial port. The only port it shows me for a selection is /dev/ttlUSB0, and that is only if I have my USB adapter plugged in. If I unplug that and refresh, I have 0 options in the drop down list for the port selection. Is Domoticz set up to ONLY look at USB serial devices? If so, is there any way I can change that?
@dbemowsk for the first question, I would look at the permissions on the device (ls -l). Are they different from the device that works?
For the second question, yes Domoticz only looks at devices named USB*. This is easily solved with a link, see Enable the gateway for ues with Domoticz at https://forum.mysensors.org/topic/2437/step-by-step-procedure-to-connect-the-nrf24l01-to-the-gpio-pins-and-use-the-raspberry-as-a-serial-gateway (don't forget to edit rc.local)
@mfalkvidd OK, we'll try to get through the first part and I think your suggestion for the symbolic link on the second part is going to work just fine. That was something I hadn't thought of.
Now, as for the first part, looking at ls -l for /dev/ttyS0 vs /dev/ttyUSB0, there are two differences that I see that could affect this. The first is as you mentioned, permissions.
Crw--w---- for /dev/ttyS0
Crw-rw---- for /dev/ttyUSB0
The second issue is that /dev/ttyUSB0 is in the group dialout, but /dev/ttyS0 is in the group tty. So I did 2 things. I added the orangepi user to the tty group with "usermod -a -G tty orangepi". Next I tried to change the permissions for /dev/ttyS0 using "chmod 660 /dev/ttyS0" which did change the permissions, but as soon as I did a restart to get the user groups to update properly, I tried opening the port in CuteCom and it said that I could not open it. I checked the permissions again and it seems that that is something that gets checked and reset on reboot. I am not sure where to look to find where it checks the permissions on that. I could have a shell script that runs on boot that changes it back to the 660 permissions, but I think that is pointless if there is a way to disable the change back in the first place.
Thanks for the help.
The serial port might be setup for console login. In that case you should disable that to use the port for another program. You can google how to check and do that.
Then use a udev rule if you want to have persistent change of permissions of the port.
@martinhjelmare I think I do recall reading something that that port was for console logins. I liked it because it was an easy 3 pin header to connect to. I think /dev/ttyS1 is on the GPIO header. I will look at using that one.
So I found that GPIO pins 6, 8 and 10 were /dev/ttyS3. I used the link from @mfalkvidd and did the symbolic link and changed the /etc/rc.local file and I now have everything working in Domoticz on /dev/ttyUSB30. I cannot seem to see the device in CuteCom, but if I need to debug in there I can do it on /dev/ttyS3.
Thanks for the help guys. you are great.