WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: RaspberryPi as RS232 multiplexer using piCore  (Read 583 times)

Offline stoker

  • WikiUser
  • *
  • Posts: 7
RaspberryPi as RS232 multiplexer using piCore
« on: June 02, 2017, 04:22:33 AM »
Hi

I've been using piCore for sometime now in the form of piCorePlayer and it occurred to me that a rPi with piCore might be suitable for a project I'm starting to think about.

I'd like make a rs232 multiplexer. I'd need 3 rs232 ports (2 input only and 1 bi-directional). I'd also need the rPI to act as a wifi access point so that users can connect to the rPi with their smart phones to receive the rs232 data repackaged as UDP or Tcp/IP packets.

Is it possible to use 3 USB-RS232 adapters with rPI/piCore? Or possibly 2 adapters and rPi's built in rs232 interface?

Is it possible to use a USB WiFi dongle as a wireless access point, for multiple connected devices? there will be no need for the system to be connected to the internet (or any other network once it's been configured).

I'm intending (if possible) to write the software to control this in Python.

If anyone has any suggestions as to the viability of the rPI/piCore for this application or any answers to the above questions I'd be very grateful.

Thanks in advance
--Ian

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1540
Re: RaspberryPi as RS232 multiplexer using piCore
« Reply #1 on: June 02, 2017, 05:01:42 AM »
I can't say anything about RS-232 but I just made my RPi3 a WiFi access point using busybox dhcpd and hostapd.
Download a copy and keep it handy: Core book ;)

Offline stoker

  • WikiUser
  • *
  • Posts: 7
Re: RaspberryPi as RS232 multiplexer using piCore
« Reply #2 on: June 05, 2017, 12:11:40 AM »
Thanks Misalf, I'll take a look at dhcpd and hostapad

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1540
Re: RaspberryPi as RS232 multiplexer using piCore
« Reply #3 on: June 05, 2017, 01:30:04 AM »
I might be off here as I have no idea how a RS-232 multiplexer is used, however, if you run out of serial devices (i.e.  /dev/ttyS0  to  /dev/ttyS3  is not enough) you can increase their number via boot code:
Code: [Select]
8250.nr_uarts=8
Download a copy and keep it handy: Core book ;)

Offline andyj

  • Sr. Member
  • ****
  • Posts: 452
Re: RaspberryPi as RS232 multiplexer using piCore
« Reply #4 on: June 05, 2017, 04:07:01 AM »
Your best bet might be to use USB to serial converters and a USB hub, or one of the multiport adapters available. I've used USB to RS-232 and RS-485 converters with Linux no problems; they've always worked right out of the box on Slackware. You'll just need to find the extension that has the modules you need for the converters you use.

Offline stoker

  • WikiUser
  • *
  • Posts: 7
Re: RaspberryPi as RS232 multiplexer using piCore
« Reply #5 on: June 05, 2017, 09:00:48 AM »
Thanks again for the replies, it looks like it could work then. I'll do some further research.

Just as background, this would be used on a sailing yacht, we have instrumentation (wind/depth/speed/compass) which provides an RS232 stream of data, we also have a GPS and AIS which also provide RS232 streams of data. What I intend to do is receive all this data on a rPi and then make it available as Tcp/ip so that various hand help devices and the yachts on board laptop can connect using WiFi. These computing devices are used to help with navigation and tactical decision making when racing.

Cheers
--Ian   

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1540
Re: RaspberryPi as RS232 multiplexer using piCore
« Reply #6 on: June 05, 2017, 10:08:04 AM »
I just noticed I said
  busybox dhcpd 
where I should have said
  busybox udhcpd 
Download a copy and keep it handy: Core book ;)

Offline M-H

  • WikiUser
  • *
  • Posts: 20
Re: RaspberryPi as RS232 multiplexer using piCore
« Reply #7 on: June 08, 2017, 02:33:04 PM »
Hi Stoker.

Nice idea to redistribute that data over WIFI.
You could put all data on a web page and serve that from the pi.
At the same time it could also be displayed on a monitor connected to the pi.
And of course log the info to some USB stick for later review, like a plane its back box.
But for safety/backup be sure you can access the info if the pi is not functional.
And do not show info that is no longer current.

Serial to USB devices should give you up to 3 inputs on a pi B+ and newer,
I wouldn't use the pi3 onboard wifi, as its driver support isn't topnotch jet.
So add a wifi dongle to the 4th port.
With signal level converters you should be able to use the onboard uart too, if you need a 4th.

Greetz M-H

Offline jefferee

  • WikiUser
  • *
  • Posts: 8
Re: RaspberryPi as RS232 multiplexer using piCore
« Reply #8 on: June 27, 2017, 08:48:59 AM »
+1 on using a multiport adapter. Anything with an FTDI chipset should work out of the box.

Occasionally I see a line in dmesg like
Code: [Select]
ftdi_sio ttyUSB13: usb_serial_generic_read_bulk_callback - urb stopped: -32which will stop comms on that port until my software detects the inactivity, closes the port, and reopens. Not a big deal, probably a once-a-week occurrence, but your code will need to detect when fresh data stops and handle accordingly.
« Last Edit: June 27, 2017, 08:52:37 AM by jefferee »

Offline stoker

  • WikiUser
  • *
  • Posts: 7
Re: RaspberryPi as RS232 multiplexer using piCore
« Reply #9 on: August 08, 2017, 12:58:41 AM »
I just noticed I said
  busybox dhcpd 
where I should have said
  busybox udhcpd

Thanks for the clarification.

I've just come back to this after a while doing other stuff. I now have my rPI3 up and running using piCore 9.0.3. Unfortunately I'm having trouble finding much info about how to use busybox udhcpd, maybe I'm just not good at google! I have found this tutorial about turning a rPi into a wireless access point: http://elinux.org/RPI-Wireless-Hotspot

The tutorial is aimed at Rasbian not PiCore but I was hoping it'd be similar with piCore. The first issue I'm having is the tutorial references 2 config files: /etc/udhcpd.conf and /etc/default/udhcpd neither of which exist in piCore. Should I just create them in the location specified? I've tried using find and I'm pretty sure they don't exist else where in the file system.

Thanks for any help on this.
Cheers
Ian

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 9370