unic
Posts: 2
Joined: Sat Aug 04, 2012 5:07 pm

Socket Server to send strings/data from lan to serial ?

Sun Aug 12, 2012 6:59 pm

Hello,

iam not very good in C. I used an arduino to build a remotcrontroller interface for my Iphone with NETIO app. My problem is that the arduinio ethernetdevice is to slow to get all the informations from ethernetsocket in realtime.

My idea was to use the raspberry PI as a bridge. collection the Data from Ethernet (wifi) Socket, change / splitt the information and send the to the arduino over usb ftdi converter or the uart pins from the raspberry.

As iam realy new to raspberry i want to now how i can start. does someone have examplecode were i can start with ? maybe a good book with the needed informations would be great too.

I Think its more a Linux thing that a raspberry beside of the UART-Interface.

Maybe its a good idea to use phyton for this ?

thx for help!

User avatar
panik
Posts: 369
Joined: Fri Sep 23, 2011 12:29 pm
Location: Netherlands

Re: Socket Server to send strings/data from lan to serial ?

Mon Aug 13, 2012 3:05 pm

Probably easiest in Python, yes. I don't have much experience with that, though.

These code examples might help you getting the project started if you decide to do it in C.
For communication with a socket: http://www.linuxhowtos.org/C_C++/socket.htm
For serial communication: http://www.teuniz.net/RS-232/

Both code examples shouldn't give you trouble on the Pi. Good luck!

Ilfirin
Posts: 15
Joined: Fri Jul 13, 2012 11:15 am

Re: Socket Server to send strings/data from lan to serial ?

Mon Aug 13, 2012 4:25 pm

Well, it depends.
Mainly on how fast it would be. Uart is always bottleneck and you'll have to set and control size of read and write buffer and work with that buffers from different threads.
queue.Queue will do that for you, so I would use it.

So on one side socket, as was mentioned, because it can handle only one client (or make raspberry be the client).
In middle Queue
And on otherside pyserial.

And hey, as I looked to pyserial documentation, there is example code for that (and without queue): http://pyserial.sourceforge.net/example ... ial-bridge

taoufiksmires
Posts: 4
Joined: Thu Mar 20, 2014 10:03 pm

Re: Socket Server to send strings/data from lan to serial ?

Sat Mar 22, 2014 5:04 pm

hello,
can i communicate using socket between pc(windows) and raspberry ??

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Socket Server to send strings/data from lan to serial ?

Sat Mar 22, 2014 6:31 pm

Hi,
taoufiksmires wrote:can i communicate using socket between pc(windows) and raspberry ??
Yes, of course.
I have doubts that there is any computer/OS capable to communicate over Internet and at the same time not "offering" sockets communication.


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

Return to “C/C++”