Wifi on boot script

Pynq Z1, version 2.4

Hello, I am trying to create a script file to run on boot and connect to my wifi network.
When I connect through the wifi file in common folder, everything works good.
I would just like to boot the board away from my router and not have to connect manually every time.
I am using the EASTECH Ralink RT5370 Raspberry PI WiFi Adapter.

Here are the steps I have done:

  • I created a file in /bin/ called wifi_start.py

from pynq.lib import Wifi
port = Wifi()
ssid = “MyNetworkName”
pwd = “MyPassword”
port.connect(ssid, pwd)

  • Actual name and password are substituted here
  • Ran sudo crontab -e
  • Added this line @reboot python3 /bin/wifi_start.py &

It seems the file is running but it the network is not connecting
Here is the output of ifconfig:

wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 1c:bf:ce:19:35:b2 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Anything I could be doing wrong?

1 Like

Update:

I got it to work using another method.
Using method 3 from instructions on this website:
https://www.dexterindustries.com/howto/run-a-program-on-your-raspberry-pi-at-startup/

Edit:
Also had to connect through the new IP that is set to wlan0, to get to the Jupyter notebook.
It didn’t work through the proxy anymore.

1 Like

Thanks a lot! Works for me too.
very helpful.

1 Like