Help with connecting pi to Ethernet to Serial converter

89 views
Skip to first unread message

Daryl Maunder

unread,
Jul 30, 2013, 9:27:18 AM7/30/13
to connected-commu...@googlegroups.com

I have been trying for some time to get my Raspberry PI to talk to a Ethernet to RS485 converter that is connected to my Aurora PV inverter. It isn’t a good thing to bring to the space, since I need the inverter too, and it turns off at 6pm or thereabouts. Is there someone with enough linux/pi expertise that can help me get a virtual serial port created on the pi? I have been trying for ages to get it working. Works fine from Windows. Main issue is it can obviously only can be done in daylight hours.

 

Thanks

 

Regards

Daryl

 

David Lyon

unread,
Jul 31, 2013, 7:13:26 PM7/31/13
to connected-commu...@googlegroups.com


On Tue, Jul 30, 2013 at 11:27 PM, Daryl Maunder <dmau...@midnightoil.com.au> wrote:

I have been trying for some time to get my Raspberry PI to talk to a Ethernet to RS485 converter that is connected to my Aurora PV inverter. It isn’t a good thing to bring to the space, since I need the inverter too, and it turns off at 6pm or thereabouts. Is there someone with enough linux/pi expertise that can help me get a virtual serial port created on the pi? I have been trying for ages to get it working. Works fine from Windows. Main issue is it can obviously only can be done in daylight hours.



Hi Daryl,

First, have you turned 'off' the console debug/input on the serial port ?

 - See http://www.irrational.net/2012/04/19/using-the-raspberry-pis-serial-port/

After that, it should behave as a normal 3.3V Serial port.

Luke Weston

unread,
Aug 8, 2013, 7:58:31 AM8/8/13
to connected-commu...@googlegroups.com
OK, so you've got your Raspberry Pi plugged into the LAN, i.e plugged in to some sort of switch or router (or WiFi) and you've also got the ethernet RS-485 device plugged in to the LAN? (And from there obviously the RS-485 interface is connected to the inverter.)
Is that correct?

I don't think the uncertainty here lies with the inverter, it lies with the much-more-portable ethernet RS-485 interface. Can you talk to the interface from your PC when it's plugged in? Usually these things can be configured via a web page served up at whatever the default IP address is (should be documented) just like you'd configure any old entry level router. Or in some cases you might need to telnet into it or something for configuration.

Alternatively, if you're comfortable with the electronics, a simpler approach might be to connect the RPi (via UART Tx/Rx pins on the RPi) to an RS485 transceiver such as the ST1480A, and connect that to the inverter's RS485 port. Since you're presumably using only two devices on the RS-485 bus, you might be able to get away without using a couple of extra GPIO pins on the RPi to handle the RS485 control lines, controlled appropriately to enable and disable the tristate buffers when needed, and you might be able to just leave them enabled.


On Tue, Jul 30, 2013 at 11:27 PM, Daryl Maunder <dmau...@midnightoil.com.au> wrote:

--
You received this message because you are subscribed to the Google Groups "Connected Community HackerSpace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to connected-community-h...@googlegroups.com.
To post to this group, send an email to connected-commu...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/connected-community-hackerspace/7050DA59889BBE4791CC766089108BF613E4BD41%40MOC-SERVER.moc.local.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
This email is intended only for the personal and confidential use of the human(s) named above. If intercepted by an extraterrestrial civilization, all opinions expressed in this email are my own and do not necessarily reflect the opinion of mankind as a whole.

Daryl Maunder

unread,
Aug 8, 2013, 9:32:15 PM8/8/13
to connected-commu...@googlegroups.com

Yes thanks guys, I came along to the raspberry pi jam on Saturday and Angus and then Alec got me up and going.

 

Turned out the program I was running didn’t have permissions to the virtual serial port.  Chgrp fixed that up, so simple when you have the right knowledge. All working perfectly now.

 

Regards for the suggestions.

Daryl

Andy Gelme

unread,
Aug 8, 2013, 9:48:56 PM8/8/13
to connected-commu...@googlegroups.com, Daryl Maunder
hi Daryl,


On 2013-08-9 11:32 , Daryl Maunder wrote:
Turned out the program I was running didn’t have permissions to the virtual serial port.  Chgrp fixed that up, so simple when you have the right knowledge. All working perfectly now.

Instead of using "chgrp" (temporarily changing the device group) ... you can permanently add your user to the correct group.

First, you check the group ownership of the tty serial device ...

  ls -l /dev/tty*
  crw-rw---- 1 root dialout     204, 64 Jun 27 08:17 /dev/ttyAMA0

... which is usually "dialout".  And, then ensure that the user which is trying to open that device belongs to the same group by editing /etc/group

For example, here is how you'd give the "pi" user the appropriate access.

  sudo vi /etc/group
    dialout:x:20:pi

You'll need to logout / login for this to have the desired effect.

You can use the "id" command to see if your user now belongs to the correct group ...

  id
    uid=1000(pi) gid=1000(pid)
    groups=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),...

You can see "20(dialout)", which means you are good-to-go.

-- 
-O-  cheers  =  /\ /\/ /) `/ =
--O                           --  http://www.geekscape.org     --
OOO  --  an...@geekscape.org  --  http://twitter.com/geekscape --

Daryl Maunder

unread,
Aug 8, 2013, 9:53:01 PM8/8/13
to Andy Gelme, connected-commu...@googlegroups.com

Hi Andy,

 

The command was chgrp tty aurora (aurora is the program that was accessing the port) and it seems to have fixed it permanently.  But all increasing my linux knowledge.

 

Regards

Daryl

 

From: Andy Gelme [mailto:an...@geekscape.org]
Sent: Friday, 9 August 2013 11:49 AM
To: connected-commu...@googlegroups.com
Cc: Daryl Maunder
Subject: Re: [CCHS] Help with connecting pi to Ethernet to Serial converter

 

hi Daryl,

Andy Gelme

unread,
Aug 8, 2013, 10:10:57 PM8/8/13
to connected-commu...@googlegroups.com, Daryl Maunder
hi Daryl,


On 2013-08-9 11:53 , Daryl Maunder wrote:
The command was chgrp tty aurora (aurora is the program that was accessing the port) and it seems to have fixed it permanently.  But all increasing my linux knowledge.

Okay, that's another way to do it ... which is known as "setuid bit / setgid bit" or setting the user/group executable permission on a program (executable file).

For your "chgrp" command to work, I'm pretty sure that the "setgid bit" would also need to be set ...

   chmod ug+s aurora

... otherwise only setting the group to "tty" on the "aurora" executable would have no useful effect.

There are security implications to this approach, mainly that any user with access to the "aurora" program can now run it with access rights of the user and group that you've set.  If there are any bugs in the program that can be exploited, then any user can take advantage of them.

   http://en.wikipedia.org/wiki/Setgid#setuid_on_executables

That is why it is usually better to associate privileges / permissions with a particular user (as I suggested in the previous email) ... rather than for all users who can run the program.
Reply all
Reply to author
Forward
0 new messages