I used for a long time ds18b20 sensors on arduino duemilanove. Now i moved to arduino mega, and the same device i used for a long time in duemilanove know it does not work. Testing different things i discovered a power problem.
Let me explain the scenario: I have 2 ds18b20 sensors in normal power (not parasitic mode). I know they work because i can read them with the normal library and the device connected to the breadboard. The problema appear in the shield i prepared I power the device from the 5V and ground pins. However, the ground line have a optocoupler such as an interrupt what i power with a digital pin. It works great, because i have other sensors connected to the same ground line and they return values.
When i measure to voltage the pins where i connect the cable with the 2 ds18b20 sensors, i have about 4.6V. I think it is not bad, because the sensors works also with lower voltaje, such as say the datasheet. However, if i connect the cable with the sensors, when the circuit is closed (by activating the optocoupler PC817), the voltaje i can read between vcc and gnd pins in the cable to the sensors is only 0.8V.... consecuently, the serial port only shows -127ºC for both sensors.
If i disconnect my shield with the optocoupler and connect the device directly to 5v, gnd and a digital pin, it works...
I tested by connecting a 10uF 5V between vcc and gnd pins of the device... but again 0.8V when the circuit is closed...
So, i suspect that the problem is the way i power the sensors by the optocoupler... i used in this way, because i want to save power since it will be an outdoor device. I will read the sensors (ds18b20, sh15,... an some others) once per hour, so, powering the sensor all the time consume power.
Any idea of what i am doing wrong or how could i solve this issue? Thanks!!