I have a question regarding PWM to Analog voltage conversion.
Usually one would use a simple RC Filter to convert PWM to 0-5 voltage, but that introduces some voltage ripple.
The situation is that an Arduino is going to be a sensor voltage dataloger in car, ie getting sensor voltages on one side and outputting them on the other side and logging them to the memory.
With reading the sensor voltage everything is ok, they're 0-5v input and i just analogRead() them.
But when i want to output the voltage to the ECU i cant just simply do analogWrite() since it will output in PWM, where as i need 0-5 analog voltage. I'm looking for some transistor that would accept PWM signal and output 0-5 analog voltage without any ripple, just like a car sensor.
So what would be the best transistor to use?
russellz:
A transistor will not get rid of the ripple.
How much ripple can your ECU stand?
How quickly must your analogue output respond to changes?
If you know the answers you should be able to design a suitable filter.
Russell.
I dont think the ECU can stand any ripple..
Output should be as fast as on the input side, ie almost no respond time.
Im good at programming but not so good at designing circuits..
Basicly i just need the arduino to be able to output 0-5v analog voltage without any ripple, just like a normal car sensor would. Any solutions are welcome
You could go either way. The digipot I posted the datasheet for is less than a $1. There are 10-bit digipots as well. A filter can probably get you the response you need as well.
The Teensy 3.1, under $20, has a 12 bit DAC that even has its own voltage reference, so the output won't change just because of ripple on the power supply.
Set the PWM frequency to maximum - with 8 bit PWM and 16MHz clock
you can go to 62.5kHz (using fast mode) - this means finding a suitable library
or tinkering with the timer registers directly.
Use an R-C-R-C 2-pole filter to get better low pass filtering. With a cutoff of
1kHz or lower you'd get perfectly good output.
KeNNy_aKa_MaX:
The situation is that an Arduino is going to be a sensor voltage dataloger in car, ie getting sensor voltages on one side and outputting them on the other side and logging them to the memory.
If your ultimate goal is to log the digital sensor data to memory why would you want to use PWM as an intermediate step?
Do you really need to have the signal going into the arduino and then to the ecu ?
You should be able to have both the arduino and the ecu using the original signal, attaching the original signal to the analog input should not interfere with the ecu's ability to read it.