Tags:
view all tags
---+ Accessing Micro Python on the !IoT Node ---++ Introduction Once micro Python is running on the node we must be able to upload Python programs on the node and execute them there. In case of processor board with a micro-USB connector it is easy to connect to the micro Python REPL loop through a simple serial interface and a terminal emulator like [[https://www.poftut.com/install-use-linux-minicom-command-tutorial-examples/][minicom]]. In addition you can use [[https://github.com/pycampers/ampy][ampy]] to up - and download files. A standard editor like _emacs_ or a specify Python editor like <i>idle </i>can be used to edit the Python code. More comfortable though is the use of an IDE like uPyCraft which has editing, up and download features, library functions and a collection of examples built in. uPyCraft can be found as binaries for Windows, Mac and Linux. When trying to install the [[https://randomnerdtutorials.com/install-upycraft-ide-linux-ubuntu-instructions/][Linux binary ]]I got problems with library version incompatibilities on zlib but even when solving this problem the program did not work as expected (the Windows version worked fine). uPyCraft is a Python program whose source is available on github. In fact I found 2 versions: * [[https://github.com/DFRobot/uPyCraft_src][the original version based on Qt4]] * [[https://github.com/jiapei100/uPyCraft_PyQt5][a modified version based on QT5]] Even tough I managed to run the program and the main window came up on the screen, most of the functions gave problems. The Qt5 version even more than the Qt4 version. Finally I decided to modify the QT5 version of the program myself and to try correct the errors one be one until the program could be used for the AFNOG workshop. Since the original documentation is also obsolete I re-wrote it for my [[https://github.com/uraich/uPyCraft-Qt5][new version.]] For a description on how to use the program please refer to the github Wiki pages. ---++ Accessing micro Python over WiFi Unfortunately uPyCraft relies on the serial connection between the PC on which it runs and micro Python on the !IoT node. When taking the ESP01 off its "programmer" this serial connection will be cut and uPyCraft, in its current state, cannot be used any longer. It is however possible to enable _webrepl_ on the micro Python node, allowing access to the REPL loop through a _websocket_ interface. In order for this to work we first must enable the webrepl server: Connect the node to the programmer to get access through the serial interface and type import webrepl-setup and follow the instructions. Then install the [[https://github.com/micropython/webrepl][webrepl client ]]on your PC. Start the browser and enter the URL !file://directory_of_webrepl/webrepl.html. In the window coming up enter the websocket server consisting of !ws://IP_of_your_IoT_node:8266, where 8266 is the port number. After entering the password you defined during the webrepl_setup step you should get connected to the REPL loop of your micro Python !IoT node. For more information please consult the [[micro%20Python%20tutorial.][micro Python tutorial.]] <img alt="webrepl.png" height="622" src="%ATTACHURL%/webrepl.png" title="webrepl.png" width="843" /> As you can see, There are also buttons available to transfer files from and to the !IoT node. -- %USERSIG{UliRaich - 2019-03-01}% ---++ Comments %COMMENT%
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
png
webrepl.png
r1
manage
69.4 K
2019-03-01 - 13:19
UliRaich
Edit
|
Attach
|
Watch
|
P
rint version
|
H
istory
:
r7
|
r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r1 - 2019-03-01
-
UliRaich
Home
Site map
AFNOG web
Embedded_Systems web
IoT_Course_English web
IoT_Course_French web
Main web
Sandbox web
TWiki web
AFNOG Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Register User
Edit
Attach
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback