Hey guys,
I am using a Particle Photon (microcontroller w/ cloud connectivity) to communicate with a DS18B20 temperature sensor via the 1-wire bus. Below is how I have it wired up:
From the research I have done, it seems to be preferred that you use 5 volts to power the sensor, then a pullup to 3.3 volts (assuming a 3.3 volt microcontroller). This allows for more reliable data transmission with longer cables. I am using stereo audio jacks for the connectors, and because of this I am using a 220 ohm resistor for protection against momentary shorts while inserting the plug. Here is what the sensor looks like:
I am pulling sensor data from the sensor approximately every 4 seconds, and I get a LOT of errors throughout the day. There are periods of times where it can go several minutes before getting an error free value. Similarly, it can also go several hours and not have any errors, so its very intermittent. The errors range from “no sensors found” to CRC errors.
I wanted to point out that I have had these intermittent errors even with the wires soldered directly to the board, so because of this I do not believe the problem to be the audio jack. I have also tried multiple sensor combinations with multiple boards and I experience the same thing, so I can only assume its my design.
In an effort to try and diagnose the problem, I busted out the Rigol DS2202a oscilloscope to try and take some readings. I am very new to using oscilloscopes so bare with me.
I first took a look at the data line right next to the microcontroller, and this is what I see:
So I am thinking this should be acceptable? I don’t see rounded off raising edges, but I do notice the falling edge can sometimes droop/spike about 80mV below 0 volts… which I don’t think would be a big deal? I also don’t see too much noise here.
I then took a look at the 5V power at the jack:
I noticed that every time the microcontroller would pull data from the sensor, that I would see this voltage drop/spike. It looked pretty significant since it drops down to 3.5 volts momentarily. I put a 0.1uF ceramic capacitor at this location (between 5v power and ground) and it now is flat:
This alone did not fix the problem, I still noticed it was intermittent. I am now trying to replace the 4.7K pullup resistor to a 2.2K pullup to see if that helps, but it feels like I am missing something?
What do you guys think might be the problem? Thanks and any help is greatly appreciated!