Introduction: Magic Sensor Test Box
Recently, we got a set of Grove tools, including a variety of sensors, such as buzzer, temperature sensor, light sensor, touch sensor, LED module, LCD display module and so on. It is planned to put these sensors together and use Arduino UNO to control them to create a magic sensor test box. With this box, beginners can easily understand the functions of sensors and learn how to use them more easily.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
First, you need to prepare a wooden or cardboard box to install the Arduino UNO controller and all the sensor modules. There happens to be a wooden candy box in hand. It's a packing box for Spanish Pablo Rolled Sugar.
Then, like this, Arduino UNO and all the sensors and LCD displays are installed in the box. Note that the connection in the diagram is only for demonstration, and there may be some differences between the connection in the diagram and the later examples.
Due to the use of many sensor modules in this project, we will divide the manufacturing process of the test box into several cases to introduce, and then form the complete scheme of the magic sensor test box.
First, we use a temperature sensor, light sensor and LCD character display module to form a temperature and light display device. In addition to displaying the current temperature and illumination values, LCD displays can also display different backlight colors at different temperatures and illumination conditions.
In order to control temperature and illumination sensor module, it is necessary to add relevant library functions and pin definitions in the program. Because the two modules are output analog signals, four-core connection wires are connected to A0 and A2 of the expansion board respectively, and then Arduino can read the corresponding values. In addition, in order to drive the LCD character display module, we need to add "rgb_lcd.h" and declare the rgb_lcd object.
Read out the Luminance value of the light sensor and the temperature value of the temperature sensor, display it on the LCD screen. After formula conversion, the current environmental temperature can be obtained. The formula used here is temperature = 1.0/ (log (R/R0)/ B + 1/298.15) - 273.15,R0 = 100000, R = R0xR,R is the value of the sensor.
This will display the temperature and illumination data on the LCD display screen. The actual display effect is shown in the following figure.
Next, What we need to do is to increase the function of LCD module backlight color, map the illumination brightness and temperature to RGB range (0-255), and then call Lcd.setRGB (Red, Green, Blue) function to set color of the LCD backlight. The parameters here can also be changed slightly according to the specific situation.
When the light sensor is covered with black cardboard, the light intensity calculated will also change because the light received is less. After some operations, the mapped data will be written into the LCD module. It looks like a person's mood is changing with the weather.
This is just an experiment of Magic Sensor Test Box. More interesting functions will be added in the future. Please look forward to it! Thank you for your attention!