I have a couple Dallas DS 18B20 sensors that would like to use in a little project.
The problem is that i can only use analog sensors!
Therefore i was wondering if it is possible to connect a 2-3 sensors to my arduino mega
and the arduino mega gives me 2-3 analog outputs that represent the sensors (output: 4-20mA, 0-5v, 2-10v or 0-10v)?
I have been reading alot about analogwrite (analogWrite() - Arduino Reference), pwm (Arduino Playground - TimerPWMCheatsheet) but cant really figure out how to do this - if it even is possible...
- if it even is possible...
It probably isn't and, even if it is, that must surely be a pointless exercise. One can only guess at the project so, if you really can "only use analog sensors" then you might try using analogue sensors but, since you already have a couple of DS18B20s, it probably makes far more sense to change the project and use them in the manner intended.
Thanks for the reply, Nick_Pyner!
I know it makes more sense to change the project, however its not a option to wait 6-8 weeks for new sensors from sparkfun or ebay. And its not possible to change the project so i can use the digital sensors. The reason for this is that the plc that is required for this projects only have analog inputs.
Therefore i was really hoping that analogWrite could be used for converting digital sensors to analog so that the plc could interpret it.
If there is anyone that can help me with a solution, i would be happy to give a couple of bucks as a thanks!
It seems remarkable that you need to wait months for small cheap electronic components. It might pay you to look for alternate sources.
There are Arduino models that include DAC functionality and it’s possible to buy external DACs or kludge your own using an electronic filter, but if you can’t obtain hardware easily then these approaches may not be any better for you.
i live in Norway, and the customs is really slow, i also tend to choose the free shipping option (sloooooooow). So partly its my own fault. Its not tempting to use 100$ in express shipping on items worth 10 bucks.
However, if buying analog sensors is my only option...
I must say I have no experience with it, but apparently you can create an analog signal using PWM (analogWrite)
All it requires is a capacitor and resistor per output channel.