Installing OpenThread on a Linux Computer (I used both Ubuntu versions 16.04 and 18.04)....

Draft, Draft, Draft, Draft, Draft, Draft, Draft, Draft, Did I mention this is only a draft :)

On this site, single click black boxes to copy. Then on the Linux command line, right-click-paste (the Linux command line does not use ctrl-v to paste)

Checkout the github at https://github.com/hpssjellis/particle.io-photon-high-school-robotics/edit/master/a17-particle-mesh/openthread/

You can do most of the steps below automatically by copying openthread-install-all.sh to a fresh file on your linux machine. Several ways to do that, here is one:


  • Then paste the above file into it and ctle-x to save
    Then to make it runnable:

  • Then run it with this



  • THE MANUAL STEPS BELOW IN GREEN ARE DONE AUTOMATICALLY BY THE ABOVE INSTALLATION BASH COMMAND.
    THE STEPS IN light BLUE YOU MUST DO YOURSELF IF YOU USE THE ABOVE INSTALLATION BASH COMMAND.


    These steps assume you have 3 pre-programmed nrf52840dongle. If you don't you must do the Openthread step first and program your USB Dongles. I would make 1 NCP and 2 CLI Dongles, but in the future I would like to be able to do this with only Particle Argons.

    Note: When reading this on a mobile device sometimes the text in the black boxes does not fully show up. Best to read on a Linux machine.

    Step 1. Might as well install all 4 github repositories

    (If you know how to do things in other ways, such as making new directories then do what you know)



    1. // Download the 4 openthread repositories





    Step 2. Install Wpantund

    // Let's install wpantund first. It controls what items can join the thread network











  • This install it on your computer

  • Now start wpantund assuming /dev/ttyACM0 might also be /dev/ttyUSB0 or ACM1 or ACM2
    This USB port thing is a pain. I would load usb devices on your linux computer and then turn the computer on, an label or record which USB connector becomes ACM0, ACM1 and ACM2 when all 3 are plugged in at startup. If you do this after startup, the order is determined by when you plug them in, however the border router which we install next works on startup and will expect certain nrf52840 USB dongles in certain ACM? locations.
    Does any of this make sense? You might have to try different usb ports for your nrf52840 USB Dongles Start the background daemon
    If /dev/ttyACM0 doesn't work try /dev/ttyACM1 or 2
    Note: Remember we are looking for the board with the NCP firmware on it. Not the CLI firmware

  • Now start wpanctl to control wpantund using the wpan0 name above if you have a different nrf52840 you can setup another wpantund and ctl using ttyACM1 and wpan1


  • // plug in other nrf52840's if you have them

  • use your networkmaster key instead of: 000102030405060708090a0b0c0d0e0f
    The command is
    setprop NetworkKey --data 000102030405060708090a0b0c0d0e0f


  • // allow joining this network for 1 hour = 3600 seconds


  • Have a look at all the properties

  • Jut close the window or exit gets out of here:

  • This Dongle firmware remembers your data fairly well so if you want to start from scracth you can type on the command line


  • It gets confusing weather to use wpantund with theot-ncp-ftd.hex firmware on the USB dongle or screen with the ot-cli-ftd.hex firmware If you want to reset a dongle using screen the command is


  • Unfortunately both programs use the ">" sign as the command line prompt and with lots of windows open it does get confusing. I think I am going to start using either the ncp on all 3 dongles or the cli on all 3 dongles.
    Following is using the cli.
    Now find out the /dev/ttyACM? of your other CLI Dongles. Then use the screen program to activate the clients with Join ability



  • You can learn all kinds of helpful things about how to use the screen program here but I just used lots of screens.
    For the following command note the number of anything you want to join with.

  • Here is the tricky part. If you used the web GUI you know the masterkey. If you have an Argon then you need to find out the master key. After the workd --data enter your masterkey







  • Confusing code here I think this can be done easier using wpanctl. Will get back to here.
    The cli commands that use the firmware ot-cli-ftd.hex have a refernce link here I can't get my commission dongle to work with Screen, so here are a few commands to try.
      On the NCP commissioner dongle
    1. router table
    2. child table
    3. networkname codelab
    4. extpanid C0DE7AB5C0DE7AB5
    5. panid 0xC0DE
    6. masterkey 1234C0DE7AB51234C0DE7AB51234C0DE
    7. ifconfig up
    8. thread start
    9. state
    10. rloc16
    11. ipaddr
    12. ping fdc0:de7a:b5c0:0:66bf:99b9:24c0:d55f
    13. commissioner start
    14. commissioner joiner add 2f57d222545271f1 J01NME
      on the cli Dongle
    1. scan
    2. ifconfig up
    3. joiner start J01NME
    4. thread start
    5. state
    6. rloc16
    7. state child






  • Step 3. Install the Border Router to auto-load

    // Lets install the Border Router. It controls the Thread connection with the internet. Note: This program automatically starts after being rebooted.





  • // plug in your nrf52840 usb dongle

  • --or--

  • //Edit wpantund.conf ...... should be in /etc/wpantund.conf



  • Edit

  • ^x to exit nano Reboot the computer!





  • The border Router is started at boot, which I find a bit irritating for dev. so if you want to stop and then start a service try



  • You can also disable and enable the above services but you can look that up


    I just found out that you can discover the Web Gui IP address by the command for /dev/ttyACM0 running wlan0
    Look for the inet address that looks like a normal IP URL.
    Not working for me
    From the command line
    ifconfig wlan0

    This sort of worked but did not give the IP I was expecting.
    ifconfig wpan0

    Now is probably a good time to test both the Thread Commissionning App and the Web Gui. On the Docker you can set the Web GUI IP, but I don't know how to do that with the installed one so I just use "localhost" and randomly it works.
    On the web Gui always check the status, when things are not working it is very bleak, 3 entries that kind of say it isn't working, When it is working there are several entries and important information here. Also check the Join button, if you have any particle Argons up and running they may show up there. Try the form button. I have been told to change all the entries except that last one not sure if that is relevant information but do record the password as that is needed for the Thread App.

    Note: The Thread Commissioning app retains information that messes up other setups so go into Apps, Settings, stoarge and clear things, then close the App or force stop before trying with a new thread network.
    I have huge problems getting past the Thread App admin password, have done it a few times. Not sure what I am doing wrong.

  • From the command line try to ping your different wpan0, wpan1, wpan2



  • Step 4. Install Openthread to program your nrf52840 device

    // Let's install openthread for programming the nrf52840 USB Dongles

    This did not install well on my Ubuntu 16.04 Machine, but was find on my 18.04 Ubuntu Linux. A trick that might help is to install po-util.com first as it helps with some of the needed abilities.






  • As afr as I can tell this is every command option possible. You might want to ony try a few of them

  • This converts the ncp to a hex file

  • This converts the cli to a hex file.

  • Now look in the output/nrf52840/bin folder an you should see several files but you are interested in the 2 .hex files.
    If you have the nrfutil you can run this command. Note your nrf52840 device must be in DFU mode.

    I take the easy way and use nrt-Connect for Desktop. Put the device in DFU mode ny pushing the 2nd button and visually load the device, load the .hex file and write the file to the device. Note You first need a bootloader. I download the bootloarder from makerdiary in compressed format and then ubncompress it and load it first into nrf-connect-for desktop.








  • Step 5. Install pySpinel?

    // Let's never install pyspinel: Just kidding I just havn't done it yet. I think it does what wpantund does just using Python.