Using the handwriting application Tiandi bookmark0 to use the robot to do intelligent street lighting / Liu Zhilin Lin Xuesen street lights and our lives are closely related. The pace of urban modernization is getting faster and faster, and lighting projects and outdoor lighting advertisements are also appearing. Our street lamps should also keep pace with the times, not only to reduce energy consumption, improve energy utilization, but also to show more humanization and intelligence to make applications more convenient. Have you ever thought that the process of letting students do a smart road robot activity is basically the process of ''recognizing one analysis and one production programming'. Now, we will use the building block robot kit of Guangzhou Zhongming Digital Technology Co., Ltd. Come and make a smart street light.
The simplest street light is of course only one power switch, as if the figure is a little more complicated, it is a single-button light-touch street light. When you press the light, it lights up, and then presses the light to turn it off. Now let's implement this example with a robot controller. Carefully analyze this example 'we can get the working process: (2) the switch is pressed' to convert the street light state; the working principle diagram is as shown.
Therefore, the program idea of ​​implementing this scheme is gradually formed: first initialize, then we need a variable to save the state of the street light; then it is continuously executed: detecting whether the switch is pressed or not, using the variable that saves the state of the street light, judging the street light The state, if it is bright, becomes "OFF if it is off" and changes the state of the saved street lamp.
After the analysis is completed, you can really get started. We can use the LED module to simulate the lighting of the street light, and use the button module to simulate the button switch of the street light. Connect the M16K main control board of the building block robot to the LEDs and buttons. Create an application 'set' 'hardware information' in the RobotEXP robot software and drag out the icon to write the program algorithm according to the algorithm description. So we have built this simple streetlight model. Finally, compile and download the program to the M16K main control board, re-run the main control board program, the street light will follow your instructions, press the light to light, and then press the light to extinguish.
Of course, the street lamps that need to be manually adjusted cannot be called intelligent street lamps. At least the unmanned operation is called an intelligent urban street lamp.
We can use the ambient light sensor module to judge the brightness of the environment as the basis for controlling the street light switch. In fact, the condition judgment module in the RobotEXP robot express software is used to judge whether the brightness is sufficient, thereby controlling the light on and off. The working principle diagram of the intelligent street lamp is shown in the figure:
With the goal, let's analyze the working process of the intelligent street lamp: (1) read the value of the ambient light obtained by the ambient light sensor module; (2) determine whether the ambient light value is less than the set light value; (3) turn on the street light when the environment is dark. Otherwise, the street light is turned off; according to this algorithm, it can be analyzed: as long as the tentacle module inside the street lamp is replaced with the ambient light detecting module, plugging in any port No. 512 'others need no further changes.
Let's analyze the program written according to this algorithm: before dragging the icon to write the program, we need to add a variable surround to record the ambient light value, and set the initial value to 0 and then drag to add different icon modules; add a Loop: Read the value of the ambient light inside the loop, return to the variable just added before; determine whether the ambient light value is less than the set light value; turn on the street light when the value is smaller than the set value, otherwise turn off the street light. In this way, the street light will automatically switch according to whether the light exceeds the threshold you set.
In this smart streetlight example, if the light changes around the set value (for example: changes in the cloud), the street light will flash continuously' so we have to do some processing on the program, otherwise the life of the light bulb will also decrease. . For example, we can increase the switching light delay to control, which will extend the life of the bulb and increase the stability of the regional light for a period of time. This is very easy to implement in the RoboEXP robotic express software.
In general, we will install a row of street lights to illuminate the entire road.
The ambient light of a certain road is generally close, so we use the method described above to control and connect a series of street lights in parallel. In fact, we only use the two interfaces on the main control board, but the powerful M16K control board has 24 interfaces. If you add some delay processing based on the system described above, control the lighting of different time street lights, traffic lights, pedestrian lights and the voice prompts for the blind, etc., an automated crossroad traffic light system is developed. It is.
In some residential communities, the 'greening level is different', the building spacing is different, and the light changes in the area are also very large. So 'we need some street lights that can operate independently and intelligently. Undoubtedly, it is the easiest way to install a separate controller for each street light, but the cost is quite high, so we propose to 'apply a multi-port controller' while controlling a group of street lights' to form a street lamp that can operate independently. Street light system.
If a general algorithm is used, the state of a street lamp is first judged, and then the street lamp is controlled; then it is judged that the next street lamp state is processed one by one, 'it takes 13 minutes to control each street lamp' before the next street lamp is operated. Real-time control is not possible. So here we use a parallel processing mechanism, taking turns to control each street light as short as possible, so that multiple street lights work as if they are working independently and at the same time.
As you can see, in the algorithm shown, at the beginning of the program, the variables are used to read the status of all street lights. In this step, the controller is operated very fast, almost instantaneously; then we judge each street light and change the state of each street light separately. The operation of this step is also done instantaneously.
The road one: Yiyi -! i è‹Ž è‹Ž è‹Ž I I I. After completing a street light operation, the program will continue to cycle through the above steps, the street light will automatically control the opening and closing.
According to this algorithm, it is very convenient for students to use RobotEXP to write programs. g(Author: Guangzhou Zhongming Digital Technology Co., Ltd. 510665 "1162004.4 Information Technology Education Section Editor: Gao Weiping
Paper Hook,Paper Hook Hangers
Yangzhou Lansun Slipper Co.,Ltd , https://www.yzlansunslipper.com