The additional modules can be downloaded from the link of the libraries presented above or downloaded with the upip utility (Package Manager) from the REPL console if available in the Python Package Index (PyPI) repository

Below is a simple example that connects to the router and allows us to access the MicroPython console with the browser and WEBREPL.

boot.py code

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

#This file is executed on every boot (including wake-boot from deepsleep)

import esp

#esp.osdebug(None)

#Connects to the wifi AP providing a hostname, AP Name and passord

def do_connect():

import network

sta_if=network.WLAN(network.STA_IF)

ifnotsta_if.isconnected():

print('connecting to network...')

sta_if.active(True)

#Sets the device hostname

sta_if.config(dhcp_hostname='ESP_TEST')

print(sta_if.config('dhcp_hostname'))

#CHANGE THE VALUES TO YOUR ACCESSPOINT NAME AND PASSWORD

sta_if.connect('ACCESSPOINT','PASSWORDACCESSPOINT')

whilenotsta_if.isconnected():

pass

print('network config:',sta_if.ifconfig())

#Imports various modules for network, webrepl and garbage collector

import gc

import webrepl

import network

do_connect()

webrepl.start()

gc.collect()

At the first access it is required to enable webrepl to be executed in the REPL console with the command

1

import webrepl_setup

we can activate the service and the access password.

The procedure generates the webrepl_cfg.py file on the device.

After setting up and restarting, we access the web console by opening the locally cloned webrepl.html file with a browser

Pressing connect and after entering the password ,set in the initial setup, we access the console

Now we install from the WEBREPL console, for example, the stat module using upip

1

2

import upip

upip.install("micropython-stat")

To paste commands execute Ctrl+A e Ctrl+V

In this case the package was taken from the PYPI repository, unpacked and installed on the device.

We have noticed that some modules, although available on the repository, give an error during installation with upip; these modules are installed directly without using the upip utility,but by downloading the library from the site listed above and transferring the code to the device.

Once downloaded the package we must run it as an administrator;the installation of the Monaco font is required

After the font installation, we have the access to the IDE

We set the Location in Tools->Preferences->Language Location

and the serial port paramenters in Tools->Preferences->Serial

We plug the device into an USB port and set the serial port on uPyCraft

We choose the device type; in this case it is ESP8266

By clicking on the connection icon we access to the device and view the files on it

The firmware installation expands on the device only the Python file boot.py

The tool allows to download examples of MicroPython code for the board, blink.py for example

Clicking the “Download and Run” button we load the code onto the device and run it

In this example the led of the Nodemcu DevKit blinks.

Linux

The tool is similar in the Linux version; once downloaded the package to which we have to assign the execution right we run it. We must assign to the user the access to the serial port with the command, already seen above

1

sudo usermod-a-Gdialout USER

In our case, on Debian 9, we have the following screens similar to what we saw on Windows.

In the uPyCraft IDE

We set the Location in Tools->Preferences->Language Location

and the serial port paramenters in Tools->Preferences->Serial

We plug the device into an USB port and set the serial port on uPyCraft

We choose the device type; in this case it is ESP8266

By clicking on the connection icon we access to the device and view the files on it

The firmware installation expands on the device only the Python file boot.py

The tool allows to download examples of MicroPython code for the board, blink.py for example

Clicking the “Download and Run” button we load the code onto the device and run it

As in Windows the led of the Nodemcu DevKit blinks..

In version 0.30 for Windows we noticed some bugs, so for this operating system we continue to use the uPyCraft version 0.29.

Further informations about uPyCraft can be found at the following site

In our case, we downloaded the version 3.6.4 for 64-bit systems. We installed the package with administrative rights

After proceeding to add Python in the Path we click “Install Now”

After the installation, we open a dos command propmt and check the installed Python version

Always from the dos command prompt we proceed to the installation of esptool with the command

1

pip install esptool

At this point we can proceed to the MicroPython firmware upload on the Nodemcu esp8266 DevKit.Of course, it is necessary to have the serial-ttl drivers installed for your DevKit model on Windows. Now go into the folder where the firmware has been downloaded and run the following commands from the dos command prompt

WARNING: Use of the settings shown is at your own risk.We assume no responsibility if these settings cause malfunctions or breakage of the printer.

At the first access to OctoPrint, the basic parameters for managing the printer are requested. In our case, we connect the Orange PI PC to an Anet A8 3d printer via the USB port. At the first access to the address

From the OctoPrint site we can download an image for Raspberry PI with the system already ready; in the case of the Orange PI PC we have to install and configure OctoPrint on a Linux image.

You can also use a Linux image available for Orange PI PC and run the steps related to OctoPrint package installation, but you have to check the prerequisites for Octoprint python package installation.

We instead built for this article an image using the Armban scripts.

As a first step, prepare the micro sd card with an Armbian image.In the specific case, we’ll use a Debian Jessie image created using the Armbian script, as indicated on the link