This is a RFID data logger which reads the data in the card using the MFRC522 card-reader connected to the MediaTek LinkIt One. Using the MQTT broker called Mosquitto, the data is sent to mqtt server from the LinkIt One. This data from mqtt Server is sent to MongoDB (DataBase). In general the data sensed is stored in a DataBase with Timestamp.
Before starting you need to install 1) MQTT broker: Mosquitto
1) Installation procedure for Mosquitto:
i) Click on the given Link Moquitto Download to install mqtt broker. By default 3 .dll files will be missing, hence in order to install .dll files, follow the next steps.
ii) Install OpenSSL, for this click on the link OpenSSL download, after this go to 'C:\OpenSSL' and copy the 3 .dll files and paste it in the mosquitto directory (C:\Program Files (x86)\ mosquitto)
iii) Install pthreadvc2.dll, by clicking on the link pthreadVC2 download now click on pthreadvc2.dll to install it. copy this .dll into the mosquitto directory
2) Installation of Node.js and NPM:
i) Click on the link to install the node.js and npm Node.js download
3) Installation of MongoDB:
i) Install MongoDB using the link provided MongoDB download.
Once the all the Installation is done, before running the LinkIt code the mqtt server should start listening for follow the steps,
a) Open the cmd prompt in the mosquitto directory and run the command 'mosquiitto -c mosquitto.conf', when this is done the 1883 port gets activated, this can be checked by typing 'netstat -an' on cmd prompt.
Run the LinkIt One code in Arduino complier, the output is as shown
Now run the node.js program, for open a cmd prompt and type 'node ' in my case it is 'node mqtt2mongo.js'
Next you have to start running the MongoDB, for this type 'mongod' in cmd window, open another cmd window and type 'mongo', this opens a connection on port 27017, by default mongoDB switches to Test Database, type these instructions step by step to get data in the MongoDB
'show dbs' // show all the database available
'use TempMonitor' // switches to your database
'show collections' // shows the data collection in your database
'db.test_mqtt.find().pretty()' //gives you the contents in the collection.