Jump to content

Recommended Posts

Posted

First, thanks to everyone here who made this great os.

 

I am trying to read a DS18B20 temperature sensor on my orange pi pc, but I can't get it to work. I hooked up ground and 3.3v to the sensor, the data line I placed it on gpio 20/ physical pin 37 as other posts suggest but it is not reading it.

 

I edited /etc/modules-load.d/modules.conf

and modified it to:

8189es
gpio_sunxi
w1-sunxi
w1-gpio
w1-therm
#gc2035

it loads up in dmesg

....
[    6.030874] W1_SUNXI: Added w1-gpio on GPIO-20
[    6.039203] Driver for 1-wire Dallas network protocol.
....

but it is not visible in /sys/bus/w1/devices/

 

I tried other gpio sensors, currently I can read from an i2c sensor bmp180 and turn on/off lights with a 315/433mhz transmit module.

 

in the /boot/bin/orangepipc.bin (using bin2fex) I can see the 1wire sensor is set correctly to pin 20, the sensor has its own pull-up resistor

[w1_para]
w1_used = 1
gpio = 20

I am running armbian Linux orange 3.4.112-sun8i #8 SMP PREEMPT Tue May 31 19:00:17 CEST 2016 armv7l GNU/Linux

 

I also plan on adding an RTC.

 

Thanks for any help.

Posted

it loads up in dmesg

....
[    6.030874] W1_SUNXI: Added w1-gpio on GPIO-20
[    6.039203] Driver for 1-wire Dallas network protocol.
....

but it is not visible in /sys/bus/w1/devices/

 

Are these lines followed by

W1_GPIO: added w1 master on GPIO20

or not? It would also help if you could provide the output of these 2 commands:

lsmod
sudo armbianmonitor -u
Posted

I don't know if it is related to legacy (I would have to reinstall it to check), but on Mainline, there is no such w1-sunxi driver, only w1-gpio/w1-therm are required.

Maybe you can try to comment out the w1-sunxi in /etc/modules-load.d/modules.conf and try again.

Posted

you do not need to uncomment the gpio_sunxi line - just the lines beginning with w1-

 

I have the following line in my config scripts and that's all I need:

 

sed -i 's/#w1/w1/g' /etc/modules
 
followed by a reboot....
Posted

Thanks for the info, but its still not working.

But did you put pullup resistor (4.7kOm) between 3.3v and data line?  :rolleyes:

Yes, it has a 4.7k resistor between data and power, Its working on a Rpi and on an arduino so the sensor works, tried 3 others I have, they are working fine

 

you do not need to uncomment the gpio_sunxi line - just the lines beginning with w1-

 

I don't know if it is related to legacy (I would have to reinstall it to check), but on Mainline, there is no such w1-sunxi driver, only w1-gpio/w1-therm are required.

Maybe you can try to comment out the w1-sunxi in /etc/modules-load.d/modules.conf and try again.

Re-commented the gpio_sunxi and left only the following:

8189es
w1-sunxi
w1-gpio
w1-therm

followed by a restart, still no sensor

if I comment out w1-sunxi, then nothing shows up not even w1_bus_master1 in /sys/bus/w1/devices/

Are these lines followed by

W1_GPIO: added w1 master on GPIO20

or not? It would also help if you could provide the output of these 2 commands:

lsmod
sudo armbianmonitor -u

the line "W1_GPIO: added w1 master on GPIO20" does not show up on dmesg

 

lsmod

Module                  Size  Used by
w1_therm                2498  0
w1_gpio                 1402  0
wire                   18294  2 w1_gpio,w1_therm
w1_sunxi                1451  0
8189es               1076034  0

If I can't get it to work then I will purchase another BMP180 or another i2c temp sensor,

I do have an unused DHT11 sensor, going to see if I can get that going.

 

I need temperature to know when to turn on/off a cooler connected to a 433mhz remote, that is one of the project I have going, also most of my lights are wireless so I want a fully automated system :)

Posted

Hello!

Module                  Size  Used by
w1_therm                3018  0
w1_gpio                 1402  0
wire                   18326  2 w1_gpio,w1_therm
w1_sunxi                1451  0
gpio_sunxi              8269  0

ds18b20 work normal.

 

if you (as you say) have pullup 4.7 resistor, you can try applying 5v. on power leg of ds18b20, some times it is increase stability...

But legasy driver of ds18b20 is not perfect.

I made changes for it which increase stability with normal and parasitic power and now i can change resolution from 9-12 bit which greatly speed up time of conversion!

 

If you interesting i can send you driver files for test.  B)

 

But I still think that there are problems with the connection...

Posted

Tried on 5v and nothing, it could also be another thing I installed that is interfering with 1wire,

I installed Wiring Orange Pi on it, https://github.com/zhaolei/WiringOPand could be causing trouble :unsure:

either way the i2c bmp180 is working at getting the temperature (removed from my rpi to test on orange).

All ready ordered another BMP180 since it is cheaper than an LM75A ;)

 

Next up is getting the IR Receiver sensor started up, and setting it up with an RTC DS3231

Posted

the line "W1_GPIO: added w1 master on GPIO20" does not show up on dmesg

 

So it's a software issue and I wonder why you didn't follow the advice to show us the output of 'armbianmonitor -u' (we invented this for the only reason to be able to diagnose problems properly and being able to help)

Posted

So it's a software issue and I wonder why you didn't follow the advice to show us the output of 'armbianmonitor -u' (we invented this for the only reason to be able to diagnose problems properly and being able to help)

I did run sudo armbianmonitor -u

but I looked at the log from the site and my MAC / Serial # and other stuff was totally visible, so I decided not to post it.

although I have root ssh disabled and Two Factor Authentication on it, I am a little paranoid :) especially for anything that connects to the outside world.

Posted

Tried on 5v and nothing, it could also be another thing I installed that is interfering with 1wire,

I installed Wiring Orange Pi on it, https://github.com/zhaolei/WiringOPand could be causing trouble :unsure:

either way the i2c bmp180 is working at getting the temperature (removed from my rpi to test on orange).

All ready ordered another BMP180 since it is cheaper than an LM75A ;)

 

Next up is getting the IR Receiver sensor started up, and setting it up with an RTC DS3231

I have the same Wiring Orange Pi you referenced on my DS18b20 application and have no compatibility issues.  I did however, have a lot of difficulty when migrating my application from the Raspberry Pi, but in the end it was the result of stupid mistakes on my part.  My pin out is as follows:

 

Data -> pin 37

3.3v -> pin 17

GND -> pin 9

 

4.7k resistor tied to data and 3.3v leads.  Uncomment the lines I mentioned earlier, and everything is golden.

 

Also, make certain that you are correctly referencing pin 1!!!  The 40 pin header is oriented 180 degrees different than the Raspberry Pi.  One way to know that you've made that mistake is that your probe will probably get very hot as your data pin that was supposed to be on pin 37 is now on pin 4 and is now drawing 5V!

Posted

The 40 pin header is oriented 180 degrees different than the Raspberry Pi.

 

Not on every board so ALWAYS check twice: as far as I know the GPIO header is only rotated on OPi One/Lite and Plus 2E but not on the other boards (and any other board out there sharing RPi's 40 pin GPIO header)

Posted

Not on every board so ALWAYS check twice: as far as I know the GPIO header is only rotated on OPi One/Lite and Plus 2E but not on the other boards (and any other board out there sharing RPi's 40 pin GPIO header)

Point taken - just wanted to point out the importance of validating the pin orientation.  

Posted

1-Wire working now :)

admin@orangepipc:~$ ls /sys/bus/w1/devices
28-000003def4c0  w1_bus_master1

admin@orangepipc:/sys/bus/w1/devices/28-000003def4c0$ cat w1_slave
c0 01 4b 45 1f ff 10 10 1f : crc=1f YES
c0 01 4b 45 1f ff 10 10 1f t=28000

Temperature reading is 28*C

 

Modules file:

8189es
#gpio_sunxi
w1-sunxi
w1-gpio
w1-therm
#gc2035

This is the pin-out I used, *all physical pins

Data -> pin 37

3.3v -> pin 1

GND -> pin 39

 

thanks everyone.

Posted

1-Wire working now :)

 

But what was the culprit? So others that might run into the same problem already have an advice where to look for when it's failing?

 

Also it would be great to post (obfuscated) dmesg output from now and then to be able to compare. Please also keep in mind that we want to improve our documentation a lot so stuff isn't scattered through forum posts so every relevant bit of information that can be used for this has its real value. :)

Posted

I am trying to get an Orange Pi Lite to work with a DS18b20 1-wire temperature sensor.  I have resolved that I am using the correct pins on the header and I can toggle an LED on one of the GPIO pins with "gpio write".

 

I have uncommented the lines mentioned in this post (above) in modules.conf.

 

When I run dmesg I see:

 W1-SUNXI: Added w1-gpio on GPIO-20

   and

 Driver for 1-wire Dallas Network protocol.

 

I do NOT see this line in dmesg:

 W1_GPIO: added w1 master on GPIO20

 

Another point of confusion for me:  When I run "gpio readall" I do NOT see any pin called GPIO20.

 

I am running Armbian 3.4.112-sun8i

 

I have looked at some Armbian forum posts talking about modifying the "lime.bin" file using bin2fex and fex2bin but I have not made those changes.

 

Any help would be appreciated.

 

Thanks ... Mark

Posted

Hi all,
I have similar issue with DS18B20 on Orange Pi Zero (Armbian_5.24_Orangepizero_Debian_jessie_3.4.113)

I connect sensor (data PA10(pin 26), 3,3V (pin 1), GND (pin 6),
Enable /etc/modules (w1-sunxi, w1-gpio, w1-therm),
and I can see SN of sensor.

But the sensor returns the nonsensical values. All returns values are same.

 

 

root@orangepizero:/home/pi# cat /sys/bus/w1/devices/28-0416742796ff/w1_slave
ff ff ff ff ff ff ff ff ff : crc=c9 NO
00 00 00 00 00 00 00 00 00 t=-62

 

 

Have you some idea to solve this?

 

Many thanks Radim.

Posted

ff ff ff ff ff ff ff ff ff : crc=c9 NO

 

 

Hi Radim -

 

Your CRC check fails as indicated by the word NO.  Your code should first check to make sure it says YES before attempting to read the value.  In my experience, any one of the following is likely to produce a CRC failure:

1. faulty wiring connection (loose wire, wrong terminals, etc)

2. wrong/bad resistor

3. bad/faulty DS18B20 chip.  Can you reproduce with a different one?

 

Hope that helps.

Posted

Hi all,
I have similar issue with DS18B20 on Orange Pi Zero (Armbian_5.24_Orangepizero_Debian_jessie_3.4.113)

I connect sensor (data PA10(pin 26), 3,3V (pin 17), GND (pin 25),
Enable /etc/modules (w1-sunxi, w1-gpio, w1-therm),
and I can see SN of sensor after reboot but CRC check fails as indicated by the word NO
 

I change the long wired sensor for a new TO92 DS18B20, same issue.

 

 

What is positive is the fact that

With the first sensor, I tried dozen of times.

 

The correct return happened two times only.

 

An other point is the fact that, immediately after a reboot, I can see the sensor with a NO CRC. If I check every few seconds, the return is the same. If I wait 30 second the 28-03168815dfff directory disapears! It requires a reboot the come back.

Posted

data needs to go on GPIO 26, which is physical pin 37.  Additionally, need to make sure you have a 4.7k resistor tied to your data and 3.3v legs.

Posted

Hello Dwood
 
Data seems to be pin 26 on the 26 pin connector of the Orange Pi Zero
 
 dmesg
 
11.416566] W1_SUNXI: Added w1-gpio on GPIO-10
[   11.435079] Driver for 1-wire Dallas network protocol.
[   11.486760] w1_master_driver w1_bus_master1: Family 28 for 28.03168815dfff.23 is not registered.

 

and the fact that two single times the right result was returned confirms this.

 

therefore I never succeded to reproduce this right behavior.

 

I have a 4k7 resistor (I tried 6k8 and 3k2 also).

 

Thanks in advance for help.

 

Don't be shamed for my next silence,

Posted

@ Radim

Thanks to have sketched an explanation.

This could explained the two cases when it worked correctly on my Orange Pi Zero.

Posted

@dran, I've several kind of boards, but my W1 is currently on my OPiPlus2E.

But I don't see why it would be different on my OPiZero, other than using different GPIO pin.

(I will probably try it eventually)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines