Skip to content

Development model with and without ManT1S-Bridge

Network setup when using the ManT1S-Bridge

As I already mentioned in the previous guide, this is the simplest setup to get started with, as it allows the ManT1S devices to take advantage of your existing network infrastructure. The MicroPython firmware comes with a preinstalled boot.py that automatically runs at startup. You can find the preinstalled files in the ManT1S-demos repo if you want to take a look at what boot.py does exactly.

By default, the boot.py code configures the LAN interface correctly for the LAN8671 10BASE-T1S PHY, generates a hostname and activates the LAN interface with DHCP. By default the hostname has a code based on the MAC address, for example mant1s-67b54b. The ManT1S will get an IP lease from your router, and if your router supports it, it will also allow access to the device by name. In addition to finding this name in your router interface, I also plan to include a sticker with this default hostname with every ManT1S to make things even easier!

Now pretty often it would be more convenient to be able to refer to a device by a name you choose yourself, maybe a name indicating the node's application. One easy way you can do this with the default firmware is to put a file named hostname in the MicroPython file system root. If boot.py detects that this file is present, it will read the hostname from this file instead of generating one. You can see this used in several of the MicroPython examples in the demo repository. For instance, the light_server_socket_http directory has a file named hostname that contains:

mant1s-light

This means the ManT1S controlling the light will have this hostname and clients can use this name to communicate with it. You can see this in the pir_client_http directory where the main.py has the line light_device = 'mant1s-light', which is then used later in the code to access the light device.

Another convenience you can take advantage of when using the ManT1S-Bridge is WebREPL to access the ManT1S MicroPython command line over the network, which I also covered in the previous guide. I mentioned there that the default password is mant1s. If you want to change this password, boot.py defines a convenient utility function update_webrepl to do just that. For instance, from the MicroPython REPL run:

>>> update_webrepl('secrets')

This will set the WebREPL password to secrets. Note that WebREPL has a password length limit of only 9 characters. That's MicroPython's limit, not my doing. :)

You can also turn the WebREPL off if you don't want it running with:

>>> update_webrepl(None)

These changes are saved to the file system and take effect on the next reboot.

Network setup without bridge

On a standalone ManT1S mixing segment, there is usually no network infrastructure such as DHCP and DNS servers available. So you won't be using WebREPL to access your devices over the network and usually you'll be stuck with using a wESP32-Prog-C or similar ESP32 programming module to load your code or Python scripts and get MicroPython REPL access using a tool like mpremote. That said, boot.py still tries to make your life just a bit easier in this case by providing an easy way to set a fixed IP address. If boot.py finds a file named ipaddress in the root of the MicroPython file system, it will attempt to set the T1S interface's IP address from the information in this file. The file can either contain a simple IPv4 address or also specify a subnet mask in CIDR notation. For example, the file could contain:

192.168.1.20/24

This will set the T1S interface IP address to 192.168.1.20 and the subnet mask to 255.255.255.0. Nodes can then communicate with each other using these fixed IPs set on each node.

Note that the ipaddress file can also be used if you're using a ManT1S-Bridge, if you don't want to use DHCP. Note that while the ManT1S hostname will still be set either automatically or from the hostname file, since no DHCP request will be sent, your router will not be aware of this name and will not be able to make it automatically available to other network clients.