We all know that plants require sunlight for their healthy growth. However, at times we may not be able to keep a track of it or maybe we are not sure if our plants are getting enough sunlight.
In this project, we will build a system so that we could monitor the light our plants get and send the data to Bolt Cloud. In fact, this product is commercially available by Xiaomi (Link). But as makers, we shall build this product on our own.
At the end of the project, we will be able to collect the values indicating intensity the of the light and plot them over a line graph.
Gathering all required componentsThese are the components required
1. Bolt WiFi Module
2. LDR (Light Dependent Resistor)
3. Resistor 10K
Before you move to the Step 1, make sure that your Bolt WiFi Module is connected to Bolt Cloud and the green LED on Bolt Module is Glowing. If not then follow the steps in this project to setup the device: Setting Up the Bolt WiFi Module
Step 1: Building the circuit1. Make sure you have not powered on your Bolt Module while connecting the circuit. This will ensure that in case we make any mistake, it will not short circuit your device. Switch off the power if it is connected.
2. Connect one end of the LDR to the A0 (analog) pin of the Bolt device and other ends of the LDR to the 5V pin of the Bolt as shown in the image below.
3. Connect the 10K ohm resistor between the GND and A0 pin of the Bolt so that LDR and the resistor form a series connection. To see the image for this, click on the > arrow on the image below.
4. We are using breadboard for making the circuits. You can learn more about breadboard here How to Use a Breadboard.
NOTE: Click on arrows < and > to see image for the next step.
NOTE: Make sure connections are made properly. Ensure that there is no short-circuit in the connections.
4. Now your circuit is ready. You may power on your device.
Skip this step, if you already know how to connect your Bolt device to the Bolt Cloud. To check if it is connected to Cloud, have a look at the green coloured Cloud LED on the Bolt WiFi module. It should be glowing.
Follow the steps in this project to setup the device and to connect your Bolt device to the Bolt Cloud.: Setting Up the Bolt WiFi Module.
Yes. I am aware that we have repeated this step. But we realised that many users tend to miss out on this step so wanted to be double sure about it. Now that our Bolt is active, we are just a step away from completing the system.
Step 3: Visualising the Data (Plotting Graph) on the Bolt CloudJust follow these simple steps to visualise the collected Light Intensity data:
1. Login into cloud.boltiot.com and click on the 'Product' tab.
2. Create a new product for your light monitoring system. Products are created once and can be used for multiple Bolt devices. This ensures scalability for your IoT products you build on Bolt.
Note: Product names can only have alphabets, numbers, and underscore ( _ ) as a special character. Spaces are not allowed.
Note: Click on the arrow keys to see screenshots of other steps.
3. Next, we need to 'Configure your product'. For this click on the Configure Product icon as shown below in the image.
Now choose the hardware pins which you plan to use for this project. Since LDR is an Analog Sensor and Bolt WiFi Module has only one Analogue pin, we have to choose only the A0 pin.
Now give a suitable variable name to the pin value. By this, you will create a variable which will store the sensor value as it is received. We can then use this value in our project.
With this, you have completed your hardware configuration. Save your configuration and move to the code tab.
Note: Click on the arrow keys to see screenshots of other steps.
4. Click on the 'Code' tab, and then click on the 'Import code' button to generate and import a new code.
Here you will choose the option of Line Graph since we want to plot the line graph for our sensor value. However, in case you want to choose any other type of graph then you could do so.
The code tells the Bolt Cloud, how to plot the sensor data for visual representation.
Note: Click on the arrow keys to see screenshots of other steps.
Now let me explain each line of the code so that you could make suitable changes as you wish.
setChartLibrery function sets the data visualisation library you would use. The most commonly used one on Bolt Cloud is the Google Library. However, you could use any other JavaScript or HTML code here to visualise the data.
setChartTitle function sets the title of the chart/graph. Give a suitable name for your graph here which will be shown in the heading of the page. This is different from the name of the code file.
setChartType function is where you choose which type of chart you want i.e. Line Graph, Bar Graph etc.
setAxisName will set the name for the X Axis and Y Axis
plotChart is where you choose which variable you want to choose in your chart.
If you want to know more about the Data Visualisation then click here
5. Give a name to your code and save the configurations.
Note: Click on the arrow keys below to see screenshots of each step.
Note: Code names can only have an underscore ( _ ) as a special character. Spaces are not allowed.
6. Link Bolt with the 'Light_monitoring' product that you created. Linking allows your Bolt to access the configurations defined for a product.
Note: Click on the arrow keys to see screenshots of other steps.
7. Deploy the code to your Bolt. Deploying means to transfer the instructions and configuration to the Bolt device.
8. See the output on a plot. You can vary the light intensity by placing the circuit under the desk or glowing a torch on the LDR sensor.
This project is based on the principle that whenever the light falling on the sensor changes, the resistance of sensor changes which is then converted into a change in voltage. The ADC pin on Bolt WiFi Module converted this analog voltage level into digital values which are shown on the graphs.
We connect the LDR between 5v pin and the analog input pin (A0), so that when light intensity increases, the resistance of LDR decreases so the voltage across the LDR decreases and as a result, the voltage on the analog input pin increases.
This means that as the light intensity increases, the voltage on the analog input pin also increases. The Bolt then converts that the voltage a 10 bit (10 places in binary number system) digital value that varies from 0-1024 (0 to 2 raised to 10).
This digital data is then sent to the cloud where it is plotted for visual representation.
More Projects based on BoltWant to build another project with Bolt? Here are a few suggestions:
Comments