View: 4210|Reply: 3

aisdispatcher orangepi zero

[Copy link]

2

threads

5

posts

26

credits

Novice

Rank: 1

credits
26
Published in 2018-2-12 00:54:07 | Show all floors |Read mode
Edited by afric at 2018-2-12 04:47

Hi
i have an orangepi zero with Armbian_5.35_Orangepizero_Debian_jessie_default_3.4.113
and i try to install and run aisdispatcher as i make to my raspberry... but it is not working
i am newbie....

the way i try is

wget http://aishub.net/downloads/aisdispatcher_arm_glibc.tar.gz
tar zxvf aisdispatcher_arm_glibc.tar.gz

i run after that
sudo aisdispatcher_arm_glibc/aisdispatcher -r -d /dev/ttyUSB0 -s 38400 -H 192.168.1.100:13000      (i have found the ttyUSB0  with dmesg)

but i take

unable to execute aisdispatcher_arm_glibc/aisdispatcher: No such file or directory

(with "ls" i find both folder and file)



can anybody help me?

edit:
root@orangepizero:~/aisdispatcher_arm_glibc# ls
aisdispatcher
(i run)
root@orangepizero:~/aisdispatcher_arm_glibc# file *
(and i take)
Could not find the database of available applications, run update-command-not-found as root to fix this
file: command not found


i did this
root@orangepizero:~/aisdispatcher_arm_glibc# chmod +x aisdispatcher
root@orangepizero:~/aisdispatcher_arm_glibc# ls -l
total 868
-rwxrwxr-x 1 orangepi users 887323 Aug 16  2012 aisdispatcher

but still nothing

root@orangepizero:~/aisdispatcher_arm_glibc# ./aisdispatcher
-bash: ./aisdispatcher: No such file or directory
root@orangepizero:~/aisdispatcher_arm_glibc#

edit2:
i install python-serial with

sudo apt-get install python-serial python3-serial
sudo nano read_serial.py

#{
#!/usr/bin/env python
import time
import serial

ser = serial.Serial(
port='/dev/ttyUSB0',
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 when i run
sudo python read_serial.py

i take messages from serial  






2

threads

5

posts

26

credits

Novice

Rank: 1

credits
26
 Author| Published in 2018-3-3 21:44:02 | Show all floors
Edited by afric at 2018-3-3 21:53

Final i install  python

  1. sudo apt-get install python-serial python3-serial
  2. sudo nano read_serial.py
Copy code
i write the script
  1. #start read_serial.py script
  2. #{
  3. #!/usr/bin/env python
  4. import time
  5. import serial

  6. ser = serial.Serial(
  7. port='/dev/ttyS2',
  8. baudrate = 38400,
  9. parity=serial.PARITY_NONE,
  10. stopbits=serial.STOPBITS_ONE,
  11. bytesize=serial.EIGHTBITS,
  12. timeout=1
  13. )
  14. counter=0


  15. while 1:
  16. x=ser.readline()
  17. print x
  18. #}
  19. #end read_serial.py script
Copy code
and i run
  1. sudo python read_serial.py
Copy code
to see if ti works
after that i write onether script (i find it ready)
  1. sudo nano serial_to_udp.py
Copy code
  1. #start script
  2. # Python script for serial to UDP communication
  3. # Alex Olwal, 2012 03 24
  4. # www.olwal.com
  5. #

  6. import serial
  7. import sys

  8. from socket import *

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

  11. baud_rate = 38400

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

  17. serial_port = sys.argv[1]

  18. if ( len(sys.argv) >= 3 ):
  19.         udp_ip = sys.argv[2]
  20. else:
  21.         udp_ip = "127.0.0.1"

  22. if ( len(sys.argv) >= 4 ):
  23.         udp_port = sys.argv[3]
  24. else:
  25.         udp_port = "5000"
  26.                
  27. if ( len(sys.argv) >= 5):
  28.         printing = 1
  29. else:
  30.                 printing = 0

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

  33. udp_port = int(udp_port)

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

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

  37.         if (line != ''):
  38.                         if (printing):
  39.                                 print line[:-1]
  40.             
  41.                         send( line, udp_ip, udp_port )

  42.         else:
  43.             if (printing):
  44.                 print "."

  45. s.close()
  46. #end script
Copy code
now if you run sudo python serial_to_udp.py you will take
  1. Serial-to-UDP utility | Alex Olwal, 2012, www.olwal.com
  2. Syntax: serial_to_udp.py serial_port udp_ip(= 127.0.0.1) udp_port(= 5000)
  3. Example: serial_to_udp.py COM20 127.0.0.1 5000
Copy code
so i run
  1. python serial_to_udp.py  /dev/ttyS2 192.168.1.100 13000 &
Copy code
and i take serial data from ttyS2 (i have a MAX3232 RS232 Serial Port To TTL ) and i sent it to my pc at port 13000







2

threads

5

posts

26

credits

Novice

Rank: 1

credits
26
 Author| Published in 2018-3-3 21:57:37 | Show all floors
Now i want to start it on boot by put at /etc/rc.local

i run
  1. sudo nano /etc/rc.local
Copy code

and i write
  1. python serial_to_udp.py  /dev/ttyS2 192.168.1.100 13000 &
Copy code

before the exit0 but it doesn't start after reboot...

when i run
  1. sudo /etc/init.d/rc.local start
Copy code

i take ok

can any body help me?

2

threads

5

posts

26

credits

Novice

Rank: 1

credits
26
 Author| Published in 2018-3-4 05:10:07 | Show all floors
Edited by afric at 2018-3-4 05:16

no help!!!!
why i ask for help here? nobody knows?

i find solution alone....

i create a script
  1. sudo nano /etc/init.d/serial_to_udp.sh
Copy code
  1. #!/bin/sh
  2. python serial_to_udp.py  /dev/ttyS2 192.168.1.100 13000 &
Copy code
i make it  executable with
  1. sudo chmod +x /etc/init.d/serial_to_udp.sh
Copy code
and after that i run
  1. sudo update-rc.d serial_to_udp.sh defaults
Copy code
and after that i modified again the  rc.local
  1. sudo nano /etc/rc.local
Copy code
i write
  1. /etc/init.d/serial_to_udp.sh
  2. sh '/etc/init.d/serial_to_udp.sh'
Copy code
before exit0

  1. sudo reboot
Copy code
and it worksssssssssss
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list