Home > Industry Insights >Servo
TECHNICAL SUPPORT

Product Support

Use Raspberry Pi and servo to track human body by yourself

Published 2026-05-11

Have you ever seen a figure quietly flashing past you in the corner of a surveillance screen, but the camera seems to be frozen and unresponsive, recording only half of an empty wall? If you think about it carefully, all the "intelligent" eyes in this world are just blind people who don't light the lamp, so there is no point in working blindly. But today, you and I find another way.I’m asking, if I give a small Raspberry Pi a flexiblekpowerCan the gear steering servo recognize the human figure and follow it closely?? Think carefully, the answer is in your hand.

Let’s start from this small platform. The Raspberry Pi is only as big as the palm of your hand, but it is the "brain" part that plays a key role in the entire system. It is placed quietly in the center of the table, with a cable connected around it, which extends towards a particularly small camera - that camera is the so-called "eye". Above the eye, that's where the servo is. The servo is like an extremely loyal warrior, holding up the camera steadily. It can rotate left and right to look around, and can also tilt up and down to observe the situation between heaven and earth. You see, the layout and combination of this world is so simple: the brain is in the center, the eyes are above the brain, and the joints are in between the brain and the eyes. If you think about it carefully, is this arrangement secretly in line with some kind of providence? I once heard that a young man put this thing on the window sill. Whenever a bird flew by quickly, the camera would follow. The birds were frightened, but the person smiled. It turns out that the machine also has emotions that flow slightly like warmth.

However, with only a skeleton, how can it resist the situation where the soul is not attached? What is "tracking"? Tracking does not rely on brute force, but a combination of vision and determination. The camera captured a continuous patch of light and shadow, which is where the so-called "human form" lies. So how to identify human figures from many pixels? It relies on the "human body tracking algorithm". The algorithm is just like the people who were good at judging horses in ancient times, able to identify the skeletal characteristics of a thousand-mile horse in a chaotic state. Today, this algorithm is sleeping inside the Raspberry Pi chip.When there is a person standing in the picture, the algorithm immediately wakes up, points to a coordinate and says: "Look, that's where it is."! "After the servo hears the sound, it starts to act, as flexibly as a human arm using its fingers, and aims the camera at the coordinate position. When the person moves, the coordinates move accordingly; when the coordinates move, the servo follows closely. This cycle goes back and forth, and there is no limit to stopping. If you think about it carefully, things with intelligent attributes in the world are just the essence of the six words "perception-decision-action".The young man later said: "It stared at me three times faster than my shadow.. "This is not false. The reason is that there is no regularity in the speed of electrons.

树莓派和舵机实现人体追踪_树莓派和舵机实现人体追踪_树莓派和舵机实现人体追踪

Does anyone wonder, between the fixed gaze and the agile eyes, who has the advantage and who is slightly inferior? Let's make some comparisons. A fixed camera is like a frog at the bottom of a well. All it can see is a small area. Once a person leaves that limited area, it is like a cow stuck in a quagmire, disappearing without a trace. However, the tracking eyes assisted by the servo are like eagles circling in the sky, and the scope of their vision can cover the entire vast world. I saw stall owners at night markets using something like this to look after their fires. When someone approaches, the camera will rotate accordingly; when the person leaves, the camera will return to its original position. Throughout the night, there was no shelter around the fire, and the thief had no place to hide. Do you think this is a fairy tale? No, this is just changing "waiting to be watched" to "actively exploring". If you think about it carefully, the difference between active and passive is not just the distance of one steering gear. Closed-loop feedback, these four simple words, are just a bit of ink when written on paper, but when you actually do it, you realize that there is a world-wide difference. When the human figure deviates from the center of the screen, the system will know that it has made a mistake; knowing that it has made a mistake, it will correct it immediately. The speed of this correction is faster than the speed of your blink of an eye. The stall owner later lamented: "It's more diligent than my waiter." Although this was a rough statement, it made the key point clear.

So, to accomplish this important thing, does it require a skill as powerful as having three heads and six arms? In my humble opinion, this idea is extremely wrong and not at all true. All you need is a Raspberry Pi, a servo that can support PWM signals, and the open source vision library. Connect them like a child doing a jigsaw puzzle, red by red, brown by brown. However, the most difficult thing is what seems to be the simplest - patience. When the boy started the program for the first time, the servo spun like crazy and almost knocked over the tea cup. It turns out that one of the pin numbers in the code was written incorrectly. After making the modifications, restart, and the world returns to peace. You see, even as smart as a Raspberry Pi, there are times when the mind gets confused. If you think about it carefully, mistakes are not stumbling blocks, but steps that enable people to climb higher. From this perspective, every debugging is a secret conversation between man and machine.

When writing here, try to cite several examples to prove its truth. The most typical case that can be seen usually is classroom monitoring. There is a teacher who wants to record his entire class writing on the blackboard and walking around. If a fixed camera position is used, once the teacher walks out of the screen, only the empty chair will be left. So I used a Raspberry Pi and a servo to make a tracking gimbal myself. When the teacher walks to the left of the blackboard, the camera turns to the left; when the teacher walks to the right, the camera turns to the right. In the finished film, the teacher is always in the middle of the picture, as if there is a professional cameraman following him. Another example is home security. The old man was active in the living room, and his children were worried outside. If the camera was still and the old man fell in the corner, the picture would only capture one corner of the sofa. With the tracking eye, once the old man moves, the camera will follow closely. The old man's posture when he fell and his voice calling for help were known immediately even if he couldn't help him. Another example is the interactive art exhibition. There is a screen set up in the exhibition hall, and a tracking gimbal is hidden behind the screen.When the audience walks to the left, the content on the screen will also rotate accordingly, always facing the audience in the most frontal direction.. The audience was surprised to find that they were being "watched" and couldn't help but smile. If you think about it carefully, isn’t the human touch contained in technology reflected here?

Maybe by this time, you are already moved. However, heartbeat is not as good as action after all, and action requires strategic methods. The first strategy is, don’t strive for perfection. Instead, first enable the servo to rotate according to the movement of the mouse, and then slowly add humanoid detection. The second strategy is to break down your goals.Don't think that you can track like flying overnight. First, you must be able to follow a colorful ball, and then transition to following a human form.. The third strategy is to test again and again. The movement of the servo is different in speed; the computing power of the Raspberry Pi is also different. You need to find the "comfort zone" of your own hardware. The young man's final plan was not the fastest tracking, but the most stable tracking - only ten judgments were made per second, but each time was accurate. Only when you think carefully and make choices can you show your wisdom.

树莓派和舵机实现人体追踪_树莓派和舵机实现人体追踪_树莓派和舵机实现人体追踪

Question: What should I do if the servo shakes or rotates randomly?

The answer is, you need to check whether the power supply is in a stable state. The USB port of the Raspberry Pi has insufficient power supply. You must use an independent power supply to supply power to the servo.

Question: I can’t keep up when people walk faster. How can I improve?

Answer: Reduce the image resolution, reduce the calculation amount of the algorithm, or switch to one with greater torque.kpowerServo's method.

Question: Can’t chase people when the light is dark at night?

Answer: Install an infrared fill light and switch to thermal imaging or infrared motion detection algorithm.

If you think about it carefully, among the numerous machines in the world, there are many machines that can move, and there are also many machines that can see. However, machines that can move because of "you" are extremely rare.. From now on, you will no longer lament that the camera looks dull. Take out the Raspberry Pi at hand and connect it to the small servo, and you give it a dynamic soul. The moment it starts to rotate, the moment it stares at you closely, you will know - this is no longer a cold record without emotion, but a gaze full of affection. As people often say, a machine has a unique world, and one action seems to span the entire day. Go ahead and make your machine learn to look with your eyes.

Update Time:2026-05-11

Powering The Future

Contact Kpower's product specialist to recommend suitable motor or gearbox for your product.

Mail to Kpower
Submit Inquiry
WhatsApp Message
+86 0769 8399 3238
 
kpowerMap