Troubleshooting DS18S20 and Atmega16: Data Pin Not Pulling Low

  • Thread starter Thread starter digitalblggr
  • Start date Start date
Click For Summary
SUMMARY

The forum discussion addresses troubleshooting issues with the DS18S20 digital temperature sensor connected to an Atmega16 microcontroller. The user initially faced problems with the data pin not pulling low despite correct code implementation. Key insights include verifying the resistor value (4.7k ohm), ensuring proper pin orientation, and checking for voltage levels at the data pin. Ultimately, the issue was resolved by correcting the orientation of the DS18S20, which had been mistakenly connected with reversed power and ground pins.

PREREQUISITES
  • Understanding of Atmega16 microcontroller pin configuration
  • Familiarity with the DS18S20 temperature sensor specifications
  • Basic knowledge of resistor values and circuit measurement techniques
  • Experience with digital signal troubleshooting using an oscilloscope
NEXT STEPS
  • Learn about the DS18B20 temperature sensor and its differences from the DS18S20
  • Research proper wiring techniques for 1-Wire devices like the DS18S20
  • Explore troubleshooting methods for microcontroller GPIO issues
  • Study the Atmega16 datasheet for detailed electrical characteristics and pin functionalities
USEFUL FOR

This discussion is beneficial for electronics hobbyists, embedded systems developers, and anyone working with temperature sensors and microcontrollers, particularly those using the Atmega16 and DS18S20 components.

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.
 

Similar threads

  • · Replies 15 ·
Replies
15
Views
4K
Replies
2
Views
3K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
2
Views
3K
Replies
2
Views
2K
  • · Replies 34 ·
2
Replies
34
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K