Analog voltage to PWM converter - Page 1
Forum section: electronics / beginners

author: Leopoldo
author_rank: Contributor
timestamp: January 08, 2015, 07:04:18 pm
content: Hi,I wanted to know whether it is possible or not to make or where to find a converter that takes an analog voltage input (of course 0-5V) and convert it into a PWM output that has to go in an ESC, but it's not that simple: since I've chosen an ESC that has an extremely high precision of 32bit,I wanted to waste the least possible precision in every component before it,so the method of the analog input+triangle or sawtooth wave comparator made with op-amps is excluded. Is there another way to get what I want? I'll probably don't have acces to other pins of the MCU so I'd prefer using the PWM input. Thanks!!!

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 08, 2015, 07:57:50 pm
content: How do you know that the controller actually computes 32 bits of accuracy?For that matter, where in the hell do you find a motor that accurate? Even with a tach and PLL, that's a strong statement to make if it has any kind of bandwidth (i.e., how many years are required before its operating point actually stabilizes to the parts-per-billion level?).It's also more-or-less impossible that you have a nanovolt-precise analog signal, so there's no way to start with a 32 bit number, convert it to a voltage, then convert it back to something digital (like a tach speed) without throwing away about 12 bits in the process. Analog around 12 bits is precision, under 20 bits is difficult; there are 24 bit converters out there, but the LSBs are a good source of noise and not very coherent with the signal anymore. 32 bits is essentially impossible, unless perhaps you're NIST and everything is bathed in liquid helium.Most importantly... what will you ever be using it for, that will need 32 bits of accuracy? Can you visualize a situation where that's ever a concern, let alone possible? 32 bits out of an entire meter is the width of one or two atoms! It's possible to resolve positions that fine (STMs and such are capable), but not on that kind of scale!Tim

author: dannyf
author_rank: Super Contributor
timestamp: January 08, 2015, 08:14:13 pm
content: Quote=555.Infinite number of resolutions.

author: Leopoldo
author_rank: Contributor
timestamp: January 08, 2015, 08:38:23 pm
content: I'll link you the ESC,so if I've misunderstood something you can tell me; anyway,do you think it's possible to get at least 9 or 10 bit accuracy? 8 bit seems to me too low,especially because if I understood correctly, ESCs don't even work with 0 to 100% duty cycle,but with something like 2 to 4% ; for the analog voltage input I wanted to get the output from a PLL,the stage before the VCO,and maybe divide it with a resistor divider and a very low value cap to have a little more precision before the converter. I have to rely on a PLL because I have to control the frequency and phase of two signals over 16000 times a second,and the max error I canhave has to be no more than 2-3%....I know it's a bit impossible,but I'v seen people doing it without many problems...I even thought about controlling the motor in a open loop configuration,but by the fact that it is a brushless one it'll probably end up just failing quite soon,since it has to get to 320Hz (yes,Hz,which are about 18000rpm). Meanwhile thanks for the reply!http://www.aliexpress.com/store/product/2-5S-AutoQuad-ESC32-72MHz-32bit-ARM-electronic-speed-controller-for-Multi-copter/224107_1366392010.html

author: jlmoon
author_rank: Unknown
timestamp: January 08, 2015, 08:53:15 pm
content: Quote from: T3sl4co1l on January 08, 2015, 07:57:50 pmSpeaking of reading nano-volt levels.. I have a 3458A and things have to really be quiet around my place to even get some kind of integrity in those ranges. I can just bang a lead on the lab table (depending on the dielectric type) and make that nano-volt level jump all over the place. I would think one would be lucky to measure with any form of stability in the microvolt ranges when dealing with motor controllers and such.

author: tszaboo
author_rank: Super Contributor
timestamp: January 08, 2015, 09:32:10 pm
content: You need a Delta-sigma modulator, if I understand correctly. For example:"The ADS1201 is a single channel, second-order, CMOSanalog modulator designed for high resolution conversionsfrom dc to 1000Hz. The output of the converter (MOUT)provides a stream of digital ones and zeros. The timeaverage of this serial output is proportional to the analoginput voltage."They say up to 20 bits.

author: dannyf
author_rank: Super Contributor
timestamp: January 08, 2015, 09:39:54 pm
content: QuoteWhat you have is a gimmick: something that looks great on paper but has no practical uses.You will find that with motors, 32-bit pwm has zero practical value. I would further state that even 10-bit pwm has zero practical value.All it does is to increase the complexity of your project.

author: max_torque
author_rank: Super Contributor
timestamp: January 08, 2015, 09:45:02 pm
content: Quote from: Leopoldo on January 08, 2015, 08:38:23 pmlol^^ the ESC uses a 32b ARM processor. It won't be using 32b precision on it's pwm outputs, probably 16b max, more likely 12b. What is the fundamental pwm frequency? At a typical 20kHz, 32b of precision would need the mother of all clocks, and even 16b is pretty fast (20,000 * 65535)

author: Leopoldo
author_rank: Contributor
timestamp: January 08, 2015, 09:58:15 pm
content: So,what do you all suggest? How can I solve myproblem?

author: dannyf
author_rank: Super Contributor
timestamp: January 08, 2015, 10:02:34 pm
content: QuoteYou never had a problem to being with.The conversion can be done a gazillion different ways, depending on your comfort levels, parts availability, etc. For example, it's a child's play to code a mcu to read a voltage input and output a pwm pulse train; the 555 would be an analog solution; etc.Without knowing what you are comfortable with, it is impossible to provide you with suggestions.

author: KM4FER
author_rank: Regular Contributor
timestamp: January 08, 2015, 10:14:49 pm
content: The spec on the ESC says that it uses an STM32F103 chip.Looking at the datasheet for the STM32F103 I see:. PWM timer - 16 bits. ADC and DAC resolution - 12 bitsSo, now what resolution is obtainable in your application using this chip?It pays to read the details, not the marketing hype.

author: w2aew
author_rank: Super Contributor
timestamp: January 08, 2015, 10:16:32 pm
content: Quote from: Leopoldo on January 08, 2015, 08:38:23 pmThe other thing that you have to remember is that this ESC takes a typical RC control pulse as the input - which is a 1-2ms wide pulse, repeating about every 20-30ms. It is the width of the pulse that determines the "throttle" position. This is *NOT* the same PWM signal that drives the motor(s). From the page you provided, it looks like this ESC is programmable for a 4kHz to 64kHz PWM frequency, which would presumably be adjusted from 0 to 100% duty cycle for the 1-2ms input control pulse width.If you're trying to match speeds - precise throttle position control is not the way to do it - too many variables. Closed loop control seems like the right way to go...

author: Leopoldo
author_rank: Contributor
timestamp: January 08, 2015, 10:30:17 pm
content: But the PWM that I'd generate would actually determine the speed of the motor or not? And anyway,it is already a closed loop once I use an ESC,it has the Back EMF that it uses as "encoder"... What I meant with open loop is that I control the motor through a rising-speed sequence on the mosfets that drives the coils but I'm completely blind about the motor position,just knowing that it is going(I hope)...would that work?