Developed based on STM32F030F4.
https://www.bilibili.com/video/BV1YK411W7Tf/
https://www.mydigit.cn/forum.php?mod=viewthread&tid=155880
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:
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:
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.
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:
Cooperate with ESC brushless ESC to drive the hard disk main motor
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet