Realtime Arduino Sensor Data Monitoring using NodeJS
The aim of this project was to monitor the Arduino sensor data values , view those sensor values on any device connected to the internet and store the values for predictive maintenance analysis purposes.
Collection of Sensor Data
For the sake of practical purpose, a single phase transformer connected with variable lamp load on secondary was used and the following values were monitored
- AC Current in secondary (using ACS712 current sensor)
- AC Voltage of primary
- Temperature of field winding of the transformer (using LM35)
For measuring AC voltage, a voltage divider arrangement(using necessary resistances) was used along with a diode so as to scale the value down to 0-5 V which could be directly read by Arduino Uno.
You can find the connection scheme of various sensors to Arduino on the internet according to the sensors being employed.
To transmit this collected data to the server on the internet, a SIM900A GSM Module was used which was powered by another 12V DC adapter separately.
Server Side Implementation
A NodeJS server was deployed on Heroku which accpets GET requests made from the Arduino at periodic intervals. On each and every request, the data was stored into Mongo database and the data was pushed to a PubNub server under a pre-defined channel name - which would in turn publish the data to all the subscribed devices in real-time. For plotting purposes, EON.js was used which is another project of PubNub team. The entire server side source code can be found in this Github repository.
Arduino Code
Head over to the following Gist for Arduino Code.
Source
Let me know what you think of this article on twitter @utkarshgpta or leave a comment below!