Connect to REPL over WI-Fi

The official PYBD running MicroPython, and its accessories.
Target audience: Users with a PYBD
Post Reply
MrRobot
Posts: 31
Joined: Mon May 11, 2020 11:30 am

Connect to REPL over WI-Fi

Post by MrRobot » Tue Oct 13, 2020 2:44 pm

I've been trying to use the webrepl functions with the PYBD.

In other threads it hints that this is possible but it doesn't seem to work.

I'm running the latest stable 1.12 release.

I've ran an access point using this code:

Code: Select all

import network

wl_ap = network.WLAN(1)
wl_ap.config(essid='PYBD')          # set AP SSID
wl_ap.config(password='pybd0123')   # set AP password
wl_ap.config(channel=6)             # set AP channel
wl_ap.active(1)                     # enable the AP
I then downloaded the repository from here and connected to webrepl.html

https://github.com/micropython/webrepl

But there's no connection using webrepl.

I can ping 192.168.4.1 no issue.

Is there anyway to get REPL over Wi-Fi on the pyboard D? Or better yet rshell?

MrRobot
Posts: 31
Joined: Mon May 11, 2020 11:30 am

Re: Connect to REPL over WI-Fi

Post by MrRobot » Tue Oct 20, 2020 9:17 am

For anyone reading this: I figured it out

Make sure you've a decent antenna attached to your Pyboard D

First run this code:

Code: Select all

import webrepl_setup
And follow the prompts (mainly setting a password)

Then run this code:

Code: Select all

import network

wl_ap = network.WLAN(1)
wl_ap.config(essid='SSID')          # set AP SSID
wl_ap.config(password='PASSWORD')   # set AP password
wl_ap.config(channel=6)             # set AP channel
wl_ap.active(1)                     # enable the AP

wl_ap.status('stations')    # get a list of connection stations
Download the webrepl repository from Github: https://github.com/micropython/webrepl

On your device connect to the Wi-Fi network you set up in the code above (SSID)

Open the webrepl.html file from the repository

Click connect and you should be prompted for a password (the one from webrepl_setup)

Hopefully it works for you :D

kbrenner
Posts: 31
Joined: Mon Jan 20, 2020 8:05 pm

Re: Connect to REPL over WI-Fi

Post by kbrenner » Thu Nov 05, 2020 3:48 pm

Can you explain the steps involved with "On your device connect to the Wi-Fi network you set up in the code above (SSID)"? I am relatively novice with Micropython and the Pyboard in general.

MrRobot
Posts: 31
Joined: Mon May 11, 2020 11:30 am

Re: Connect to REPL over WI-Fi

Post by MrRobot » Thu Nov 05, 2020 4:30 pm

Whatever you put in for SSID here:

Code: Select all

wl_ap.config(essid='SSID')
The SSID is the Wi-Fi name that you'll see on your PC

kbrenner
Posts: 31
Joined: Mon Jan 20, 2020 8:05 pm

Re: Connect to REPL over WI-Fi

Post by kbrenner » Thu Nov 05, 2020 5:23 pm

I am able to connect to the Pyboard over wifi, and in my REPL prompt, I see:

DHCPS: client connected: MAC=74:da:38:e8:be:2c IP=192.168.4.16

On my webrepl, I have modified the IP address to look like:

ws://192.168.4.16

However, when I hit connect, it immediately disconnects without anything else showing up. Am I missing a step here?

User avatar
Roberthh
Posts: 2282
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Connect to REPL over WI-Fi

Post by Roberthh » Thu Nov 05, 2020 7:35 pm

Use port 8266:

ws://192.168.4.16:8266

Post Reply