I need to monitor pressure via a transducer (0.5v - 4.5v ratiometric), interpret the data in the Arduino, and control a pneumatic solenoid in a matter that is dependent on the data gathered from the transducer.
A problem I foresee with just running an analog transducer is picking a lot of noise, as I could have a fairly long run of cable (50ft+).
I had an idea...
Build a circuit to generate PWM. Place it right at the transducer, that way I'm only transferring digital information over the long length of cable, and program Arduino for PWM interpretation.
Is this possible? I know Arduino has PWM output, but can I program to read the PWM "input"? I think this would make for much more reliable data transfer, but couldn't find on web where anyone had done it.
Yes it is possible. But it might be simpler to generate FM rather then PWM. There are many, many V/F converter ( of VCO) chips. Note they have to be "temparature compensated", if you need precise values.
There is a library for decoding the (FM-) pulse at the Arduino. You have to find out the frequency range it works well in....
A most simple alternative for decoding FM is a lowpass filter (= cap+resistor) in front of an analogue input. THis is how radio receivers work
If you're going to go through all this bother, why not place a small A/D circuit right at the transducer and have the Arduino communicate with it digitally to acquire the data.
If you're going to send PWM you may as well send an asynch char or word with the value. That way there's no analogue-style issues with noise etc. Yes PWM is "digital" but timing a PWM signal is effectively another A/D conversion.
As ruggedcircuits says you should measure at the "coal face".
Have you ever asked yourself how a low pass filter works
You will need a constant amplitude, which will need a buffer, but you might need that anyway with PMW also if it has no TTL level.
The response of the filter is not linear, and it will need some software effort. Funnily this is one of the few aplications where you will NOT need a steep filter
Of course a more advanced FM decoding is possible.. It might even be fun to use a standard FM receiver chip, maybe out of some give-away gimmick..However there should be filters in it that will not allow modulations of < 20Hz to pass, and that will be a showstopper....
The simplest solution is of course counting edges....