The following will be setup for each physical machine:
- All the machines will be pre-installed with node.js version >= 6.5.0 && npm version >= 3.10.0.
- The physical machines will be added to the VSO VSIoT agent pool.
For the machine IP address, please use ping hostname
to resolve the IP address.
- Full hostname: vsciot-win-test.guest.corp.microsoft.com
- OS: Win10 64 bit
- Username: vsciot/Bugsfor$
- Node.js
- Update npm: npm install -g npm
- Install VSTS agent for windows following the tutorial
- During setup, should choose run agent as a service for production environment
- Choose vsciot as the service account instead of the default network service account
- This is important since the gulp and related tools need local user account.
- If the logon failed is popped up, following the steps below to fix this issue:
- Open services.msc in command
- Find VSTS Agent on the service list
- Click the properties from the service context menu to bring up the setting dialog, and choose the Log On Tab
- Select the "This account" radio button, re-input the username and password.
- Full hostname: vsciot-ubuntu.guest.corp.microsoft.com
- OS: Ubuntu
- Username: vsciot/#Bugsfor$
- Node.js: Following this to install the latest node.js version
- Update npm: sudo npm install -g npm
- Install VSTS agent for Ubuntu following the tutorial
- Disable password prompt for testing environment
- Be careful for this change since it's NOT vi and can be destructive and corrupt the system
- On bash run
sudo visudo
- Add the following line to the end of the file to bypass password prompt for npm:
vsciot ALL = NOPASSWD: /usr/bin/npm
- Full hostname: vsc-imac.guest.corp.microsoft.com
- Username: vsciot/#Bugsfor$1
- Node.js: Following this to install the latest node.js version
- Install VSTS agent for OSX following the tutorial
- Raspberry Pi host name: rpi3-relay.guest.corp.microsoft.com
- 5V 16 Channel Relay
- Separate 5V power adapter for relay
- Arduino can also be used to provide 5V DC, as illustrated in the figure 1.
- USB & Wires for connection
$ git clone https://mseng.visualstudio.com/_git/VSIoT
$ cd VSIoT/iot-lab/relay-system
// This package have to be run inside the Raspberry PI board since it depends on the raspbian tooling chains.
$ npm install rpio
$ npm install
$ node app.js
The board's VCC pin will be wired to the relay NC pin.
The swagger will use to quickly setup the REST API.
$ npm install -g swagger
In code root folder of the lab system ./iot-lab/api-document
$ swagger project start
API | Method | Description |
---|---|---|
/ | GET | Get the device information |
/relay | GET | List all the relay status |
/relay/{id} | GET | Get the relay status for id { id} |
/relay/{id}/on | POST | Turn on relay {id} switch |
/relay/{id}/off | POST | Turn off relay {id} switch |
/relay/{id}/toggle | POST | Toggle relay {id} status |
- The IoT boards are connected to the physical machines via the following forms. The specific connection form depends on the type and model of the boards.
- LAN
- USB
- WIFI