Electronics > Projects, Designs, and Technical Stuff
Control a servo from a potentiometer, WITHOUT a microcontroller?
SiliconWizard:
--- Quote from: I wanted a rude username on December 04, 2019, 03:41:22 am ---Presenting electronics golf: solve this problem to minimise Σ(electronic components, lines of code)!
--- End quote ---
There's a slight contradiction between your title "without a microcontroller" and the last line "minimise Σ(electronic components, lines of code)".
I guess here, the goal is to do without an MCU, so no lines of code at all. (Or maybe you were thinking about a CPLD/FPGA?)
Any programmable component, such as an MCU or FPGA, may actually hide a lot of "lines of code" via libraries (/respectively ready-made IPs), so generally speaking, "code golf" contests have to be strictly defined, otherwise they don't mean much. You could be using a crapton of external libraries and make your own code only a 1-liner, is that a valid approach? Is the goal about designing something with the least amount of code/components overall, or is it about doing it with the least amount of effort? The two can be almost completely opposite and contradictory.
Anyway here, assuming 1/ you said NO MCU and 2/ you didn't say "only with discrete parts", one of the simplest solutions in terms of both design effort and number of parts would be to use, for instance, an LTC6992. It would only require 1 resistor to set the period, and it has a control input for the duty cycle. Then to do it "right" (design it such that the output pulse width is settable in the standard range for a servo, which is often 1ms to 2ms, with 1.5ms being neutral), you'd need two additional resistors (at each end of the pot), along with the pot. Then pot wiper to the MOD input. Add a decoupling cap for good measure on the power supply. That's 1 IC, 3 resistors, 1 cap, zero code or configuration, and you'll get something relatively stable.
m98:
Another solution: One GreenPAK
SiliconWizard:
--- Quote from: m98 on December 04, 2019, 04:23:55 pm ---Another solution: One GreenPAK
--- End quote ---
Nice devices. But they are "programmable", aren't they? So requiring some "lines" of "code". Or I don't know exactly how you configure them.
Which raises the question: if we want to minimize both part count AND "lines of code", how are we going to "normalize" both measures?
If one solution requires 5 components but zero line of code, is it better or worse than one requiring only 1 component and using 5, 10, 100 lines of code? How can we compare hardware and "software"?
Etesla:
Here's one solution:
tggzzz:
--- Quote from: I wanted a rude username on December 04, 2019, 03:41:22 am ---Using a microcontroller to read a potentiometer and PWM a servo accordingly is a favourite Arduino task, and can probably be done in a few lines of code.
But can it be done in zero lines of code? Is there a non-microcontroller solution to this problem? I have one in mind, but it uses a bunch of discrete components.
--- End quote ---
How do you think servos were controlled when computers were the size of rooms and cost 1000 times your annual salary?
It does require a basic understanding of analogue electronics, control theory, particularly PID loops and backlash - but that's equally true for a software control loop.
Alternatively look at and understand the concepts in analogue computers.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version