afric post at 2018-3-4 05:32:48

rs232 to ethernet , nmea router orange pi zero

Edited by afric at 2018-3-4 06:51

buy MAX3232 RS232 Serial Port To TTL and i Connected to uart 2- ttyS2 (pin4-5V,pin6-GND,pin11-UART2 RX,pin13-UART2 TX)

I use Armbian_5.35_Orangepizero_Debian_jessie_default_3.4.113

installpython

sudo apt-get install python-serial python3-serial
write the script
sudo nano read_serial.py
#!/usr/bin/env python
import time
import serial

ser = serial.Serial(
port='/dev/ttyS2',
baudrate = 38400,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
counter=0


while 1:
x=ser.readline()
print x
and i run
sudo python read_serial.pyto see if ti works
after that i write onether script (i find it ready)
sudo nano serial_to_udp.py
# Python script for serial to UDP communication
# Alex Olwal, 2012 03 24
# www.olwal.com
#

import serial
import sys

from socket import *

def send(msg, ip, port):
    socket(AF_INET,SOCK_DGRAM).sendto(msg, (ip, port))

baud_rate = 38400

if ( len(sys.argv) == 1 ):
      print "Serial-to-UDP utility | Alex Olwal, 2012, www.olwal.com"
      print "Syntax: " + sys.argv + " serial_port udp_ip(= 127.0.0.1) udp_port(= 5000)"
      print "Example: " + sys.argv + " COM20 127.0.0.1 5000"
      quit()

serial_port = sys.argv

if ( len(sys.argv) >= 3 ):
      udp_ip = sys.argv
else:
      udp_ip = "127.0.0.1"

if ( len(sys.argv) >= 4 ):
      udp_port = sys.argv
else:
      udp_port = "5000"
               
if ( len(sys.argv) >= 5):
      printing = 1
else:
                printing = 0

print "Reading from serial port: " + serial_port
print "Sending to " + udp_ip + ":" + udp_port

udp_port = int(udp_port)

s = serial.Serial( serial_port, baud_rate, timeout=1 )

while (1):
      line = s.readline()

      if (line != ''):
                        if (printing):
                              print line[:-1]
            
                        send( line, udp_ip, udp_port )

      else:
            if (printing):
                print "."

s.close()now if you run
sudo python serial_to_udp.pyyou will take
Serial-to-UDP utility | Alex Olwal, 2012, www.olwal.com
Syntax: serial_to_udp.py serial_port udp_ip(= 127.0.0.1) udp_port(= 5000)
Example: serial_to_udp.py COM20 127.0.0.1 5000sorun
python serial_to_udp.py/dev/ttyS2 192.168.1.100 13000 &and take serial data from ttyS2 andsent it to pc at port 13000

there are 2 ways to auto start on boot
the fisrt is direct config rc.local but put inside 1minute wait to find the ethernet
sudo nano /etc/rc.local
sleep 1m
python /root/serial_to_udp.py/dev/ttyS2 192.168.1.100 13000 &before exit0

and the other to create a script
sudo nano /etc/init.d/serial_to_udp.sh
#!/bin/sh
python/root/serial_to_udp.py/dev/ttyS2 192.168.1.100 13000 &i make itexecutable with
sudo chmod +x /etc/init.d/serial_to_udp.shand after that run
sudo update-rc.d serial_to_udp.sh defaultsand after that modified therc.local
sudo nano /etc/rc.localwrite
/etc/init.d/serial_to_udp.sh
sh '/etc/init.d/serial_to_udp.sh'before exit0

sudo rebootand it worksssssssssss:):)

xyzzsdfl post at 2022-4-1 09:46:26

That is the amazing piece of writing, Thanks a lot for the purpose of rendering everybody this. Have post.        Packers and Movers Faridabad

among1 post at 2023-8-16 18:08:47

This blog post is awesome. The material on your website proved to be quite useful to us. After finishing this article, I would like to introduce to you the game retro bowl unblocked. You can have some leisure time with your loved ones.

Aiweb3blockchai post at 2023-9-5 15:04:18

Crypto marketing involves promoting and fostering adoption of cryptocurrencies and blockchain technology. It employs strategic communication, online campaigns, and community engagement to educate and attract users, investors, and businesses to the crypto ecosystem. This includes highlighting benefits like decentralization, security, and financial freedom, while addressing potential risks. Effective crypto marketing requires a deep understanding of the technology, target audience, and compliance with regulations. It aims to build trust, showcase use cases, and drive interest, ultimately propelling the growth and mainstream acceptance of cryptocurrencies and their underlying technology.

https://themetawise.com/crypto-marketing-the-complete-guide-master-the-ins-and-outs-of-crypto-marketing/

William4 post at 2025-11-20 04:09:28

Howdy, a buddy in Vancouver asked if I’d tried a platform with simple margin controls for modest accounts. I tested isolated positions and respected my max loss per day. The funding/fees panel is easy to read, which helps when I’m tired. Mid-review I saved PrimeXBT https://primexbtai.net/. I took one clean move on BTC, scaled out in thirds, and closed the app. Nothing heroic—just structure. For me, that’s worth more than chasing one big candle and regretting it later.
page: [1]
View full version: rs232 to ethernet , nmea router orange pi zero