Impossible to connect to my raspberry pi zero + Luos module


#1

Hi there,

So I tried with a wireless and a wired connection :

1. My raspberry pi board with the Luos module is connected to a USB port on my computer

With Ubuntu and Jupyter, the following line returned an access problem : robot = Robot(’/dev/ttyS4’)

So I tried :

dmesg | grep tty

(only the tty0 and the ttyS4 ports are listed)

ls -la /dev/ttyS4

(returns crw-rw---- 1 root dialout)

sudo chmod 777 /dev/ttyS4
sudo reboot -h now

Now the command runs indefinitely. I also tried to physically change the USB port I plug the board into.

2. The raspberry pi board and the computer are on the same 2.4 Ghz wireless network.

robot = Robot(‘192.168.43.227’)

Sometimes it runs indefinitely and sometimes it returns :

ConnectionRefusedError: [Errno 111] Connection refused

(On Ubuntu)

or

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

(On windows 10)

Any idea on how to solve that problem ?

Also, the documentation is rather light … So it’s hard to debug when we don’t know much about what’s going on under the hood.

Thanks for the help !


#2

The Usb port of the Raspberry pi is only used to power the raspberryPi. There is no data connection using this port.

Are you able to ping your raspberry from your computer?

You right we will work on it soon.
Your raspberry is just a pipe between a wifi websocket and the Luos network


#3

Even the one that says “USB” instead of “PWR IN” ? Isn’t it supposed to power AND allow data transfert ?

I am indeed able to ping or SSH into the raspberry


#4

No this one is a master USB (with an illegal micro type). You can’t communicate using 2 master USB together (except with USBC).

OK, It’s sounds like no web socket is available on the RPI.
Are you using an SD preinstalled by us? If you are using RPI module with a RPI zero it should be.
If yes, can you try to connect to your pi using SSH and stop and restart the dedicated service :
sudo systemctl disable pyluos-usb2ws.service
and
sudo systemctl enable pyluos-usb2ws.service
Tell me if something wrong happen after that?


#5

It is indeed a SD card presinstalled by Luos.

I stopped and restarted the service but I still endup with the following error :

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it


#6

The full error being:

ConnectionRefusedError Traceback (most recent call last)
in ()
----> 1 robot = Robot(‘192.168.43.227’)

~\Anaconda3\lib\site-packages\pyluos\robot.py in init(self, host, IO, log_conf, test_mode, *args, **kwargs)
58 else:
59 self._io = io_from_host(host=host,
—> 60 *args, **kwargs)
61
62 if os.path.exists(log_conf):

~\Anaconda3\lib\site-packages\pyluos\io_init_.py in io_from_host(host, *args, **kwargs)
52 for cls in IOs:
53 if cls.is_host_compatible(host):
—> 54 return cls(host=host, *args, **kwargs)
55
56 raise ValueError(‘No corresponding IO found (among {}).’.format(discover_hosts))

~\Anaconda3\lib\site-packages\pyluos\io\ws.py in init(self, host, port)
42 url = ‘ws://{}:{}’.format(host, port)
43
—> 44 self._ws = websocket.create_connection(url)
45
46 def is_ready(self):

~\Anaconda3\lib\site-packages\websocket_core.py in create_connection(url, timeout, class_, **options)
509 skip_utf8_validation=skip_utf8_validation, **options)
510 websock.settimeout(timeout if timeout is not None else getdefaulttimeout())
–> 511 websock.connect(url, **options)
512 return websock

~\Anaconda3\lib\site-packages\websocket_core.py in connect(self, url, **options)
218 “”"
219 self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options),
–> 220 options.pop(‘socket’, None))
221
222 try:

~\Anaconda3\lib\site-packages\websocket_http.py in connect(url, options, proxy, socket)
118 sock = None
119 try:
–> 120 sock = _open_socket(addrinfo_list, options.sockopt, options.timeout)
121 if need_tunnel:
122 sock = _tunnel(sock, hostname, port, auth)

~\Anaconda3\lib\site-packages\websocket_http.py in _open_socket(addrinfo_list, sockopt, timeout)
188 break
189 else:
–> 190 raise err
191
192 return sock

~\Anaconda3\lib\site-packages\websocket_http.py in _open_socket(addrinfo_list, sockopt, timeout)
168 address = addrinfo[4]
169 try:
–> 170 sock.connect(address)
171 err = None
172 except ProxyConnectionError as error:

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it


#7

This message means your computer fail to connect to the web socket.
If you can ping your Raspberry and start the service it could be your network that refuse the websocket ports.
Can you try it on another router?


#8

I’m actually using a mobile hotspot generated by my mobile phone which used to work fine. Next week I’ll get my hands on another board so I’ll see if that changes something


#9

Here is what I last tried :

Use the exact Luos parameters for the wpa_supplicant.conf file of the raspberry (and maybe added an empty SSH file without extension, I don’t remember exactly)

Under Windows :

  • Uninstalled all python versions

  • Installed python 3.7.2

  • Installed Pyluos (and the additional module required when importing Pyluos)

  • Reboot

  • Ping my raspberry via its IP address and launched Python from the same terminal to connect to the raspberry

It successfully worked … one time only.

I’m now unable to make it work again.


#10

I never see something like that.
It worked only the first time or only one time?
Did you try it unsing another computer?


#11

On the same computer I tried with a fresh install of Ubuntu 18.04 with both Python2 and Python3 (in virtual environments) and I still get the same :

[Errno 111] Connection refused.

Even though at first I got a :

b’{“detection”: {}}’

Someone tried on another computer with Ubuntu and succeeded


#12

So, if i understand well, your problem come from your computer?


#13

That’s what I thought too but installing pyluos 1.0.8 solved the issue … for a minute.

Now it doesn’t work anymore.

I also tried updating the firmware of the gate module (the one attached to the raspberry pi) then tried with pyluos 1.0.7 then 1.0.8 then 1.0.9 then 1.0.10 then 1.0.11 AND 1.0.12 but I still get a “connection refused” error.

I feel pretty powerless after all I’ve tried already.


#14

i have the same error :
ConnectionRefusedError: [Errno 111] Connection refused

configuration :
_Computer :
-Uubntu 18.04
-Python3.6
-pyluos 1.0.12

_RPI :
-RPI 0W
-Gate module (firmware 0.3.2)
-Battery module
-battery 7.4V 3300mAh

I’m so desperate, what can i do ?


#15

I’m not sure this connection refused thing come from Luos side. This part is managed by the OS and by the network itself so changing Pyluos or module revision don’t change anything.

I think we should rely on the OS network management so the only other weak point for this subject could be the program launched into the raspberry pi to manage the websocket.

Here is the program : https://github.com/Luos-Robotics/pyluos/blob/master/pyluos/tools/usb2ws.py

This python code is launched at boot by the raspberry pi and just copy data between Websocket and serial port without doing anything with it. The revision of Pyluos of your raspberry pi should not change anything about connection.

Perhaps this program doesn’t start properly on your raspberry, but we already try this on the reply number 4.
Do you change anything on the raspberry except the network configuration?