走马观花

Servo/ESC tester

 
Overview

Introduction

Developed based on STM32F030F4.

  • With EN output control function, it can control the opening and closing of the signal (throttle) at any time
  • Can be freely switched between 2 preset speeds
  • Wide voltage power supply (5~12V), low power consumption
  • Cheap and easy to make

B station demonstration video:

https://www.bilibili.com/video/BV1YK411W7Tf/

Digital Home Post Link

https://www.mydigit.cn/forum.php?mod=viewthread&tid=155880

Production ideas

First of all, I don’t want to make a particularly complicated and expensive tester, because the final function it needs to achieve is actually very simple, which is to control the ESC or test the servo. Therefore, the final product must be as cheap as possible, otherwise it will be too expensive to be worthwhile. I once bought a cheap tester online, the kind with a knob, the price was 7.5 yuan. The cost budget this time is naturally based on this. A little more tolerance, 10 yuan is enough.

Then start to determine the plan. Since it needs to be cheap, the display method is naturally the best display method. And it's best to use direct drive, without the need for a dedicated LED driver. Since the speed value is between 0 and 99, it is meaningless to control the speed too finely. So I chose a 2-digit digital tube.

Next is the choice of MCU. If it is cheap, the first thing that comes to mind is STC's 51 microcontroller, but after searching the price, I finally chose the STM32 F0 series microcontroller. The specific model is STM32F030F4P6. The cheapest single-chip microcomputer can be purchased for only 1.5 yuan, which is very cheap. Although the price is cheap, the functions are not cheap at all: 16K Flash, 4KB SRAM, a maximum frequency of 48MHz, 12-bit ADC, and 5 timers. The relatively ordinary 51 can be described as luxuriously equipped. With rich configurations, it will naturally be easier to write code without having to worry about anything. .

DATASHEET for STM32F030F4: image.png

But there is a problem next. STM32F030F4P6 is a 20-pin IC with a total of 15 GPIO ports. However, among these 15 GPIOs, PA13 and PA14 are assigned to the SWD debugger for code downloading and debugging. Although they can be reused, But this would be too much trouble. In this way, we only have 13 IO ports available.

These 13 GPIOs must implement the following functions: 4 buttons, a signal output, an output status indicator light, and a digital tube driver.

The digital tube is 2 digits, so a total of 10 GPIO drivers, 8+2, are needed. If the decimal point is not controlled, 9 IOs are needed. But I want to have multiple sets of throttle switching functions, which require decimal points as indicators, so I can’t omit them. This leaves only 3 IOs. Among these three IOs, the signal output cannot be omitted, so only two are left as signal output instructions and key input. If the indicator light occupies another one, there will be only one left for key input.

How does an IO accept input from 4 keys? At this time, the ultimate IO saving method is needed: ADC button scanning. To put it simply, the buttons are connected to a voltage divider network and then connected to the ADC interface of the microcontroller. Use the collected voltage to determine which button was pressed. The biggest advantage of ADC key scanning is that it saves IO. The disadvantage is that the keys easily interfere with each other, take up a lot of CPU time, and cannot use interrupts. However, this shortcoming is not considered a shortcoming in the current application environment.

In the final design of the ADC key scan circuit, you can notice that the keys have priority: image.png

The plan is determined, and the next step is schematic design, PCB Layout, and proofing. I have to say that Lichuang EDA’s 3D preview is really easy to use. image.png

While waiting for proofing, you can write the code first. However, there is nothing to say about this. It is very simple. Using the TIM1 advanced timer of STM32, you can easily achieve a standard PWM control signal with an output frequency of 50Hz and a high-level time between 1~2ms. ADC scanning of buttons uses DMA, which can simplify the code writing process. Then the board came back, welded, debugged, fixed some minor bugs, connected to the ESC, powered on, success!

Finally, the cost is calculated: the microcontroller is 1.8 yuan, the digital tube is 0.5 yuan, and the PCB is 5 yuan for 5 pieces, an average of 1 yuan per piece. It is difficult to calculate the original price of other resistors, capacitors and connectors, so the total cost is 3 yuan. The total cost is 6.3 yuan, yes, not bad~ Even if you buy all these components in Lichuang Mall, it won’t cost much. Not to mention there are coupons, hehe.

Physical picture

Physical picture: IMG_3692.jpg

Cooperate with ESC brushless ESC to drive the hard disk main motor IMG_3691.jpg

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2024-11-15 01:55:56

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号