forked from Mjrovai/XIAO_Big_Power_Small_Board-ebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chapter_2-1.qmd
310 lines (212 loc) · 30.2 KB
/
chapter_2-1.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# 2.1 Introduction to Product Prototype Design {.unnumbered}
<br />
In the first unit, we've entered the realm of electronic hardware and programming, learning how to control electronic hardware through code to achieve desired effects, such as controlling an LED in various ways, making a buzzer sound, displaying text on an OLED screen, and more. Mastering this knowledge will help us turn the ideas in our minds into reality. In this section, we will learn about the process from an idea to a prototype and then to a product. Only when you have mastered this knowledge can you step into the world of product prototype design. If you have managed to stick with this course up to this point, there's no doubt that you are a "maker" at heart. The idea of "wanting to make something on your own" keeps swirling around in your mind. This section will provide you with some advice on how to become a maker and guidance on how to create electronic product prototype designs.
## 2.1.1 Cultivating the Maker Mindset
Becoming an excellent maker is not just about learning hardware modules and programming knowledge, but also consciously cultivating some habits.
<!-- ![Dale Dougherty](https://cdn.nlark.com/yuque/0/2023/png/2392200/1674012243691-4fc2b2ac-79ca-4f21-a28d-499257efbe8b.png#averageHue=%23805f3c&clientId=u9539e4d8-c35c-4&from=paste&height=492&id=R2AG0&originHeight=983&originWidth=1024&originalType=binary&ratio=1&rotation=0&showTitle=true&size=1791404&status=done&style=none&taskId=u1e77a651-7d83-4239-bbd7-0222c5d1542&title=Dale%20Dougherty&width=512 "Dale Dougherty") -->
![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_1.png)
Dale Dougherty, the founder of Make: magazine, gave some advice on cultivating the maker mindset in his welcome speech at Maker Camp (refer to 🔗 <https://makercamp.com/get-started>).
> ### Keep it playful
> Play opens us to creative ideas and new experiences. While we play, we engage our bodies and our mind, and we often engage with others. While we play, learning feels natural and we can take risks to do things we didn't know we can do.
>
> ### Be Curious
> Ask questions -- who, what, why, and how. How are things around you made? Who makes them and where are they made?
>
> ### Get physical
> Use your sense to experience the physical world all around you. What are the differences between the natural world and the built world?
>
> ### Find a favorite tool
> Tools exist for all kinds of applications. Given an area you're interested such as bicycles or music, what are some of the tools, both physical and digital, that you might want to learn to use? Choose a new tool and share it with us.
>
> ### Do something you've never done before
> Sometimes we decide that we're not good at something and we never try to do it. Part of the DIY spirit is to try something you've never tried before, even if you're not particularly good at it. Think of it as an experiment. See if you like it. Try cooking or gardening or playing a musical instrument. Or try to fix something that's broken. Share this new skill.
>
> ### Make something
> You might design something that solves a problem --- it could be a problem for you or a problem for others. You might build something that's interactive such as a play toy, or a toy car or plane. Paper airplane launchers are popular, as are rockets.
> ### What are the benefits of engaging young people in making?
>
> Here are the five key competencies that we identified as outcomes for young people who participate in Start Making!
> 1. Identify as a creator or maker. Young people develop positive attitudes toward creating hands-on projects. <br />
> 2. Develop confidence in creative expression. Young people feel capable of bringing their ideas to life by designing, experimenting, iterating, and persisting through failures. <br />
> 3. Acquire technical tool literacy. Young people become familiar with a variety of tools and technologies that they can use to make projects. <br />
> 4. Become aware of STEAM. Young people become aware of ideas and concepts that bridge science, technology, engineering, art, and math and demonstrate curiosity to learn more. <br />
> 5. Learn collaboration and networking skills. Young people actively engage in collaborating and helping others.
>
> **Start Making! A Guide to Engaging Young People in Maker Activities**
> By Danielle Martin and Alisha Panjwani edited by Natalie Rusk
> ### What are the attributes of a maker? What is a maker mindset?
>
> - Makers are curious. They are explorers. They pursue projects that they personally find interesting.
> - Makers are playful. They often work on projects that show a sense of whimsy.
> - Makers are willing to take on risk. They aren't afraid to try things that haven't been done before.
> - Makers take on responsibility. They enjoy taking on projects that can help others.
> - Makers are persistent. They don't give up easily.
> - Makers are resourceful. They look for materials and inspiration in unlikely places.
> - Makers share---their knowledge, their tools, and their support.
> - Makers are optimistic. They believe that they can make a difference in the world.
>
> **Making Makers: Kids, Tools and the Future of Innovation** By AnnMarie Thomas
## 2.1.2 Enlightening on Product Prototype Design
> **Author Introduction:**
>
<!-- >![温燕铭.jpg](https://cdn.nlark.com/yuque/0/2021/jpeg/2392200/1613976857337-bc6bba61-b3f9-41b2-ae1a-bdb0b7438d34.jpeg#averageHue=%23293735&height=358&id=AJTV3&originHeight=358&originWidth=358&originalType=binary&ratio=1&rotation=0&showTitle=false&size=31867&status=done&style=none&title=&width=358) -->
>![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_2.jpg)
>
>
>Wen Yanming, a post-90s female, graduated from the Chinese University of Hong Kong and South China University of Technology, with a master's degree in law. She is a hardware product manager, an inventor, an entrepreneur, with over a decade of technology practice and maker experience.
### 2.1.2.1 Basic Process of Product Prototype Design
<br />
From idea to product prototype and then to the product, this is a process that every product must go through. A product prototype allows us to quickly verify ideas, functionality, and product feasibility in a cost-effective way, providing the basis for product testing, optimization, and iterative updates. Behind every successful product we see, there may have been countless iterations of product prototypes. Therefore, creating a good product prototype is an essential process and solid foundation for a successful product. <br />
The prototypes needed for different types of products and different stages of the product are not the same. When we mention a product prototype, it may refer to a conceptual prototype, a functional prototype, a small batch production prototype, a factory hand model, etc. It should be noted that for electronic hardware products, the discussion here is mainly about product prototypes for product concepts and functional implementation. <br />
Generally speaking, the design of a functional product prototype mainly includes the following processes:
#### **1. Identify and Clarify the Problem to be Solved**
Einstein once said: "Posing a problem is often more important than solving a problem." Every product must exist to solve a certain problem or to provide some benefit to people. Therefore, identifying and clarifying the problem to be solved is a prerequisite for clarifying product design needs and proceeding with product design. <br />
It is important to note that just because we have identified a problem does not mean we truly understand and accurately define this problem. For example, over 100 years ago, when Henry Ford, the founder of Ford Motor Company, went around asking customers what kind of transportation they needed, almost everyone's answer was, "I want a faster horse." But do people really just need a faster horse? If Mr. Ford had defined the problem based on this, we might not have had faster and more comfortable cars so quickly.
<!-- ![](https://cdn.nlark.com/yuque/0/2023/jpeg/2392200/1685062120071-37824f9c-8cd0-4a09-ac83-029ddc7089ed.jpeg) -->
![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_3.jpeg)
#### **2. Demand Analysis and Product Definition**
Once the problem is clearly defined, we can extract unmet needs from it. Like the example above, the problem at that time was actually how to get to the destination faster, so the corresponding need was "a faster mode of transportation," not "a faster horse." Therefore, we need to be good at digging deeper from the problems we discover to find the real needs. Demand analysis generally requires an analysis of the user population and use scenarios, from which to derive the functions needed to solve the problem, that is, to clarify: for whom, in what scenarios, to achieve what functions, to gain what benefits.
<!-- ![](https://cdn.nlark.com/yuque/0/2023/jpeg/2392200/1685062878879-ce76911d-dda9-4897-8233-212464461e3f.jpeg) -->
![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_4.jpeg)
There are many types of needs: true user needs, superficial needs, urgent needs, ordinary needs, high-frequency needs, low-frequency needs, and so on. All of these need to be analyzed in light of the actual situation, which can then inform the correct definition of the product based on these needs. <br />
Every product ultimately needs to be commercialized to realize its maximum value. Therefore, when designing a product for the market, we also need to conduct a series of market analyses, including market size, sales expectations, profit analysis, payback period, input-output ratio analysis, and so on.
#### **3. Hardware Selection and Assembly**
For the design of electronic products, once the needs are defined, we need to find hardware that can implement these functional needs. When choosing hardware, the elements that generally need to be considered include: feasibility, level of need satisfaction, cost, volume, weight, performance, lifespan, appearance, etc. One of the most important abilities of an excellent product designer is to take into account various factors based on the product definition and needs, balance these factors, and make trade-offs. Often, there is no single correct answer. <br />
Generally speaking, when we build a prototype, the first thing we should consider is creating a minimum viable product (MVP). Its function is to use the least resources to quickly verify the product and quickly improve and iterate.
<!-- ![image.png](https://cdn.nlark.com/yuque/0/2023/png/2392200/1674012779932-e03196ba-e320-415a-8e83-bc343d563250.png#averageHue=%23fcfdfd&clientId=u9539e4d8-c35c-4&from=paste&height=138&id=clVEY&originHeight=276&originWidth=504&originalType=binary&ratio=1&rotation=0&showTitle=false&size=183326&status=done&style=none&taskId=u81f249b3-4d44-4ee1-bbb3-60040e3f6b6&title=&width=252) -->
![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_5.png)
#### **4. Software Development and Functional Implementation**
Many experienced software development engineers will draw a functional implementation flowchart before software development. They will draw a functional implementation flowchart according to the functions to be implemented. This can help clarify the software design thinking, check the function logic, facilitate the identification of leaks and deficiencies, and refer to it at any time during programming, ensuring they have a clear understanding. Therefore, regardless of the complexity of software function development, it is recommended that everyone develop a good habit of drawing a functional implementation flowchart first. It can be a simple hand-drawn sketch, or a professional software like Visio, Axure can be used to draw it.
<!-- ![](https://cdn.nlark.com/yuque/0/2023/jpeg/2392200/1685063621263-950b9448-3c39-490d-9b49-014959f4212a.jpeg) -->
<div style="text-align:center;"><img src="https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_6.jpeg" width="500" height="auto" style="margin:0 auto" /></div>
<br />
When developing software, try to be efficient and concise. Take full advantage of the benefits of the open-source community and learn to use existing hardware and software resources more effectively. For example, many pieces of hardware or applications already have many ready-made open-source libraries and routines. During development, you can refer to these, comply with the corresponding open-source agreements to use related resources, and avoid wasting time reinventing the wheel.
#### **5. Prototype Testing and Optimization**
After the prototype is made, we need to test it to verify its functional implementation and whether it meets the original design needs. This process should involve as many target users as possible to collect their feedback. In this way, we can better discover the defects in the product prototype, make remedial measures and improvements, update and iterate the design, and finally make a design scheme that meets user needs, laying a solid foundation for formal product design.
### 2.1.2.2 Product Prototype Practice - "One Meter Distance Alarm" Prototype
<!-- ![image.png](https://cdn.nlark.com/yuque/0/2021/png/2392200/1613977092405-4e69ce6a-e1ba-4f3e-9df7-b180a761b2f7.png#averageHue=%23a6aba7&height=515&id=YG12i&originHeight=515&originWidth=542&originalType=binary&ratio=1&rotation=0&showTitle=false&size=578081&status=done&style=none&title=&width=542) -->
![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_7.png)
Next, let's take the prototype manufacturing process of the "One Meter Distance Alarm" as an example to experience the product prototype design process.
#### **1. Identifying and Defining the Problem to be Solved**
At the beginning of 2020, the COVID-19 pandemic broke out globally, the situation was very severe. To prevent the virus from spreading through droplets and close-range airborne contact, governments and health departments around the world urged everyone to reduce gatherings and maintain social distancing of at least one meter whenever possible. However, it is not easy for everyone to constantly remember this and maintain an accurate social distance of more than one meter. For children, they often forget to maintain distance because they are playing happily, or they have no concept of how far they should keep their distance. When going out, there are also some strangers who, due to a lack of epidemic prevention awareness, unconsciously come close to us, and we need to find a polite way to remind them. <br />
Therefore, we have derived a question from life: **How can we constantly remind people to maintain a social distance of more than one meter?**
#### **2. Needs Analysis and Product Definition**
With the problem defined, let's analyze the core needs that this problem triggers: an epidemic prevention reminder device for public use that sends out reminders when others enter within one meter, thus encouraging everyone to consciously maintain a one meter social distance. <br />
Thinking further about the core needs, what kind of reminder should this be? We can think of the electronic products we usually use, what kind of reminders do they have? They are nothing more than sounds, lights, vibrations, screen text prompts, etc. Considering that the reminder needs to be timely, direct, and obvious, it's not easy to see the screen clearly at a distance of about one meter, and the volume will be larger and the cost higher after adding a screen, so we do not consider adding a screen. The remaining options are sound, light, and vibration. We can continue to balance and choose the necessary reminder method according to the cost, volume, and appearance. There is no single answer here. So, based on the needs analysis process, we tentatively define the product as: a device that emits light and vibrates to remind when it detects someone entering within a one meter distance.
#### **3. Hardware Selection and Assembly**
With the product defined, we can decompose the core functional requirements:
(1) Detect when a person enters within a one-meter distance <br />
(2) Alert self and others <br />
(3) Small size, easy to carry
So, what kind of hardware should be used to implement these respectively? In the process of product prototype implementation, we usually choose open-source hardware with low cost, complete information, and many routines to implement hardware functions. After comprehensively considering the cost, function realization, assembly difficulty, volume, software development resources, and other elements, I have chosen the following hardware:
| **Functional Requirements**| **Hardware Product** | **Function Introduction** |
|:---------------:|:--------------------:|---------------------------------------|
| **Main Board** |![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_8.jpg)<br />Seeeduino XIAO(SAMD21)| This is a mini-main control board developed by Seed Technology based on SAMD21. The volume is very mini, only 20x17.5mm, the size of a thumb, the interface is rich, the performance is strong, very suitable for the development of various small volume devices.|
| **Expansion Board** | ![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_9.png) <br /> Seeed Studio Grove Base for XIAO | Grove Shield for Seeed Studio XIAO is a plug-and-play Grove extension board for Seeed Studio XIAO series. With the on-board battery management chip and battery bonding pad, you could easily power your Seeed Studio XIAO with lithium battery and recharge it. 8 Grove connectors onboard includes two Grove I2C and one UART. It acts as a bridge for Seeed Studio XIAO and Seeed's Grove system. Flash SPI bonding pad allows you add Flash to Seeed Studio XIAO to expand its memory space, providing Seeed Studio XIAO with more possibilities. |
| **Distance Detection** | ![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_10.jpg) <br /> Grove - Time of Flight Distance Sensor(ToF) | There are many sensors to detect distance, most of which measure through ultrasound, infrared, lasers, etc. Among them, the Grove Time of Flight Distance Sensor is a new generation of ToF laser ranging module based on VL53L0X, which can provide accurate distance measurement up to 2 meters. The small size and high precision of this module made it my first choice. |
| **Light Alarm** | ![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_11.jpg) <br /> Grove - Circular LED | A Grove - Circular LED with a circle of LEDs can light up a white light. It is aesthetically pleasing and provides a larger, more noticeable light reminder compared to a single LED. |
| **Vibration Alarm** | ![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_12.jpg) <br /> Grove - Vibration Motor | A Grove module with a built-in vibration motor. It can be used plug-and-play, and it's convenient to generate continuous or intermittent vibration reminders by controlling the digital signal. |
| **Power Supply** |![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_13.jpg) <br /> 3.7V lithium battery (401119) | A mini-sized 3.7V lithium battery commonly used for Bluetooth headset power supply. The model is 401119, which represents the thickness, width, and length of the battery as 4mm, 11mm, and 19mm respectively. After welding this size lithium battery to the lithium battery pad on the Grove expansion board, it can be placed directly in the gap between the Seeeduino XIAO and the Grove expansion board, making the product more tidy and beautiful. |
| **Writing** | ![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_14.jpg)<br /> Grove universal connection cable (5cm) | The Grove universal connector is a standard connector for the Grove system. It can be used conveniently plug-and-play, without soldering and considering the line sequence. The Grove line connects various sensors and actuators to the expansion board, making the project building as simple as building blocks and saving a lot of time. The 5cm short line is very suitable for space-compact product prototypes. |
The module connection is as follows, as depicted in the image:
<!-- ![](image_link#id=jIyA5&originalType=binary&ratio=1&rotation=0&showTitle=false&status=done&style=none&title=)![](https://cdn.nlark.com/yuque/0/2021/jpeg/2392200/1613977261986-b3021f68-4051-4dae-a978-d4a86496daa4.jpeg#averageHue=%23f0efec&height=436&id=GICgv&originHeight=762&originWidth=1280&originalType=binary&ratio=1&rotation=0&showTitle=false&status=done&style=none&title=&width=732) -->
![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_15.jpg)
The chosen hardware modules have a great structural design, which can be directly used to build the distance alarm's form factor, saving time in making a shell. Thus, the production method is quite simple: all that's needed is to connect each piece of hardware to the appropriate interface, arrange their respective positions, and then bond them together with hot melt adhesive. This quickly completes the hardware connection and form factor building of a one-meter distance alarm. The completed hardware product is as follows:
<!-- ![](https://cdn.nlark.com/yuque/0/2021/jpeg/2392200/1613977262551-acc27698-c462-4b2c-9683-3bf14e670be7.jpeg#averageHue=%23b2b796&height=185&id=KPqkb&originHeight=456&originWidth=740&originalType=binary&ratio=1&rotation=0&showTitle=false&status=done&style=none&title=&width=300) -->
<img src="https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_16.jpg" width="400" />
<!-- ![](https://cdn.nlark.com/yuque/0/2021/jpeg/2392200/1613977262907-c0794fdb-599a-495e-b4dd-24c6b04819d8.jpeg#averageHue=%239f8978&height=224&id=Z9Lo0&originHeight=686&originWidth=915&originalType=binary&ratio=1&rotation=0&showTitle=false&status=done&style=none&title=&width=299) -->
<img src="https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_17.jpg" width="400" />
#### **4. Software Development and Function Implementation**
Before officially writing the program, I planned the functions and logic that the software needs to implement and drew the following functional implementation flow chart using Visio:
<!-- ![](https://cdn.nlark.com/yuque/0/2023/jpeg/2392200/1685066059822-b76b3433-25c7-48bb-94fd-3fc0298dea80.jpeg) -->
<div style="text-align:center;"><img src="https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_18.jpeg" width="300" height="auto" style="margin:0 auto" /></div>
<br />
Because Seeeduino XIAO supports Arduino IDE, I chose to program in the Arduino IDE. Most of the hardware provided by Seed Technology is open source, and they offer excellent documentation support for their products. Thus, during the programming process, I found the corresponding open-source hardware Wiki on the [Seeedstudio official website](https://www.seeedstudio.com/), downloaded the relevant library files (note: library files are a collection of specific functionalities provided by developers that can be used by simply calling them, without having to rewrite the code), and referred to the example routines of the used modules. I completed the program swiftly.
After the program was written and compiled successfully, I connected the Seeeduino XIAO to the computer via a Type-C connection and downloaded the written code to the Seeeduino XIAO through the Arduino IDE. Once the code was successfully uploaded, the prototype was completed.
<!-- ![L7-企业微信20230526-101448\@2x.png](https://cdn.nlark.com/yuque/0/2023/png/2392200/1685067376948-eafe0e40-5ffa-4ae0-9409-427d28dbc7f8.png#averageHue=%23bc965e&clientId=u744e8794-7deb-4&from=ui&id=ua178d0eb&originHeight=1490&originWidth=2304&originalType=binary&ratio=2&rotation=0&showTitle=false&size=430681&status=done&style=none&taskId=u51f7f93e-d586-4e90-abd3-4f9c0a12000&title=) -->
![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_19.png)
#### **5. Prototype Testing and Optimization**
<!-- ![image.png](https://cdn.nlark.com/yuque/0/2021/png/3013093/1614079479972-2f595c72-afee-46d8-b59e-0f166b8a035f.png#averageHue=%23676a5a&height=1009&id=wIY0f&originHeight=1009&originWidth=1849&originalType=binary&ratio=1&rotation=0&showTitle=false&size=3625057&status=done&style=none&title=&width=1849) -->
![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_20.png)
<!-- ![image.png](https://cdn.nlark.com/yuque/0/2021/png/3013093/1614079875442-8b9e49f0-2f90-46ff-9d9e-a102336aaf80.png#averageHue=%23686b5c&height=1004&id=mdxhD&originHeight=1004&originWidth=1848&originalType=binary&ratio=1&rotation=0&showTitle=false&size=3620892&status=done&style=none&title=&width=1848) -->
![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_21.png)
<!-- ![image.png](https://cdn.nlark.com/yuque/0/2021/png/3013093/1614079904491-cd75e5d1-5315-4923-8dcc-a0242f32fa68.png#averageHue=%23686a5c&height=1006&id=KloD6&originHeight=1006&originWidth=1849&originalType=binary&ratio=1&rotation=0&showTitle=false&size=3649746&status=done&style=none&title=&width=1849) -->
![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_22.png)
<!-- ![image.png](https://cdn.nlark.com/yuque/0/2021/png/3013093/1614079939116-c26254f4-dbbc-43f6-a443-5682af15dfd0.png#averageHue=%23656959&height=997&id=KVdLR&originHeight=997&originWidth=1848&originalType=binary&ratio=1&rotation=0&showTitle=false&size=3679170&status=done&style=none&title=&width=1848) -->
![](https://files.seeedstudio.com/wiki/XIAO_Big_Power-Board-ebook-photo/chapter_2-1/chapter_2-1_23.png)
After completing the prototype, it was time for testing. First, I needed to test whether the prototype implemented the basic functionality, i.e., whether it would sound and light an alarm when a person was detected within a one-meter range. Then, I had to use it in an actual scenario to see if the user experience was good enough. If it could meet the product's requirements and definition satisfactorily, the product prototype could be deemed successful, and the next step in product development could be initiated. Of course, if issues were found during testing, adjustments and improvements were required, followed by retesting. This process is repeated until the product prototype meets the requirements, and the final scheme is determined.
Finishing the prototype is just the first step in making a successful product. The birth of each product requires a lot of effort, continual trial and error, and adjustment to achieve the best results. The final success of a product, in addition to meeting user needs, also needs to withstand many market tests. This requires students, when beginning to learn to make products, to always maintain the spirit of a craftsman, while also keeping a keen sense for the market, and learning knowledge beyond the product itself. There is a long way to go, and I hope everyone can stick to their original intentions, keep exploring, and ultimately make successful products.
The source code of the program is as follows:
``` cpp
#include <Grove_LED_Bar.h>
#include "Seeed_vl53l0x.h"
const int Buzzer = 8;//Vibration motor connected to D8
Grove_LED_Bar bar(0, 1, 0, LED_CIRCULAR_24); //Grove-LED ring connected to D0
Seeed_vl53l0x VL53L0X; //Grove-tof distance sensor connected to IIC (D4/D5)
#if defined(ARDUINO_SAMD_VARIANT_COMPLIANCE) && defined(SerialUSB)
#define SERIAL SerialUSB
#else
#define SERIAL Serial
#endif
void setup() {
bar.begin();
pinMode(Buzzer, OUTPUT);
digitalWrite(Buzzer, LOW); // turn the Buzzer on (HIGH is the voltage level)
// Turn off all LEDs
bar.setBits(0x0);
VL53L0X_Error Status = VL53L0X_ERROR_NONE;
SERIAL.begin(115200);
Status = VL53L0X.VL53L0X_common_init();
if (VL53L0X_ERROR_NONE != Status) {
SERIAL.println("Starting VL53L0X measurement failed!");
VL53L0X.print_pal_error(Status);
while (1);
}
VL53L0X.VL53L0X_long_distance_ranging_init();
if (VL53L0X_ERROR_NONE != Status) {
SERIAL.println("Starting VL53L0X measurement failed!");
VL53L0X.print_pal_error(Status);
while (1);
}
}
void loop() {
VL53L0X_RangingMeasurementData_t RangingMeasurementData;
VL53L0X_Error Status = VL53L0X_ERROR_NONE;
memset(&RangingMeasurementData, 0, sizeof(VL53L0X_RangingMeasurementData_t));
Status = VL53L0X.PerformSingleRangingMeasurement(&RangingMeasurementData);
if (VL53L0X_ERROR_NONE == Status) {
if (RangingMeasurementData.RangeMilliMeter >= 2000) {
SERIAL.println("Out of range!!");
digitalWrite(Buzzer, LOW); // turn the Buzzer off (LOW is the voltage level)
// Turn off all LEDs
bar.setBits(0x0);
}
else if (RangingMeasurementData.RangeMilliMeter <= 1000) {
digitalWrite(Buzzer, HIGH); // turn the Buzzer on (HIGH is the voltage level)
// Turn on all LEDs
bar.setBits(0b111111111111111111111111);
SERIAL.print("Distance:");
SERIAL.print(RangingMeasurementData.RangeMilliMeter);
SERIAL.println(" mm");
}
else {
digitalWrite(Buzzer, LOW); // turn the Buzzer off (LOW is the voltage level)
// Turn off all LEDs
bar.setBits(0x0);
SERIAL.print("Distance:");
SERIAL.print(RangingMeasurementData.RangeMilliMeter);
SERIAL.println(" mm");
}
}
else {
SERIAL.print("Measurement failed!! Status code =");
SERIAL.println(Status);
digitalWrite(Buzzer, LOW); // turn the Buzzer off (LOW is the voltage level)
// Turn off all LEDs
bar.setBits(0x0);
}
delay(250);
}
```
> Get this program from Github <br />
> <https://github.com/mouseart/XIAO-Mastering-Arduino-and-TinyML/tree/main/code/L7_tof_XIAO_en>