Raspberry to (usb) RS485

551 views
Skip to first unread message

Emdek

unread,
Jan 25, 2014, 11:31:53 AM1/25/14
to web...@googlegroups.com
Hi,

I've been searching for a while now, can't figure it out myself:
I want to control screens and shutters from a webinterface by sending hexadecimal commands over serial. It has to be RS485, that's the only interface the controlling device has on board.
My idea was to use a Raspberry Pi in combination with a USB to RS485 serial adapter (PL-2303). This works, I installed Raspbian Wheezy and I can succesfully control the interface using python scripts from a terminal screen. 
The next step was to run the python scripts from a web interface. I installed Apache, PHP etc but can't find a simple way to run my python scripts from the webinterface.

I stumbled upon WebIOPi, which seems to be just what I need: a simple webserver to control other devices with serial commands. I can't figure out though how I can send an hex string to the USB0 serial device.
One of the strings I need to send (and which works running a python script from terminal) is \x7F\xF2\xFA\x01\x00\x00\xAE\x78\xFA\xFF\xFB\x06\x86

Should I focus on running my (working) python script using WebIOpi or shoud I use a different approach?
Please advise.

Emdek

Emdek

unread,
Jan 25, 2014, 11:48:32 AM1/25/14
to web...@googlegroups.com
Forgot something: I can configure WebIOPi to use usb0 in the conf file, but I can only set the speed/baudrate, not parity etc. Any ideas?

Op zaterdag 25 januari 2014 17:31:53 UTC+1 schreef Emdek:

Maciek Wąchalski

unread,
Jan 25, 2014, 12:47:47 PM1/25/14
to web...@googlegroups.com
You should start with Serial Tutorial:

Eric PTAK

unread,
Jan 25, 2014, 1:28:04 PM1/25/14
to web...@googlegroups.com
advanced serial settings like parity is not provided. common UART settings is used (8N1 ? I don't remember)
don't know if you need different settings for RS485 ?

you don't need apache/php, WebIOPi is all-in-one including http server.
You have to begins with the basic tutorial, you will understand how webiopi works.
Then go further with macros, then serial.

In order to send bytes, you need to use writeBytes function from a python script, and avoid using the REST API as mentioned in the tutorial.


--
You received this message because you are subscribed to the Google Groups "WebIOPi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webiopi+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Charudatt Uplap

unread,
Aug 24, 2014, 4:39:42 AM8/24/14
to web...@googlegroups.com, erde...@gmail.com

Hi Emdek, did you get what you are looking for ? I have a similar requirement to turn ON/OFF relay board over RS485.


Thank you.
Reply all
Reply to author
Forward
0 new messages