Connect Forge viewer with IOT device sample
This is a skeleton sample to demo the connection of Intel Up2 Grove board with Forge Viewer.
- For using this sample, you need an Autodesk developer credentials. Visit the Forge Developer Portal, sign up for an account, then create an app. Finally make a copy of client id and client secret.
- Please use other ways to translate the source model to the format for Forge Viewer in advance. Get the model base64 urn.
- Prepare a Intel Up2 Grove board, and make sure the board has been setup correctly with the guidance of Step 1: Make Board Connections
- Connect Temperature and Humidity sensor to I2C-2, and LCD sensor to I2C-3
- Fork the Arduino Test Script to your Arduino Creator. In this demo, we use the broker test.mosquitto.org:1883. Please ensure the macro of Address is test.mosquitto.org:1883
- In the script of of #5, name the TOPIC_ONE & TOPIC_TWO in corresponding to the const MQTT_TOPIC_TEMPERATURE & MQTT_TOPIC_HUMIDITY in server.js. e.g. "sensors/temperature/data" & "sensors/humidity/data".
-
Set enviroment variables of Forge credentials or hard-coded the credentials in [credentials.js].
Mac OSX/Linux (Terminal).
export FORGE_CLIENT_ID=<<YOUR CLIENT ID FROM FORGE DEVELOPER PORTAL>> export FORGE_CLIENT_SECRET=<<YOUR FORGE CLIENT SECRET>>
Windows (command line)
set FORGE_CLIENT_ID=<<YOUR CLIENT ID FROM FORGE DEVELOPER PORTAL>> set FORGE_CLIENT_SECRET=<<YOUR FORGE CLIENT SECRET>>
-
In www\js\index.js, replace the testdbid with your own demo dbid.
-
Run the project, it will open up a browser page with the model loaded in the page. http://localhost:3000
-
Power Intel Up2 Grove board, deploy Arduino Test Script to thr board to start to collect the data. Check Arduino Creator >> Monitor if the data is broadcast to mqtt successfully.
-
Click start web socket in http://localhost:300, you will see the value of timeline and chart will be changed based on the data from Intel board, and also the object with testdbid will change the color with the data from device.
Afterwards, you should see your app displayed in your browser:
Zhong Wu (Forge Partner Development)