I'm new to arduino and i'm trying to connect a ds18b20 temperature sensor to my arduino. My program is exactly the same as this video.
I'm using a Mega 2560 and I have the long waterproof temperature sensor cable. I've connected the black and the red wire's of the temperature sensor to ground of the arduino and the yellow wire to a digital pin 8 and also a pull up 4.7k resistor that connects to 5v of the arduino.
The serial monitor keeps showing me the temperature as -127. Weird thing is, while the program is running if i remove the temperature sensor it still shows me the value, seems its not detecting the sensor. Please help It's for my university project.
Deep_Ak:
I've connected the black and the red wire's of the temperature sensor to ground of the arduino and the yellow wire to a digital pin 8 and also a pull up 4.7k resistor that connects to 5v of the arduino.
If you have really connected it that way, go back and fix it. The 127 tells you it is a bad, or no, connection. You have probably not done any damage.
I’ve connected the black and the red wire’s of the temperature sensor to ground of the arduino and the yellow wire to a digital pin 8 and also a pull up 4.7k resistor that connects to 5v of the arduino.
Actually, I did use the red wire as 5v before and the yellow as ground and it didn’t work either and had to google the right pin.
Clearly you miswired it.
(though neither of the ways you wired it is necessarily damaging) Damaging would be like reversing the red and black wires when you connect it.
see attached
well, there maybe something wrong with your module, you can have a look at the temperature sensor, which it's used to make a project for scientific care for the plant in office to collect the temperature data of the environment. Maybe it can be your help.
Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html . Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?