Intelligent Plant Grow Lamp
- Understand how to use the "serial debug" node and branching structure correctly
- Learn how to connect the light sensor correctly. Complete making an intelligent plant grow lamp.
- Learn how to set up the "StartSwitch", "Switch" nodes correctly and understand the logic behind making the intelligent plant grow lamp.
A plant grow lamp is a special type of light. Plants require sunshine in order to grow, however when the light intensity is low, these lights can offer supplementary light to promote further growth, as shown in Figure 1.
A large number of plant grow lamps have appeared on the market, however these lamps are mainly targeted for cash crops, and rarely suitable for domestic indoor plants. They can also be quite expensive to afford.
In this passage, we will use the CurieNeurons Kit and SmartNode to create intelligent plant grow lamps, which will be able to judge the condition of the external lighting. With this lamp, when the light is too low, it can power the LED lights on automatically.
Picture 1: Intelligent plant grow lamp
The key aspect of making plant grow lamps is judging the condition of the external lighting. When the light is below a certain threshold, it will turn the LED lights on to provide plants with an external light. To make this happen, we can use the light sensor to determine the strength of the outside light. The entire project analysis is shown in Figure 1.
Figure 1 :Project Analysis of Intelligent Plant Grow Lamp
When the button is pressed, the LED light will turn on for a certain period of time and then turn off.
Arduino/Genuino101, Extension Board, Button, LED
A. Light Sensor
The light sensor, also known as an ambient light sensor, can be used to detect the intensity of ambient light. They are typically used in various interactive projects, which can produce special effects with changes to light intensity as Picture 2 suggests. The light sensor is an analog sensor, so it must be connected to the analog port, with value ranges of 0-1023. Different light output will offer different values. The stronger the light, the greater the value. The darker the light, the lesser the value.
Picture 2: Light Sensor
B. "Serial Debug" node
The "Serial debug" node is widely used in SmartNode for program debugging. The "Serial debug" node presents the data we need to debug in the debugging window. In this case, we need to use the real-time light sensor value of "serial debug" to set the judgement condition.
C. "Switch" node
When SmartNode is in the form of data flow, we often need to use the “switch” node to complete the diversion. In this case, we need to determine whether the external light is greater than 20. If it is less than 20, the data will flow into the "1" node. Otherwise, it will flow into the "0" node.
Connect the Arduino/Genuino 101, Extension board, LED lights and the light sensor, shown in Picture 3.
Connect the LED lights to digital port: D5 and the light sensor to analog port: A0.
Picture 3: Connection of the intelligent plant grow lamp
Intelligent plant grow lamps use the various forms of data streams. As an example, it opens the light sensor through the “StartSwitch” node and determines the strength of the external light nodes through the switch node. When the light value is lower than a certain value, it sends "1" to the LED, resulting it being turned on. When the light value is higher than a certain value, it sends "0" to the LED, resulting it being turned off – shown in Picture 4.
Picture 4: Programming behind the intelligent plant grow lamp
C. Set Up
Because we need to constantly measure the value from the light sensor, we need to set up the "StartSwitch" node. The setting is similar to that of hardware switches. We will set the output to 1 to open the light sensor, and then set the name to StartSwitch. The Serial Port will then configure with your computer's serial port. Whole setup is shown in Picture 5.
Picture 5: Setting up the “StartSwitch” node
Setting up the light sensor's node and pins of the sensor, shown in Picture 6.
Picture 6: Setting up the light sensor's node
The light sensor can receive the intensity of the outside light in real time, but how can we read it? To solve this problem, we will use a "Serial Debug" node. Setting up this node is fairly easy. In this case, we will set it as Picture 7 shows.
Picture 7: Setting up the Debugging node
Now how do we determine the strength of the light? No worries, we will use the "switch" node. Once the outside light is below a certain value, we output from Port 2. Otherwise, we output from Port 1.
Setting up the specific details is also quite easy, as shown in Picture 8.
Picture 8: Setting up the "switch" node
We know that the LED is powered on or off depending if the input is 0 or 1, so we need an additional node. After judging the strength of the outside light through the switch node, we will choose the node "Change" and input a number to the LED, shown in Picture 9.
Picture 9: Setting up the Change node
Through the above node settings, the nodes are now connected and we have officially created an intelligent plant grow lamp!
Click "Deploy" and you will see if the intelligent plant grow lamp is working as expected. If not, we can choose the Frame "debug" to set the threshold of the light sensor, or you can ask your friends or simply post your question on our forums!
Last but not least, don't forget to share your work and learning process with your friends and colleagues!
After clicking "Deploy", our intelligent plant grow lamp is complete.
Pretty easy to setup, right? With this particular lamp, the LED brightness is always a constant. Do you think you can adjust the LED brightness automatically based on the environment's light intensity? Tell us about it if you think you can!