The Bolt IoT platform has just released a new feature which helps you monitor the state change of a digital sensor. As opposed to the earlier system, where the output of the digital sensor is logged, once every 5 minutes at best, with the trigger feature, you can log exactly when the output of the sensor changes, and view this log via the data visualisation on the Bolt Cloud.
As an example for this feature, I interfaced a button with the Bolt WiFi module and made it so that the Bolt Cloud would log exactly when I pressed or released the button.
Here are the steps of how you can replicate the project.
NOTE: This blog assumes that you have already created and account on the Bolt Cloud, and linked your Bolt to your Cloud account. If you have not done so click here to find out how to do these steps.
Take a look at the schematic below, and make the connections as follows.
- Connect a pin of the button to the 3.3v pin of the Bolt.
- Connect a pin of the the resistor along with the second pin of the Button with digital 0 pin of the Bolt.
- Connect the second pin of the resistor with the GND pin of the Bolt.
Your circuit should look similar to the image below.
Power up the circuit using a 5v supply and a micro-usb cable. An Android charger would be best.
Login to the Bolt Cloud by clicking here.
Step 1: Create a new product.
Navigate to the products tab, and click on the add products button.
Enter a valid name for the product, select input device and GPIO radio buttons.
Click on done to create the product.
Step 2: Configure the product hardware.
In the products tab, select the product that you newly created, and click on the configure button.
The product hardware configuration page will open. Here click on the data collection rate drop down menu and select trigger.
Next, select the pin 0 checkbox enter a valid variable name for the pin, and click on save.
Step 3:Configuring the product code.
To configure the product code, click on the code tab.
Enter a valid filename for the code, and select 'js' from the file type drop down menu, and click on the import code icon.
The import code popup will appear. Here click on the choose variable name drop down menu, select the variable name you had created in the hardware configurations, and click on ok.
Next, select line graph and click on import.
Finally click on save to save the product configurations, and navigate back to the products tab by clicking on the close icon.
Step4: Linking the device to the product
In the products tab under your product, click on the link button.
In the select to link devices popup, select your device and click on done.
Next click on deploy configurations button, and finally click on the device view button to view the generated graph.
Once in the device view, you can see a graph of the transitions of the GPIO pin 0 against time. Every time you press or release the button, a new point will be added to the graph. Do note that the Bolt takes upto 3 seconds to push the data to the Cloud. So any transitions within a period of 3 seconds from the first transition will be ignored.
The system can be used in the following applications.
- Detecting intruders for a security system.
- Counting number of people who enter into your house.
- Counting packages on a conveyer belt.
Want to build another project with Bolt? Here are a few suggestions: