Author Topic: Analog voltage to PWM converter  (Read 10258 times)

0 Members and 2 Guests are viewing this topic.

Offline LeopoldoTopic starter

  • Contributor
  • Posts: 44
Analog voltage to PWM converter
« on: January 08, 2015, 07:04:18 pm »
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!!! :scared:
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22014
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Analog voltage to PWM converter
« Reply #1 on: January 08, 2015, 07:57:50 pm »
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
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Analog voltage to PWM converter
« Reply #2 on: January 08, 2015, 08:14:13 pm »
Quote
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

=555.

Infinite number of resolutions.
================================
https://dannyelectronics.wordpress.com/
 

Offline LeopoldoTopic starter

  • Contributor
  • Posts: 44
Re: Analog voltage to PWM converter
« Reply #3 on: January 08, 2015, 08:38:23 pm »
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
 

Offline jlmoon

  • Supporter
  • ****
  • Posts: 609
  • Country: us
  • If you fail the first time, keep trying!
Re: Analog voltage to PWM converter
« Reply #4 on: January 08, 2015, 08:53:15 pm »
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

Speaking 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.

Recharged Volt-Nut
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7611
  • Country: nl
  • Current job: ATEX product design
Re: Analog voltage to PWM converter
« Reply #5 on: January 08, 2015, 09:32:10 pm »
You need a Delta-sigma modulator, if I understand correctly. For example:
"The ADS1201 is a single channel, second-order, CMOS
analog modulator designed for high resolution conversions
from dc to 1000Hz. The output of the converter (MOUT)
provides a stream of digital ones and zeros. The time
average of this serial output is proportional to the analog
input voltage."
They say up to 20 bits.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Analog voltage to PWM converter
« Reply #6 on: January 08, 2015, 09:39:54 pm »
Quote
since I've chosen an ESC that has an extremely high precision of 32bit

What 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.
================================
https://dannyelectronics.wordpress.com/
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1309
  • Country: gb
    • bitdynamics
Re: Analog voltage to PWM converter
« Reply #7 on: January 08, 2015, 09:45:02 pm »
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


lol^^  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)
 

Offline LeopoldoTopic starter

  • Contributor
  • Posts: 44
Re: Analog voltage to PWM converter
« Reply #8 on: January 08, 2015, 09:58:15 pm »
So,what do you all suggest? How can I solve myproblem?
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Analog voltage to PWM converter
« Reply #9 on: January 08, 2015, 10:02:34 pm »
Quote
How can I solve myproblem?

You 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.
================================
https://dannyelectronics.wordpress.com/
 

Offline KM4FER

  • Regular Contributor
  • *
  • Posts: 81
  • Country: us
Re: Analog voltage to PWM converter
« Reply #10 on: January 08, 2015, 10:14:49 pm »

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 bits

So, now what resolution is obtainable in your application using this chip?

It pays to read the details, not the marketing hype.
 

Offline w2aew

  • Super Contributor
  • ***
  • Posts: 1780
  • Country: us
  • I usTa cuDnt speL enjinere, noW I aR wuN
    • My YouTube Channel
Re: Analog voltage to PWM converter
« Reply #11 on: January 08, 2015, 10:16:32 pm »
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

The 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...
YouTube channel: https://www.youtube.com/w2aew
FAE for Tektronix
Technical Coordinator for the ARRL Northern NJ Section
 

Offline LeopoldoTopic starter

  • Contributor
  • Posts: 44
Re: Analog voltage to PWM converter
« Reply #12 on: January 08, 2015, 10:30:17 pm »
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?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf