होम> ब्लॉग> A smart desk lamp based on STM32 chip

A smart desk lamp based on STM32 chip

November 29, 2023

Some time ago I participated in the National University Student Smart Internet Innovation Contest. Our team made a smart desk lamp after half a month of hard work and shared it for everyone to learn.

Smart desk lamp side view

Smart desk lamp overall picture

Top view of smart desk lamp

introduction:

With the progress of the times, people have more and more requirements for lamps. Table lamp is one of the common household lighting equipment. In order to combine the nation’s energy saving and environmental protection plans and humanized product requirements, our team has developed a multi-purpose application. Table lamps combine intelligence with energy saving and environmental protection. The smart desk lamp is based on the cooperation of various modules, integrates the team's intelligent environmental protection design concept, and the humanized purpose so that “she” can take more care of our lighting needs. The design of intelligent lighting adjustment enables her to have a powerful function of maximizing the protection of the user's eyesight. Through our specially designed mobile phone APP users can monitor her remotely as she likes. The powerful peripheral module of this intelligent desk lamp enables it to obtain working time in real time, External environment temperature, humidity, light intensity, combustible gas data, and real-time data displayed in the mobile phone APP page allows users to understand the recent working hours in real time, and control the changes in the external environment. At the same time, the voice recognition control and the embedding of the stepless dimming function are more sensitive to the "her" operability. The automatic dimming mode can automatically adjust the light brightness by acquiring the external environment at different times, which is beneficial to energy saving and environmental protection. The implementation of the sitting position correction function enables users to develop good study work habits and protect eyesight. The new challenge of hand-speed dimming gives “her” unique highlights, adjusts the brightness of the light through the speed of gesture scanning, and allows the user to experience speed when adjusting the light, making the use of the desk lamp more convenient. interesting. The product intelligence, material-linked, humanized design will take you into the smart home's good life.

Research Background

With the continuous development of modern science and technology, the degree of intellectualization of daily necessities has become more and more popular, and the humanity and intelligent design requirements of some household articles have become higher and higher. It is well known that desk lamp, as one of the main lighting tools in the family, occupies an important position in modern social life, and the range of application of desk lamp is very wide, and it is suitable for people of all ages, so its market application is very high and it has a good development prospect. . With the increasing problem of young people with myopia, parents are paying more and more attention to their children's vision protection. This makes the “eye-protection desk lamp” without flashes and glare more and more popular with parents. However, in fact, many eye-protection desk lamps on the market claim that they have “no flicker” but only “high-frequency flash”. This higher frequency strobe is more damaging to the eyes because the eyes react very quickly to the flashing motion of the lights. Using the desk lamp for a long time will make the eyes more fatigued and cause some damage to eyesight. A true strobe-free desk lamp should be a LED that uses a DC constant current drive as the light source, so this time we are using an LED lamp as a light source.

If the table lamp only has these functions, it is too lack of practicality and innovation. Therefore, through investigation and study, we learned that many people want the desk lamp to have some special features. For example, it can automatically adjust the brightness through external light, can detect the surrounding environment, can use the mobile remote console light, and can make the desk lamp have multiple working modes. , can warn of harmful gases, can make children who are afraid of the dark night to sleep peacefully and so on. There are many problems that we often encounter in our lives. The ultimate goal of all products is to serve humans, so our team decided that we are committed to solving the common problems in smart homes. We also hope that through this study, we will be able to bring convenience to people's lives. To a large extent, the humanization and intelligence of the desk lamp will be met to meet the requirements of future smart homes.

Research purposes

Innovation comes from life, and all valuable creations will be used to improve people's quality of life. With the continuous development of modern society, the direction of innovation in the integration of smart things has received special attention. In these areas, people are good at developing ideas and dare to innovate, and accelerate the rapid development of intelligent products. As one of the essential household items in life, table lamps play a very important role in people's lives, especially for students and children. However, there are not many kinds of table lamps in the market. In order to meet the requirements of most people, we have begun to study a smart desk lamp that is compatible with the public. With the combination of some hardware modules and the help of some development platforms, it is more "thinking" to meet most people's expectations for the lamp.

The eyes are the windows of people's hearts. Therefore, many people hope that the lamps will protect our eyes. So with the platform of this contest, our team decided to make a multifunctional desk lamp. Of course, eye protection is one of its main functions. We decided to use a constant current driven LED as a light source to reduce the damage of the strobe to the human eye. At the same time, we use the light sensor module to collect the ambient light of the desk lamp to adjust the light itself. Brightness reduces brightness difference. We found out that many classmates hope that the modern desk lamp can have a sense of technology and sense of the times through the investigation of the classmates around us. Therefore, today we have decided to use the mobile phone APP remote console light on the APP page. We have done a lot of humanized design, such as: mode selection function, remote control switch, voice switch, brightness adjustment, temperature time, work data display and some fun features. The first design of this kind is to meet the requirements of modern people for product intelligence, and the other is the concept of humanized design of goods to better improve people's quality of life. Gestures to adjust the brightness of light in the modern society has not yet matured, this time we try to explore the specific conditions such as hand speed and speed to adjust the light intensity, make the table lamp more scientific and technical sense. In real life, many children do not develop good sitting postures in their early learning. In this competition, we try to achieve the function of correcting sitting posture, which is used to cultivate children's correct sitting posture to develop good study habits. Some people are afraid of the darkness at night, so we have joined the night light mode, using a few blue light-emitting diodes to send a beautiful blue light to help users sleep peacefully.

Module design illustration

Functional distribution map:

One of the hardware designs:

First, consider the design concept of desk lamps to better meet the requirements of intelligence, humanization, and multi-functionality. We use STM32F401Nucleo as the main control development board and Android Studio as the software APP development platform. At the same time, we have referenced and studied the information of many companies. , We have learned more about these platforms. Here's our hardware design flow plan.

1. In terms of appearance design of table lamps, due to the fact that the appearance of the lamps is not easy to shape and demonstrate is not good, the appearance of the lamps has been selected to be transformed on the old lamps to achieve the innovative and energy-saving effect of waste utilization. The desk lamp has a bendable column to adjust the light range, making it more practical. At the same time, we use an energy-saving eye-protection LED lamp as the light source, and do the welding of the main lamp by ourselves.

2. In the design, ST's STM32F401 Nucleo development board is used as the main control board, and mobile phone software is developed under the Android platform. In order to solve the hardware and software communication, the ESP8266wifi module is selected. ESP8266 is a low-power wifi chip designed by Shanghai Lexin Information Technology and integrates a complete TCP/IP protocol stack and MCU. The ESP8266 module is a serial wifi module based on ESP8266 chip research and development (increasing necessary peripheral circuits, serial flash, on-board antenna, etc.) by Shenzhen Anxin Co., Ltd., which is low in cost, easy to use, and powerful.

Hardware circuit two:

3. A mobile phone app named "smart desk lamp" was written on the Android studio software development platform. To realize the remote monitoring function of the desk lamp, there are multiple lighting mode selection functions on the main page of the application, and a progress bar to adjust the brightness of the light, display the current temperature and humidity, light intensity, time switch, voice switch, and work data display, etc. More life needs. We will explain in detail the subsequent physical photos and demonstrations.

4. Capacitive touch modules are used for electrodeless dimming. Capacitive touch modules are generally suitable for applications such as remote controls, lighting dimming, various types of switches, and control interfaces for vehicles, small appliances, and home appliances. Single-line touch, using capacitive touch principle, sensitive touch tentacles. The default is a switch function, dimming function, with stepless dimming function of LED touch with brightness memory fading. Turns on when the lights are turned on, and turns dark when turning off the lights, effectively avoiding eye irritation. At the same time, the brightness of the light can be adjusted by the length of the touch time. There is always a brightness suitable for you.

Hardware circuit three:

5, HC-SRO4 ultrasonic module. Ultrasonic ranging module generally has three parts: transmit, receive and signal processing. Ultrasonic transmitter only needs to give a high signal of at least 10 microseconds at the triggering end. It will automatically send eight 40 KHz square waves to automatically detect whether there is a return signal. The ultrasonic module is mainly used to correct the sitting posture needs. We will remind the user to maintain the correct sitting posture by working through the ultrasonic distance measurement function. Once the user's sitting posture is too large, the desk lamp will send an alarm reminder to allow the user to train well. Sitting habits.

6, human pyroelectric probe. The human pyroelectric module can detect if anybody passes in real time. If there is a return signal, the desk lamp is automatically turned on, which can facilitate the use of the user for the first time and can record the seating time and promptly provide feedback information. At the same time, it is beneficial to the user's night use. When someone is sensed to pass it, it will automatically turn on the light, which will facilitate the life of the people at night and will not affect the normal rest of the family. For those who are afraid of the night, the lamp has a night light mode at night, which allows users to fall asleep at ease and ensure better sleep quality. We also used four pyroelectric probes to make a gesture console light brightness function, changing the light on and off by the speed and direction of the hand.

Hardware circuit four:

7, DHT11 temperature and humidity module. DHT11 digital temperature and humidity sensor is a temperature and humidity composite sensor with calibrated digital signal output. It uses special digital module acquisition technology and temperature and humidity sensing technology to ensure high reliability and excellent long-term stability. The sensor consists of a resistive moisture sensor and an NTC temperature sensor and is connected to a high performance 8-bit microcontroller. The single-wire serial interface makes system integration quick and easy. The ultra-small size and extremely low power consumption make it the best choice for similar applications. So this time we chose this module to monitor the environmental changes around the desk lamp in real time and provide users with a healthier and more comfortable working and learning environment.

8, MQ-2 smoke, methane, liquefied gas, fuel gas module. The MQ-2 gas sensor is highly sensitive to liquefied gas, propane, and hydrogen and is ideal for the detection of natural gas and other combustible vapors. This sensor detects a wide variety of flammable gases and is a low-cost sensor for a variety of applications. Many families now use natural gas and gas to provide convenience for people's lives, but there are also some hidden dangers. Therefore, we use this module to detect home interior environments in real time and also to provide users with safer and healthier living spaces.

Hardware circuit 5:

9, the clock shows the PCF8563 module. The PCF8563 is a low-power CMOS real-time clock calendar chip which provides a programmable clock output. An interrupt output and brownout detector All addresses and data are serially transmitted over the I2C bus interface. Maximum bus speed is 400Kbits/s. Each read and write data The embedded word address register automatically generates an increment. This module provides protection for real-time time, and it can provide a reliable time reference basis for the real-time update of data on the mobile phone APP page.

Through the cooperation of the above modules, we upload the data collected by each module to the cloud and the mobile phone APP to make a connection, so that this desk lamp has "thought", it can meet people's needs as much as possible, improve people's The quality of life, while adapting to the direction of technological innovation, intelligence, materialization, and future development, has injected new vitality into the development of smart homes.

APP software design (partial)

/**

* Send command, command to send a single data point can use this method

* Note

* The command to issue multiple data points cannot be called multiple times with this method. Calling this function multiple times at one time causes the module to receive messages without referring to the method.

*

* @param key The corresponding ID of the data point

* @param value needs to be changed

*/

Public static void sendCommand(String key, Object value) {

If (value == null) {

Return;

}

Int sn = 5;

ConcurrentHashMap hashMap = newConcurrentHashMap ();

hashMap.put(key, value);

// Simultaneous delivery of multiple data points requires one-time placement of all keys that need to be controlled in the map.

// hashMap.put(key2, value2);

// hashMap.put(key3, value3);

mDevice.write(hashMap, sn);

Log.i("liang", "Send command:" + hashMap.toString());

}

[size=21.3333px]

APP software design (partial)

/**

*Update interface data display

**/

Protected void updateUI() {

myPowerCheckBox.setChecked(Lamp_Power);

myAutoCheckBox.setChecked(Lamp_Auto_Control);

tv_data_Lamp_Size.setText(Lamp_Size +"");

sb_data_Lamp_Size.setProgress((int)((Lamp_Size - LAMP_SIZE_ADDITION) / LAMP_SIZE_RATIO - LAMP_SIZE_OFFSET));

tv_data_Today_Humidity.setText("Humidity:" + Today_Humidity +"");

tv_data_Today_Temp.setText(Today_Temp + "°C");

tv_data_lamp_illumination.setText("Light Intensity:" + Light_Intensity);

tv_data_have_CombustibleGas.setText((Have_CombustibleGas) ? "Combustible gas": "No combustible gas");

tv_data_sitting_posture.setText((Sitting_Posture) ? "Sitting right" : "Incorrect sitting posture");

HashMap HMSataHashMap = DateTimeUtils.getIntTimeToHMS(Now_Time);

tv_data_time.setText(HMSataHashMap.get("h") + ":" +HMSataHashMap.get("m"));

initViewPager();

HashMap stringDataHashMap = new HashMap<>();

stringDataHashMap.put("Today_Study", Today_Study);

stringDataHashMap.put("Last1day_Study",Last1day_Study);

stringDataHashMap.put("Last2day_Study", Last2day_Study);

stringDataHashMap.put("Last3day_Study", Last3day_Study);

stringDataHashMap.put("Last4day_Study", Last4day_Study);

stringDataHashMap.put("Last5day_Study",Last5day_Study);

stringDataHashMap.put("Last6day_Study", Last6day_Study);

// Set the temperature line graph

studyTimeContentPager.setData(stringDataHashMap, Today_Date);

/**

* If the light is off, force the top picture to be darkest

*/

If (Lamp_Power) setTopLampLight(Lamp_Size);

Else setTopLampLight(-255);

}

STM32 hardware code (local)

STM32 hardware code (local)

APP page: Partial lighting control main interface

The APP clock settings interface diagram can be used to control the network time synchronization and time adjustment by using the digital tube clock on the console console.

Set date and time interface diagram

APP smart lamp mode selection interface

Innovation

Today, social LED lights occupy a powerful market with high energy-saving, long-life, and environmental friendly advantages, and are therefore the focus of attention. In recent years, high-brightness LED light sources have been rapidly advancing with the rapid development of technology, production technology, and cost reductions. Today, desk lamps can use LED light sources as energy-saving light sources with high brightness, high efficiency, and low power consumption.

The team designs this table lamp with the theme of innovative intelligence, simple and practical. The proportion of table lamps in today’s lives has become more and more important, and the public’s functional requirements for desk lamps have become higher and higher. In order to meet the requirements of a wider population, we have added many new innovative ideas and design requirements to this design:

1. Using a mobile phone APP to remotely monitor the lamp, easy to use and can understand the latest situation of the home environment in real time;

2, automatic dimming, voice dimming, manual dimming time for your convenience and speed to make efforts;

3, gestures to adjust the degree of light, by scanning the speed and direction of the hand to change the light;

4, for the correction of sitting posture has some help, you can cultivate good sitting habits, promote physical health;

5. Sedentary reminders, timed reminders, night lights, etc. provide convenience and protection for your healthy life.

Science and technology are the primary productive forces, and innovation is the source of strength for the continuous advancement of science and technology. Innovation must better serve human life and improve people’s living standards. Our innovative ideas are derived from the real needs of people’s lives. We strive to use the knowledge we learn to create value and explore the world with a knowledge-seeking mentality. Every little progress is the driving force of our constant advancement. We love life, we love science, and we love infinite creativity.

Practicality

Our smart desk lamp has advantages over other desk lamps in its intelligent design concept. Today, smart, energy-saving and environmentally-friendly products are constantly appearing in front of the public. The rapid development of science and technology has also made more and more items intelligent and simplistic. Ordinary desk lamps or household products will face the fate of reform. This is a trend and an inevitable phenomenon. Now we have the following practicalities in the analysis of the function of our works:

1. The rapid development of informatization has made our lives very close to everything. Everything seems to be completed by a mobile phone. The mobile phone has become an indispensable item in our lives. Therefore, we have equipped the desk lamp with an APP connection. We can perform some special operations on the table lamp through the APP page of the mobile phone so that you can control it at any time in other places.

2. In the mobile phone APP page, we not only set the switch function, but also set the voice adjustment, progress bar adjustment, and a variety of work mode selection functions. The operation is simple and easy to use. Our desk lamp can also adjust its brightness through the external light intensity, protect your eyes through different forms of light adjustment, and give you a comfortable learning working environment.

3, APP page side can also be through the table lamp to collect real-time data, such as your seating time, ambient temperature and humidity, light intensity, combustible gas and other data, and display these data in the APP page, so that you can be at home thousands of miles away The environment is well-known, ready to respond at any time, you can also view the working time data of nearly a week, to understand the use of the lamp.

4. If you have problems with business or you want to relax by reading books or read some articles before going to bed, or if you are afraid to indulge yourself, you can turn the lights on and off at the end of the appointment time. By automatically turning off the lamp to remind you to work or rest, this makes up for the common problem that we often forget about time.

5. Children's learning is a special concern for each of our families. The learning posture of children while learning is a headache for parents. Children will inadvertently bend over and linger on the table for a long time and will have a greater impact on the child's skeletal development. At the same time, learning to hurt the eyes at close range will be particularly serious. Our desk lamp design above considered this issue, so we added the function of sitting position correction. Use the ultrasonic module to determine if there is a sitting position deviation by the distance between the user and the lamp. If your body is heavily tilted or squatted, the desk lamp will automatically extinguish to remind the user to correct the sitting posture.

6, our products can be based on gestures and stepless dimming to achieve light control. There are 4 sensors on the top of the desk lamp. When our gestures pass quickly, the brightness of the desk lamp will increase from the darkest to the brightest. If your gesture slowly passes through, our small desk lamp will slowly become brighter. This is the same function as the 4 fingerprint keys on our desk lamp that implement the infinite function - stepless dimming. The first time the fingerprint button is pressed, the light changes from dark to light. When the second fingerprint button is in the process of the first light change, the small lamp is directly adjusted to the maximum brightness. The third fingerprint button is pressed. It will realize the transition from the light of the small desk lamp to the darkest until the light goes out; the time of the fourth fingerprint button is in the process of the third light change, and the small desk lamp will be extinguished directly. This is the realization of our Promise dimming function.

In general, all our thoughts and designs are designed to improve our quality of life and improve our living standards. Each function provides as much convenience for users as possible, in line with the requirements of people in modern society.

Market application prospects

Currently, the use of table lamps in society is relatively extensive, including home, study, and work. And the style of the table lamp is also dazzling. Especially with the rapid development of modern society, the advent of the era of science and technology, the gradual improvement of new materials, new technologies, and new equipment, the application of technology products will be closer to life. At the request of the State Council, the development of energy-saving and environmental protection industries is a powerful measure to foster the development of new kinetic energy and enhance green competitiveness. However, nowadays, the quality of the above-mentioned lamps on the market is mixed. A good LED lamp can achieve three major advantages: energy saving, environmental protection, and long life. It can meet the requirements of the country, but his price is relatively high. The common desk lamp is just the opposite. In the case of the same wattage, the ordinary lamp will consume more power. At the same time, the brightness control will not be automatically adjusted according to the actual situation and cannot be intelligent. This is far from the design concept of our energy-saving lamp.

About the intelligent lamp program part: 1. Switch between manual mode and automatic mode, you can control the switch between automatic mode and manual mode by pressing the button or APP.

Automatic mode 1: The desk lamp is automatically adjusted by acquiring the outside light value.

Automatic mode 2: The light is turned on, the lights go out, and people automatically adjust when they learn.

Manual mode: In the manual mode, the desk lamp can be controlled by the knob, APP and gesture control device.

संपर्क करें

Author:

Ms. wuxiuli

ईमेल:

lusia@hosun.cn

Phone/WhatsApp:

+86 18011577771

लोकप्रिय उत्पाद
You may also like
Related Categories

इस आपूर्तिकर्ता को ईमेल

विषय:
ईमेल:
संदेश:

Your message must be betwwen 20-8000 characters

We will contact you immediately

Fill in more information so that we can get in touch with you faster

Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.

भेजें