in our previous article , we showed an example on how to use Raspberry to get PIR sensor signal and work as a MQTT client and send motion sensor alert message to mosquitto broker, now we will show you how to use Meteor framework to set up an IOT website and subscribe message from mosquitto broker server so that we can show alert message in a web page when PIR Sensor detected motion signal.
Step 1)Install Meteor in a new 64-bit linux server, run following command:
curl https://install.meteor.com | sh
Step 2) If you don’t have mosquitto client, run following command to install it, otherwise skip this step:
sudo apt-get install mosquitto-clients
Step 3)Test mosquitto broker connection by running following command:
sudo mosquitto_sub -h test.mosquitto.org -t "revspace/sensors/" -v
You should see many temperature,humidity and other sensor information rolling in your screen. That means you has connected and registered with test.mosquitto.org mqtt broker.
Step 4)download our IOT meteor source code by running following command:
wget http://osoyoocom/driver/iot-test.tar.gz tar -zxvf iot-test.tar.gz cd iot-test sudo meteor
You should see meteor is running and remind your to access http://localhost:3000
Step 4) open a web browser in your server, type http://localhost:3000(if you are not in server's computer, type http://server-ip-address:3000)
you should see a web page showing title as "Meteor Kitchen & IoT (Internet of Things) example "
Now you can make some motion in PIR sensor installed in previous article , you should see "osoyoo/alert: intruder detected " message in the web page.
DownLoad Url osoyoo.com