Troubleshooting DS18S20 and Atmega16: Data Pin Not Pulling Low

  • Thread starter Thread starter digitalblggr
  • Start date Start date
AI Thread Summary
The user was troubleshooting a DS18S20 temperature sensor connected to an Atmega16, facing issues with the data pin not pulling low as expected. They confirmed the resistor was correctly rated at 4.7k ohms and checked the voltage levels, suspecting a faulty chip. After suggestions to measure current and verify connections, it was discovered that the user had incorrectly oriented the chip, reversing the Vcc and ground pins. Once corrected, the sensor functioned properly, indicating the importance of verifying pin configurations in circuit setups. The discussion highlights common troubleshooting steps for interfacing sensors with microcontrollers.
digitalblggr
Messages
42
Reaction score
0
Hi,

I am trying to use digital temperature sensor DS18S20(http://datasheets.maxim-ic.com/en/ds/DS18S20.pdf) with Atmega16(http://www.atmel.com/dyn/resources/prod_documents/2466S.pdf). I am using it in a non-parasite mode i.e. Vdd is connected to external power source(Vcc) and Data pin is pulled high to Vcc using 4.7kohm resistor.

Data pin is connected to pin0 on PORTD (PD0) of Atmega16. To reset the DS18S20 I need to pull it low for at least 480 us or more. However , when I define my pin on PORTD as output and pull it low and check it with the scope the data pin still stay high.

Code:

...
DDRD |= (1<<0) //define PD0 as output
PORTD &= ~(1<<0) // pull PD0 low
..

What am I doing wrong? Why is the PDO pin of Atmega not driving the data pin low? Am I not supposed to see data pin go low? Does it happen internally or something?

P.S. I have checked with the scope that I can output high(1) and low(0) on the PORTD, and also tried driving the data pin on DS18S20 with pins of other ports(PORTA etc.) but no success so far.
 
Engineering news on Phys.org
Disconnect the 18S20 from the Atmega.

Check that your 4.7K is actually 4.7K by measuring it with one end disconnected from the circuit.

Disconnect the 4.7 K from the center pin of the 18S20 and measure the voltage at that pin. There shouldn't be any voltage there.

If there is no voltage there, reconnect the 4.7 K and connect that pin to ground via a current meter. The current should be no more than about 1 mA for a 5 volt supply.

If the current is about 1 mA then move on to the Atmega to see why it can't sink 1 mA.
 
Hi,

I checked the resistor to make sure it was 4.7kohms.

So, if Vdd pin is connected to 5v and ground pin to ground , the data pin (center pin) has voltage of ~5v ( after disconnecting the resistor).

Does it mean the chip is bad?
 
It would explain why you can't pull that pin low.

Try putting a 1 K resistor from that pin to ground. If the voltage drops you can estimate how much current is available at this pin.

Don't short that pin to ground in case it is a direct connection to the supply voltage.

Do you have another chip you could try?
 
I have an 18B20, which is a different chip, of course, but it has a similar function and an identical input circuit.

Putting just the ground and plus 5V connections on the correct outer wires, the center wire has zero volts on it but it is a high impedance input because I could get a voltage reading just by bridging the positive line to the center wire with my fingers.

So, I would guess that you either have the chip in the wrong way around or that it is faulty.

The connections for this chip are:
holding it with the wires facing you and the flat part of the case upwards,
ground on the left
data in the middle
plus 5 V on the right.
 
Thank's a lot! Turns out I was using bottom view as top view and messed up Vcc and ground pins. It works fine now. I am surprised the chip didn't blow up.
 
Hey guys. I have a question related to electricity and alternating current. Say an alien fictional society developed electricity, and settled on a standard like 73V AC current at 46 Hz. How would appliances be designed, and what impact would the lower frequency and voltage have on transformers, wiring, TVs, computers, LEDs, motors, and heating, assuming the laws of physics and technology are the same as on Earth?
While I was rolling out a shielded cable, a though came to my mind - what happens to the current flow in the cable if there came a short between the wire and the shield in both ends of the cable? For simplicity, lets assume a 1-wire copper wire wrapped in an aluminum shield. The wire and the shield has the same cross section area. There are insulating material between them, and in both ends there is a short between them. My first thought, the total resistance of the cable would be reduced...
I used to be an HVAC technician. One time I had a service call in which there was no power to the thermostat. The thermostat did not have power because the fuse in the air handler was blown. The fuse in the air handler was blown because there was a low voltage short. The rubber coating on one of the thermostat wires was chewed off by a rodent. The exposed metal in the thermostat wire was touching the metal cabinet of the air handler. This was a low voltage short. This low voltage...
Back
Top