The open source Thread wireless mesh networking stack OpenThread contains a nice option to build simulated Thread nodes than can run on your PC. This Google codelabs exercise explains in more detail how this can be used to simulate a very simple Thread network consisting of 2 nodes. A Linux VM is used to run the simulated nodes. Now wouldn’t it be great to just run your simulated nodes directly in Windows 10 as .exe executables? One way to get there is to build openthread in the Cygwin environment.
In Cygwin, the following packages need to be installed first:
Note that pip can be named “pip2” or “pip”. For Python you need the package “pexpect”. Install it from bash using:
If you don’t have the openthread repo from Github already, clone it into a directory of choice:
To make sure that line endings are UNIX style, cd to your openthread repo and use the below. Don’t use this if your openthread repo contains local changes!
The repository can be prepared for building using the bootstrap script.
Have a look at the output. It should complete without errors. (Errors may point to some missing tool/dependency or presence of Windows style line endings.) Now the POSIX example programs can be built using:
After building, the codelabs exercise to start 2 simulated nodes in separate shell windows can be followed. Using a command like below the first Full Thread Device (FTD) can be started:
and in another window a second one:
the default Thread network can be started by a sequence of commands, to be run in both shell windows:
To confirm the nodes are attached to the network the ‘state’ command can be used. And finally scan the virtual airwaves and wonder where the developers did get their lunch!