The following is a team project that was submitted to the Sacramento Hacker Lab IoT Incubator competition.
The goal of this project is to create a runtime-configurable framework for wireless sensor networks supporting multiple radio frequencies and microcontroller architectures. The user is able to view and alter the current network configuration through a node.js webserver or custom Python script.
The project repository is located on GitHub.
Personal blogs for the team members are listed below:
Trushant - http://tkmaker.blogspot.com/
The members of this team are not involved with the Galileo or Edison team nor is any of the work posted
here related to our jobs with Intel. The views and opinions expressed are our own and do not necessarily represent those of Intel. Any comments on this instructable are the property of their individual authors.
Step 1: Setup Webserver
The below assumes an environment variable named $DOGE_ROOT that points to the 'DOGE' folder of the repo. The packages used (git, pip) come from the opkg repo set up following the steps here.
The currently installed modules are located at $DOGE_ROOT/linux/webserver/node_modules. You will require the following: angular vis express ionic socket.io request
The `angular` library is already part of the repo.
The `vis` module is part of the repo as a submodule. If you didn't clone the DOGE repo w/ --recursive, the directory will be empty. If so, do the following:
git submodule init
git submodule update
You should see git fetch the files. If you get the following error:
git: 'submodule' is not a git command. See 'git --help'
Then your git does not have the submodule command. For a workaround you can still install vis through the nodejs package manager in the next step.
Now we can install the rest of the modules via the nodejs package manager. They are large packages, so don't be alarmed if it takes a few minutes.
npm install express ionic socket.io request
If you weren't able to set up the vis submodule above, run the following (also executed from the `$DOGE_ROOT/linux/webserver` directory):
npm install vis
Finally, we need to install the Python module for socketIO using pip.
If you don't have it installed already, you can get pip with:
opkg install python-pip
Install the module:
pip install socketIO_client
If you get the error:
ImportError: No module named pkg_resources
Run the following (taken from this community post)
curl https://bootstrap.pypa.io/ez_setup.py | python
Step 2: Running Websever-only Test
Note, the name of the nodeJS binary is not the same for all systems. On Yocto (default of Edison) it's called 'node' but on Ubuntu you might see it as 'nodejs'.
node server.js &
Launch python script:
python -m doge.scripts.doge_test &
There should be a series of prints ending with "Successfully sent network load message". Open an Internet browser and go to http://(edison's IP address):8000. (To find Edison's IP address, enter `ifconfig`)
You should now see the Doge UI web page. The Network Graph view is available as one of the views controllable via the view select button at the top-right of the web page.
Step 3: Setup Edison for Talking to Nodes
Build the Arduino sketch
The files needed are located under $DOGE_ROOT/nodes/edisonArduino
Launch Arduino sketch
Copy radio_proxy.cpp.elf to /sketch * `chmod a+x radio_proxy.cpp.elf` * `./radio_proxy.cpp.elf /dev/null /dev/ttyGS0` (or use the download button in the Arduino IDE)
Install python module sysv_ipc
Follow the steps under /doge/libs/sysv_ipc.txt.
Build shared library for protocol code
Run the script setup_protocol.py located in /linux/doge/core
Step 4: Add Hardware Nodes
We currently have tested two kinds of nodes - a 915MHz MSP430 and 2.4GHz LPC812. The LPC812 design files can be found in this repository. Constructing the MSP430 node will be covered in a future Instructable.
Step 5: Troubleshooting
Changing node layout in webserver
The default format is to allow nodes to self-arrange based on who their neighbors are. You will notice this by seeing nodes being 'pulled' closer to their neighbors. If you notice lag in your browser, you can switch to a fixed grid layout by changing the variable 'demo_grid' in linux/webserver/js/graphController.js from a 0 to a 1.
Webserver access on a private LAN
When the Edison is on a private local area network, internet traffic trying to reach DOGE webserver port 8000 is typically blocked by the router firewall. To work around this and enable DOGE webserver access externally, create a port forwarding rule from router port range 8000 to the Edison’s local IP, port 8000. With this port forwarding rule in place, you should be able to access the webserver by entering the external IP address of your router(issued by your ISP) followed by :8000 e.g. (http://22.214.171.124:8000). On some router models, it isn’t clearly visible what your public IP address actually is, and if that’s the case a fast way to find this IP address is simply entering the search term “my IP address” into Google (Google Search has a dedicated feature just for this search term).
Note that if you want to run DOGE python scripts from the internet you could also set up a port forwarding rule for SSH port 22, but this is not a good idea unless you disable password authentication and use something more secure like private/public key authentication instead.