Troubleshooting DS18S20 and Atmega16: Data Pin Not Pulling Low

  • Thread starter digitalblggr
  • Start date
In summary, you are trying to use a digital temperature sensor DS18S20 with an Atmega16. You are 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. However, when you define your pin on PORTD as output and pull it low, the data pin still stay high. You check that your 4.7K is actually 4.7K by measuring it with one end disconnected from the circuit. 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
  • #1
digitalblggr
42
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
  • #2
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.
 
  • #3
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?
 
  • #4
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?
 
  • #5
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.
 
  • #6
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.
 

What is a DS18S20 and Atmega16?

A DS18S20 is a digital temperature sensor that uses a 1-wire interface to communicate with other devices. An Atmega16 is a microcontroller commonly used in electronic projects.

Why is the data pin not pulling low?

There could be several reasons for this issue. It could be due to a faulty connection, incorrect programming, or a damaged sensor. It is important to check all connections and verify the code for any errors.

How can I troubleshoot this problem?

First, check all connections between the DS18S20 and Atmega16. Make sure they are secure and properly soldered. Then, check the code for any errors or incorrect settings. If everything appears to be correct, try using a different DS18S20 sensor to see if the issue persists.

Is there a way to test the DS18S20 and Atmega16 separately?

Yes, you can test the sensor by connecting it to a different microcontroller or using a multimeter to measure the voltage on the data pin. You can also test the microcontroller by using it with a different sensor or running a simple test code.

What if I am still unable to solve the issue?

If you have exhausted all troubleshooting methods and are still unable to solve the issue, it is possible that either the sensor or the microcontroller is damaged. Try replacing one or both components to see if that resolves the issue.

Similar threads

Replies
2
Views
2K
  • Electrical Engineering
Replies
15
Views
3K
  • Electrical Engineering
Replies
6
Views
5K
  • Electrical Engineering
Replies
7
Views
2K
  • Electrical Engineering
Replies
34
Views
4K
Replies
2
Views
2K
Replies
2
Views
3K
  • Programming and Computer Science
Replies
2
Views
2K
  • Electrical Engineering
Replies
4
Views
2K
  • Electrical Engineering
Replies
1
Views
2K
Back
Top