How to connect to COM port from Jupyter Notebook

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
priis
Posts: 12
Joined: Tue Mar 31, 2015 9:52 pm

How to connect to COM port from Jupyter Notebook

Post by priis » Wed Sep 12, 2018 7:24 pm

I have now managed to get Jupyter Notebook running a MicroPython-USB kernel on my laptop (Windows). However, when I submit the command
%serialconnect to --port=/dev/tty.SLAB_USBtoUART --baud=115200
I get the following answer:
Connecting to --port=/dev/tty.SLAB_USBtoUART --baud=115200
Try one of these ports as --port=
COM3
COM4
COM6

Next, I try %serialconnect to --port=COM6 --baud=115200, only getting this answer:
Connecting to --port=COM6 --baud=115200
[Timed out waiting for recognizable response]
Disconnecting [paste mode not working]
(You may need to reset the device)

What is the exact syntax for connecting to COM6?

mattyt
Posts: 101
Joined: Mon Jan 23, 2017 6:39 am

Re: How to connect to COM port from Jupyter Notebook

Post by mattyt » Thu Sep 13, 2018 2:03 am

You've got the right syntax; if you have a MicroPython-enabled device on COM6 that should work.

If you're not sure which COM (you're obviously on Windows) port your device is connected to open Device Manager and plug your MicroPython device into a USB port. The device - and the COM port that it enumerates to - should appear under 'Serial devices' or something similar.

When the Jupyter Notebook MicroPython kernel is suggesting COM3, 4, 6 it's just listing the available serial devices, they're not all necessarily MicroPython devices that will respond to the connection.

priis
Posts: 12
Joined: Tue Mar 31, 2015 9:52 pm

Re: How to connect to COM port from Jupyter Notebook

Post by priis » Thu Sep 13, 2018 6:39 am

Still, I can't make it work. I don't get a Ready signal.
When I try
print ('hello esp8266')
my computer responds with
No serial connected
%serialconnect to connect
%esptool to flash the device
%lsmagic to list commands

My esp8266 works with Putty via COM6.

priis
Posts: 12
Joined: Tue Mar 31, 2015 9:52 pm

Re: How to connect to COM port from Jupyter Notebook

Post by priis » Thu Sep 13, 2018 5:24 pm

I just discovered that if I submit
%serialconnect to --port=COM6 --baud=115200
from my computer and press reset on the esp8266 a couple of seconds later I in fact get a response from the esp8266, namely the following:
Connecting to --port=COM6 --baud=115200
b'sd\x00$\xdc\x9f<\x00\x84l\xe0<\x03\x0c'
b'\x0c\x8c'b'l\xe4\x0cc|\x8f\x82\x03\xec\x13\x9br\x9b#\x84'b"c\x84\xfb'o\x9fdo'\x9c\xe2\xe4"b'c\x1cp\xc4\xc7dsdrd8\xfbg\xe0\x10\x03\x0c'b'\x82'lb"\x0c\x0cb\x0c'\xe3|\x03\xe4ld\x0c\x0c"b"c\x84\xfb'o\xee\x00d\x8c\xc7$`\x03\x98\x13\x1bgn\x0c\xc7\x07l\x07\x03os\x8e\x9b\x93n\x0c"b'c\x0cd`\x03p\xfbg\xe0\x10\x02'b's\x84\x9c\x9c\xe3\xe0\x0c'b'c\x0cn\xe2|\x03ll'b"c\x8c\xfbg'\xe7\x00"b'\x8fl`\x03\x98\x13\x1bgn\x0cd`\x02\x07\x03gs\x8e\xdb\x93n\x0c'b'\xc3l\x9c\x0edp\xfbg\xe0\x10\x02'b'\x0cs\xc4\x9c\x9c\xe3\xe0'b'\x8fr\xc0'cb'o\xe2<\x03\xec\x84\xc4\xc7'b'c\x84\xfbgn\xe7\x00'b'l`\x03\x90\x12\x1bog'b"\x87\x0fl\x07\x03o;\xc7\x9b\xdb'"ld`{ۓob'\x03d$`\x03\x07\xfc\x80'b'l\xdc\x9f<\xff\x83\x1bs{gb\x87\x84'b'l\x1b\xec\x03'b'c\xe4l'b'c\xec\x84\x9c\x9c\xe3\xe3l\xe4\x87'b"c\x0c\x8fl{l\x07d\x0cl\x9c\x9f|\xfe\xc3\x13{;'c\x87\x84ll\x9cl"b'\x0cc\xe4\x8c'b'c\xec\x84\x9c\xdc\xe3\x03b\x9b\x03\x0cb\xec'b'\x8fl;l\x07\x84'b'l\x9c\x9f|\xff\x83\x12s;gb\x87\x84$\x0c\x9c\xec\x83'b'c\x84\x0c\x0cb\xec\x84\x9c\xdc\xe3\x03\x1b\x0c\x8f\x0c#\xeclb\x07d\x8c\xe3\x03\xe4\x1b\x83o\xec\x9b;\x83\xfbg|\xec'lb'ld$`\x03\x1c#\x93\x1b\x02'b'\x9f|\x03{\xdb\x03$\x9cn\xe0'b'\x83o\xe2\x00'b'l`\x03\x8c\xe2s\x92l\x84l\x1b\xc4\x0c'b'\x0cl`\x03\x84\xe3{\x9bd\xecd\x12\x8c'b'\x0c\x0c$`\x03\x8c\xe3s\xdbl'b'\x8f\x9e\x00\x84\x0c\x0c'b'l \x03{$\x8f\xc3sl\x8c\x9f\xe3\x84c'b'\x8c\x84c\x1c<'b"l#\x9c\xe2\xdc\x03c|\x90\xc4\x8c\x84\x0cl$c\xe4\xfbg\xe7\x80\x1b'o\xe2\x18\x03\x0c\x03\xc4d'\x9f\x0c\xe4\x0c\x84"b'l\xe4\x87l$\x8c'b'\x87\x8c'b'\x0cd`\x03\xc0\x03o\xfc\x00\xc4\x9f\xe3\x8c#\x0cdl\xe4\xc4\xc7\x1b\x0c#'b'\x02\x03\x8c\xdf\xe3\x8cb'b'$\x0c\x84c\x1crl;l{\xf3o\x9c\xe3\x00\xc4\x0c\xe4\xc3\x13\x03c'b'\x87\x1e\x1c{\x8cd\x9cp\xe4\x84\x87\x9c\x1f\xe3\xec\x84l\xc7\xe0c\x0c\xe4c\xec\xfbg\x9c\x9f\x80\xc0\x03c\x84\x8f\x1f\x1c{\x8cl\x9c8\xe4\x84\x8f\xdc\x1f\xe3\xec\x84$\x87\xe0cl`\x03\x0f\xec'b'l\xdc\x9f<\xff\x83\x1bs{oc\x8f\x8c'b'\x8c\xdc\x8f\x87\x8ec\x8c'b'\x0c#\xe4\x8c\x9c\x9c\xdc|\x93\xec\x8e'b"cd\x0cdc\x0ed\x03\xc3\x83\x03l'\x9cl`\x03\x03\x83\x83\x02do\xdcxsd\x0e\x0c\xc7d\x9c\x9e|\xff\x83\x1b;\xff#5 ets_task(40100130, 3, 3fff83ec, 4)\r\n"WebREPL daemon started on ws://192.168.4.1:8266
WebREPL daemon started on ws://0.0.0.0:8266
Started webrepl in normal mode
[Timed out waiting for recognizable response]
Disconnecting [paste mode not working]
(You may need to reset the device)

priis
Posts: 12
Joined: Tue Mar 31, 2015 9:52 pm

Re: How to connect to COM port from Jupyter Notebook

Post by priis » Thu Sep 13, 2018 6:23 pm

The following makes it work!!!
%websocketconnect --password mypassword

Post Reply