jessismerkovitz
Posts: 6
Joined: Mon May 16, 2016 5:24 pm
Location: South Africa

cat w1_slave No File or Directory

Tue May 17, 2016 5:32 pm

Hello.

I am in the process of getting my temperature sensor all set up and working on my Pi etc.
I am using DS18B20 Temp Sensor#374

So far I am only at the code set up for now.
Iv'e executed the following code:

First adding in

Code: Select all

dtoverlay=w1-gpio
Into

Code: Select all

sudo nano /boot/config.txt
then I have executed:

Code: Select all

sudo modprobe w1-gpio
sudo modprobe w1-therm
cd /sys/bus/w1/devices
ls
cd 28-xxxx (changed ' xxxx'  to match what serial number pops up eg. 28-000003cee4ca)
Then successfully I get into the cd...

Now When executing

Code: Select all

cat w1_slave
I receive back:
No such file or directory...
(That error)

Can anyone guide me in what I am doing wrong or anything?
Jess Smerkovitz

svedr
Posts: 16
Joined: Tue May 17, 2016 4:08 pm

Re: cat w1_slave No File or Directory

Wed May 18, 2016 5:21 am

Run command from terminal
Sudo modprobe w1-gpio
sudo modprobe w1-therm

Run "cat w1_slave" inside folder /sys/bus/w1/devices/SERIAL OF PROBE

jessismerkovitz
Posts: 6
Joined: Mon May 16, 2016 5:24 pm
Location: South Africa

Re: cat w1_slave No File or Directory

Wed May 18, 2016 5:30 am

Thanks.

When you say serial of probe you mean the actual serial number right ?

Now I can't even get the serial number when I run

Code: Select all

ls[/code
Once I'm in those cds (/sys/...)

But before, when I was receiving a serial number and I was in all those cds and running the cat .... Code it would give me the no file or directory error
Jess Smerkovitz

User avatar
rpdom
Posts: 20526
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: cat w1_slave No File or Directory

Wed May 18, 2016 5:42 am

You don't need the modprobe commands, just the "dtoverlay=w1-gpio" line in /boot/config.txt.

If you don't see the probes in /sys/bus/w1/devices, then it is probably that they aren't connected correctly.

Can you show a picture or diagram of your wiring?

You should get something like this:

Code: Select all

pi@raspi2 ~ $ cd /sys/bus/w1/devices
pi@raspi2 /sys/bus/w1/devices $ ls
28-00044a1f53ff  28-00044c7a5aff  w1_bus_master1
pi@raspi2 /sys/bus/w1/devices $ cd 28-00044a1f53ff
pi@raspi2 /sys/bus/w1/devices/28-00044a1f53ff $ cat w1_slave 
25 01 55 00 7f ff 0c 0c 08 : crc=08 YES
25 01 55 00 7f ff 0c 0c 08 t=18312
pi@raspi2 /sys/bus/w1/devices/28-00044a1f53ff $ 


muralidharanv
Posts: 1
Joined: Tue Nov 27, 2018 1:28 pm

Re: cat w1_slave No File or Directory

Sun Apr 28, 2019 4:16 pm

Dear All,

i have followed below commands but getting error "cat w1_slave No File or Directory".

Board:
1. raspberry pi 3 B+
2. DS18B20 Water Proof Temperature Sensor Probe
3.1 x 4.7k Ω resistor

1. sudo nano /boot/config.txt
2. dtoverlay=w1-gpio
3. sudo reboot
4. sudo modprobe w1-gpio
sudo modprobe w1-therm
5. cd /sys/bus/w1/devices
6. pi@raspberrypi:/sys/bus/w1/devices $ ls
00-200000000000 00-600000000000 00-a00000000000 w1_bus_master1
7. pi@raspberrypi:/sys/bus/w1/devices $ cd 00-100000000000
pi@raspberrypi:/sys/bus/w1/devices/00-100000000000 $ cat w1_slave
cat: w1_slave: No such file or directory

Kindly help me resolve the issue.

Regards,
Muralidharan.V
muralidharan1307@gmail.com

pcmanbob
Posts: 13151
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: cat w1_slave No File or Directory

Mon Apr 29, 2019 7:24 am

Your sensor is not being found that's why you only have devices starting with 00 , are you sure you have it connected up correctly ?

Post some pictures of you setup so we can check for you.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
rpdom
Posts: 20526
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: cat w1_slave No File or Directory

Mon Apr 29, 2019 7:53 am

muralidharanv wrote:
Sun Apr 28, 2019 4:16 pm
2. dtoverlay=w1-gpio

4. sudo modprobe w1-gpio
sudo modprobe w1-therm
By following step 2 (the recommended way), you don't need step 4. The modules (drivers) will be loaded automatically.

That isn't the cause of your problems, but is just an unnecessary step.
Unreadable squiggle

pcmanbob
Posts: 13151
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: cat w1_slave No File or Directory

Mon Apr 29, 2019 3:39 pm

Also make sure you are connecting the data wire to the correct gpio pin ( gpio4, board pin 7 is the default ).
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

arslankhawar112
Posts: 5
Joined: Tue Dec 24, 2019 7:03 pm

Re: cat w1_slave No File or Directory

Tue Dec 24, 2019 7:12 pm

/sys/bus/w1/devices $ ls
00-080000000000 00-700000000000 00-f00000000000 w1_bus_master1

these are the directories showing .
and when i write cat w1_slave
No such file or directory error is showing .

kindly any one help me it will be a big help for me in my finak year project.!
Thanks in advance ....!!!!

pcmanbob
Posts: 13151
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: cat w1_slave No File or Directory

Tue Dec 24, 2019 9:13 pm

Hi.

Check your DS18B20 sensors are connected correctly , the results you are seeing suggest your sensors are not connected correctly.

there are lots of examples on line

but here is the basics

Image
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

arslankhawar112
Posts: 5
Joined: Tue Dec 24, 2019 7:03 pm

Re: cat w1_slave No File or Directory

Wed Dec 25, 2019 11:03 am

Thanks for replying...!!!

I have followed the steps and also change the sensor but again directories are not starting with 28-xxxx.
these are the direcetories showing
00-380000000000 00-b80000000000 w1_bus_master1


and here is the code that i'm using

Code: Select all

import os
import glob
import time
 
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
 
base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')[0]
device_file = device_folder + '/w1_slave'
 
def read_temp_raw():
    f = open(device_file, 'r')
    lines = f.readlines()
    f.close()
    return lines
 
def read_temp():
    lines = read_temp_raw()
    while lines[0].strip()[-3:] != 'YES':
        time.sleep(0.2)
        lines = read_temp_raw()
    equals_pos = lines[1].find('t=')
    if equals_pos != -1:
        temp_string = lines[1][equals_pos+2:]
        temp_c = float(temp_string) / 1000.0
        temp_f = temp_c * 9.0 / 5.0 + 32.0
        return temp_c, temp_f
	
while True:
	print(read_temp())	
	time.sleep(1)
(mod edit to add code tags)

User avatar
rpdom
Posts: 20526
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: cat w1_slave No File or Directory

Wed Dec 25, 2019 12:42 pm

Ok, please add Code tags around your code to make it more readable (there's a code button at the top of the post edit screen to do that for you).

You shouldn't need the two "modprobe" lines if you have enabled the 1-wire interface in the configuration program.

If you get entries starting with "00-" it almost certainly means your sensors are not wired up correctly. Double check your wiring.
Unreadable squiggle

pcmanbob
Posts: 13151
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: cat w1_slave No File or Directory

Wed Dec 25, 2019 3:42 pm

Please post pictures of your wiring making sure to show both the connections to the sensors and the pi, then we might be able to spot you problem.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

arslankhawar112
Posts: 5
Joined: Tue Dec 24, 2019 7:03 pm

Re: cat w1_slave No File or Directory

Wed Dec 25, 2019 5:40 pm

here is the sensor i' using
Attachments
22.jpg
here is the sensor
22.jpg (245.91 KiB) Viewed 6212 times

arslankhawar112
Posts: 5
Joined: Tue Dec 24, 2019 7:03 pm

Re: cat w1_slave No File or Directory

Wed Dec 25, 2019 5:48 pm

And using pin 7 of pi zero w

and 5v is given to sensor from power supply
Attachments
aa.jpg
aa.jpg (171.46 KiB) Viewed 6207 times

pcmanbob
Posts: 13151
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: cat w1_slave No File or Directory

Wed Dec 25, 2019 7:18 pm

Did you not look at the diagram I posted, you should be powering the sensor from the 3.3V pin as you are using the same supply for the pull up, connecting 5V to the pi gpio pins can and will damage your pi.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

arslankhawar112
Posts: 5
Joined: Tue Dec 24, 2019 7:03 pm

Re: cat w1_slave No File or Directory

Wed Dec 25, 2019 7:30 pm

Thnaks for reply

and follow the steps you ask me to but the error is still same . :'(

Regards !
Arslan

pcmanbob
Posts: 13151
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: cat w1_slave No File or Directory

Wed Dec 25, 2019 9:22 pm

Looking at you pictures I only see one cable connected to the pi

Can you post a picture or pictures showing a bit more of the pi / sensors so we can see a bit more of your wiring.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Return to “Beginners”