Just wondering whether it is possible to create 'virtual analog' signals, I am designign a system that uses a tank level sensor (pressure transducer); the component has not yet arrived and I am expecting it in a few weeks.

Is there any way to simulate the signals it would spit out, using some sort of GUI where I can physically control the 'virtual' tank level?

I'm thinking something along the lines of Wonderware's Intouch?

Would appreciate the help! Thanks

  • Don't spend a ton of time on it, but look up "IOC", "mock input", and "Dependency Injection" software concepts and keep the basic ideas in mind as you build out your sketch. it will help later.
    – dandavis
    Mar 13 '17 at 22:37

You don't specify the sensor you're trying to emulate, so we can't tell you exactly how to do it.

The obvious hardware approach would be a potentiometer.

You could also do it in software by writing a function to get the value, and temporarily replacing its implementation with one which generates random values, or reads values from a serial port, or reads them in order from a hard-coded array, or calculates them according to the time, or whatever you want.

  • Thanks for the response! I'm trying to simulate a tank level sensor (so probably a pressure transducer) Mar 14 '17 at 11:13

If you just want different values on an analog port then you could use a potentiometer, or a second Arduino the reads a value from its serial port and sets the value of its analog port connected to your first Arduino. Just remember to have a common ground if you do this.

  • Seconding the potentiometer approach. If you scale the analog result to the output range of the actual component, the rest of your system should never notice the difference when you install the hardware and replace the pot-reading function with a sensor-reading one.
    – JRobert
    Mar 13 '17 at 12:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.