Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PWM vs analog hall effect sensors

Status
Not open for further replies.

HR19

Member
So here's the deal. I want to ultimately build a go-kart with 4 independently controlled motors. I'm thinking about using an Arduino to handle the inputs and then send the outputs to the motor controllers. It seems the most common controllers use an analog, 0-5V hall sensor for the throttle. Inexpensive Arduinos (including the one I have) do not have any analog outputs, only digital, but they do have PWM outputs. For a motor controller expecting a hall sensor analog input, would a PWM input work, or would it likely cause problems? If it wouldn't work well, I read that a low-pass filter can be made with a small capacitor like 10uF, and a 4k resistor and that should effectively convert the PWM signal into an analog one. Would that be likely to work in place of a hall sensor? Has anyone done anything like this?
 
A low pass filter (resistor and capacitor, or two of each) works to convert the PWM to analogue - so if 8 bits is enough?, then careful selection of the values (and probably a buffer opamp) will do the job.

Or you could use an external DAC - a nice example here for you:

 
Or you could use an external DAC - a nice example here for you:

A DAC seems like a lot more work, programming and stuff.

A low pass filter (resistor and capacitor, or two of each) works to convert the PWM to analogue - so if 8 bits is enough?, then careful selection of the values (and probably a buffer opamp) will do the job.

What do you mean "careful selection?"
 
It needs to smooth the PWM to a decent DC, but still respond quickly enough for speed changes.

Here you go:

**broken link removed**
More to it than I realized. How do I decide what's the optimal solution? I can see that lowering the resistor value or capacitor value will decrease the settling time (which I interpret as effective response time), but it also increases the ripple. You suggested even two LPF in parallel, right? How would that affect it? Wouldn't that be equivalent to ½ the resistor value and 2x the capacitor value?

Maybe a DAC wouldn't be all that much extra programming. The one you suggested has 4 times the resolution of the Arduino Uno, so couldn't I just multiply the Arduino output by 4 to get a darn-close approximation?
 
More to it than I realized. How do I decide what's the optimal solution? I can see that lowering the resistor value or capacitor value will decrease the settling time (which I interpret as effective response time), but it also increases the ripple. You suggested even two LPF in parallel, right? How would that affect it? Wouldn't that be equivalent to ½ the resistor value and 2x the capacitor value?

Not in parallel, in series - so filtering it twice.

Maybe a DAC wouldn't be all that much extra programming. The one you suggested has 4 times the resolution of the Arduino Uno, so couldn't I just multiply the Arduino output by 4 to get a darn-close approximation?

??????

How can you multiply it? - there's only 256 possible steps, if you multiply the value by four you reduce the number of steps by four, to only 64.
 
Not in parallel, in series - so filtering it twice.



??????

How can you multiply it? - there's only 256 possible steps, if you multiply the value by four you reduce the number of steps by four, to only 64.
I understood that the PWM was 10bit output, maxing at 1023, and the DAC was 12bit maxing at 4095. So 0>0, 1>4, 2>8...1023>4092. So basically translating addresses. I wouldn't be losing resolution, I'd be translating to make sure my output is still 5v instead of 1.25V. but if the PWM output resolution is only 8 bits, I'd need to multiply by 16.

EDIT: I reread the post you shared and he used the I2C ports to communicate to the DAC, he didn't use a PWM output, which enables the full 10-bit read resolution to be translated to the 12-bit DAC/
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top