I have been looking at 1wire for humidity and temperature monitors. I don't think I'm feeling bold enough to attempt anything like http://dominion.thruhere.net/koen/cms/using-1-wire-on-a-beaglebone
ultimately this, or something like it (I2C?) is going to make the device £20 cheaper.... but in terms of simplicity I want to see it working first with something like the DS9094 http://www.sheepwalkelectronics.co.uk/products-adapters.shtml
useful?
http://apartment-automation.blogspot.co.uk/2009/09/installing-1-wire-usb-adapter-ds9490r.html
Currently the SWE3 module from http://www.sheepwalkelectronics.co.uk/SWE3.shtml looks favorite, with a DS18S20 sensor (http://www.sheepwalkelectronics.co.uk/products-components.shtml) wired directly into the 3way terminal block on the board to create a dual temp/humidity unit. The IR led lighting can live on this module too and take power from the cat5.
Afterwards, I made LED 3 turn on and off
echo 0 > /sys/class/leds/beaglebone\:\:usr3/brightness
echo 1 > /sys/class/leds/beaglebone\:\:usr3/brightness
RTC on i2c
Instructions for the DS1307 below, step one is build the thing;
http://adafruit.com/product/264
http://www.ladyada.net/learn/breakoutplus/ds1307rtc.html
http://datasheets.maxim-ic.com/en/ds/DS1307.pdf
Then buy this (should have used the
http://proto-pic.co.uk/pca9306-level-translator-breakout/
(set EN high)
connect them all together;
(The 1-wire thermometer can just be seen at the bottom of the breadboard)
L@@K! something (hopefully the DS1307) is at address 0x68.
root@omap:/home# i2cdetect -r -y 3
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
The DS1307 didn't seem to burst into life until you set it... I would probably know that if I read the friendly manual. I seem to be able to set the seconds byte to 00x0 with
i2cset -y 3 0x68 0x00 0x00
and a couple of seconds later 0x00 is 02... so I think it's working. Note to self - need to refine this to actually set/read the time.
i2cdump -y 3 0x68
No size specified (using byte-data access)
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 02 00 00 01 01 01 00 03 07 01 40 30 40 0d 26 70 ?..???.???@0@?&p
10: 98 03 10 50 83 89 18 1d 1c 01 0c 08 0c 12 00 20 ???P??????????.
20: 1e 6a 10 f0 60 52 82 61 47 81 63 10 80 30 04 39 ?j??`R?aG?c??0?9
30: 2e 38 8a 04 ec 88 c0 20 01 20 20 56 40 d0 24 95 .8????? ? V@?$?
40: 02 00 00 01 01 01 00 03 07 01 40 30 40 0d 26 70 ?..???.???@0@?&p
50: 98 03 10 50 83 89 18 1d 1c 01 0c 08 0c 12 00 20 ???P??????????.
60: 1e 6a 10 f0 60 52 82 61 47 81 63 10 80 30 04 39 ?j??`R?aG?c??0?9
70: 2e 38 8a 04 ec 88 c0 20 01 20 20 56 40 d0 24 95 .8????? ? V@?$?
80: 02 00 00 01 01 01 00 03 07 01 40 30 40 0d 26 70 ?..???.???@0@?&p
90: 98 03 10 50 83 89 18 1d 1c 01 0c 08 0c 12 00 20 ???P??????????.
a0: 1e 6a 10 f0 60 52 82 61 47 81 63 10 80 30 04 39 ?j??`R?aG?c??0?9
b0: 2e 38 8a 04 ec 88 c0 20 01 20 20 56 40 d0 24 95 .8????? ? V@?$?
c0: 02 00 00 01 01 01 00 03 07 01 40 30 40 0d 26 70 ?..???.???@0@?&p
d0: 98 03 10 50 83 89 18 1d 1c 01 0c 08 0c 12 00 20 ???P??????????.
e0: 1e 6a 10 f0 60 52 82 61 47 81 63 10 80 30 04 39 ?j??`R?aG?c??0?9
f0: 2e 38 8a 04 ec 88 c0 20 01 20 20 56 40 d0 24 95 .8????? ? V@?$?
lots of numbers....
getting the time out of the ds1307 looks like it's going to be easier than i thought
echo ds1307 0x68 >/sys/bus/i2c/devices/i2c-3/new_device
or
echo ds1307 0x68>/sys/devices/platform/omap/omap_i2c.3/i2c-3/
both these seem to work, and it also seems this information can be found at /sys/class/i2c-adapter/i2c-3/
both these seem to work, and it also seems this information can be found at /sys/class/i2c-adapter/i2c-3/
There's a driver in the kernel for the ds1307, so getting the time is seemingly as straight forward as;
hwclock -f /dev/rtc1 --set --date="8/11/2012 21:31"
I had some problems with the hours last night - either it was me, or whatever time zone i'm in (haven't set any locale data yet) or the bits for 24h/12h on the ds1307 (see datasheet).
this is all from
so look there for a fuller explaination - but here are the useful commands I need for my own reference;
Read time from hwclock;
hwclock -f /dev/rtc1 -r
Set system time from hwclock;
hwclock -f /dev/rtc1 -s
Write system time to the hwclock
hwclock -f /dev/rtc1 -w
Looking into getting this to work on startup next...
got some advice here;
https://groups.google.com/forum/?fromgroups#!topic/beagleboard/DegreEdtI-Q%5B1-25%5D
Which seems to work.
I think this should set the right time and write it to the hwclock
dpkg-reconfigure tzdata
ntpdate ntp.ubuntu.com
hwclock -f /dev/rtc0 -w
Datasheet for DS9094;
http://www.sheepwalkelectronics.co.uk/datasheets/DS9490-DS9490R.pdf
pinout for DS9094;
pinout for RJ45;
The humidity module SWE3 from sheepwalk (http://www.sheepwalkelectronics.co.uk/SWE3.shtml) has two rj45 sockets - I'm going to use one of these at the host end to build a RJ12 - RJ45 adapter. Pins 4 and 5 will come from the 1wire host RJ12 socket but this adapter doesn't provide enough power to drive the IR leds so my RJ45 adapter is going to inject 5v from the regulator.
Image of the SWE3 from sheepwalkelectronics.co.uk - the terminal block is where the temperature sensor will be mounted.
Having built my RJ12 -> RJ45 adaptor I dmesg, and have just spied;
[ 1.827064] BeagleBone cape: initializing w1-gpio
[ 1.832094] w1-gpio connected to P8_6
This implies to me that the ubuntu 12.04 already has the 1wire patch and I don't need my USB host!? Looking at the comments at http://dominion.thruhere.net/koen/cms/using-1-wire-on-a-beaglebone leads me to believe I probably should have expected than...
last comment regarding the 4k7 pull up seems pertinent too.
...Found two approx. 10k resistors in the loft! Hooking up to P8_6 does indeed work.
root@omap:~# cat /sys/bus/w1/devices/10-000802307b83/w1_slave
31 00 4b 46 ff ff 01 10 27 : crc=27 YES
31 00 4b 46 ff ff 01 10 27 t=24687
I need to do some homework before I hook up the humidity sensor as 3.3v is outside the voltage range of the 4031. Looks like I might be able to replace it with the 5031;
http://uk.farnell.com/jsp/search/productdetail.jsp?sku=1784721
I've have to do some homework/ read the datasheet.
http://sensing.honeywell.com/index.php/ci_id/49692/la_id/1/document/1/re_id/0
Voltage supply 2.7 - 5.5 Vdc
Current supply 200 - 500 uA
Voltage output (1st order curve fit) VOUT=(VSUPPLY)(0.00636(sensor RH) + 0.1515), typical at 25 C
Temperature compensation True RH = (Sensor RH)/(1.0546 0.00216T), T in C
NB The ADC may lose accuracy at 3.3v... so maybe some more bidirectional level conversion is better?
This looks a bit like the SWE3 circuit to me;
http://owfs.org/uploads/File/humsensor.pdf
note the True RH calculation above for the 5031 differs from the information in the sidebar for the other chip.
Application notes on 1-wire
http://www.maxim-ic.com/app-notes/index.mvp/id/148
http://dominion.thruhere.net/koen/cms/using-1-wire-on-a-beaglebone
Great i2c beaglebone tutorial;
http://www.youtube.com/watch?v=8C2zk6B-eLU
another RTC resource
http://wiki.glacsweb.info/index.php?title=Beaglebone&redirect=no
got some advice here;
https://groups.google.com/forum/?fromgroups#!topic/beagleboard/DegreEdtI-Q%5B1-25%5D
Which seems to work.
I think this should set the right time and write it to the hwclock
dpkg-reconfigure tzdata
ntpdate ntp.ubuntu.com
hwclock -f /dev/rtc0 -w
1 wire
Datasheet for DS9094;
http://www.sheepwalkelectronics.co.uk/datasheets/DS9490-DS9490R.pdf
pinout for DS9094;
pinout for RJ45;
The humidity module SWE3 from sheepwalk (http://www.sheepwalkelectronics.co.uk/SWE3.shtml) has two rj45 sockets - I'm going to use one of these at the host end to build a RJ12 - RJ45 adapter. Pins 4 and 5 will come from the 1wire host RJ12 socket but this adapter doesn't provide enough power to drive the IR leds so my RJ45 adapter is going to inject 5v from the regulator.
Image of the SWE3 from sheepwalkelectronics.co.uk - the terminal block is where the temperature sensor will be mounted.
Having built my RJ12 -> RJ45 adaptor I dmesg, and have just spied;
[ 1.827064] BeagleBone cape: initializing w1-gpio
[ 1.832094] w1-gpio connected to P8_6
This implies to me that the ubuntu 12.04 already has the 1wire patch and I don't need my USB host!? Looking at the comments at http://dominion.thruhere.net/koen/cms/using-1-wire-on-a-beaglebone leads me to believe I probably should have expected than...
last comment regarding the 4k7 pull up seems pertinent too.
...Found two approx. 10k resistors in the loft! Hooking up to P8_6 does indeed work.
root@omap:~# cat /sys/bus/w1/devices/10-000802307b83/w1_slave
31 00 4b 46 ff ff 01 10 27 : crc=27 YES
31 00 4b 46 ff ff 01 10 27 t=24687
cat /sys/bus/w1/devices/10-000802307b83/w1_slave | tail -n1 | awk -F= '{print $2/1000 " degrees Celsius"}'
24.625 degrees Celsius
A comfortable 24.635 C°.
I need to do some homework before I hook up the humidity sensor as 3.3v is outside the voltage range of the 4031. Looks like I might be able to replace it with the 5031;
http://uk.farnell.com/jsp/search/productdetail.jsp?sku=1784721
I've have to do some homework/ read the datasheet.
http://sensing.honeywell.com/index.php/ci_id/49692/la_id/1/document/1/re_id/0
Voltage supply 2.7 - 5.5 Vdc
Current supply 200 - 500 uA
Voltage output (1st order curve fit) VOUT=(VSUPPLY)(0.00636(sensor RH) + 0.1515), typical at 25 C
Temperature compensation True RH = (Sensor RH)/(1.0546 0.00216T), T in C
NB The ADC may lose accuracy at 3.3v... so maybe some more bidirectional level conversion is better?
This looks a bit like the SWE3 circuit to me;
http://owfs.org/uploads/File/humsensor.pdf
note the True RH calculation above for the 5031 differs from the information in the sidebar for the other chip.
Further reading
Application notes on 1-wire
http://www.maxim-ic.com/app-notes/index.mvp/id/148
References/ Acknowledgements
Invaluable 1-wire info;http://dominion.thruhere.net/koen/cms/using-1-wire-on-a-beaglebone
Great i2c beaglebone tutorial;
http://www.youtube.com/watch?v=8C2zk6B-eLU
another RTC resource
http://wiki.glacsweb.info/index.php?title=Beaglebone&redirect=no
Hey are you able to make your clock work after you have turned the power down? I am facing this problem my clock will reset once a turn the power down. I checked your link https://groups.google.com/forum/?fromgroups#!topic/beagleboard/DegreEdtI-Q%5B1-25%5D
ReplyDeleteand it seems I have to modify the file board-am335xevm.c but I do not find, only the .h file assoicated with it. I am using angstrom with kernel version 3.2.34 and I know it is suppose to be here but I really don't find any idea?