Author Topic: Cubieboard2 with barometric/temperature sensor BMP085 via I2C  (Read 12146 times)

Offline mihi

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Hi all,
I have managed to run lubuntu on my new cubieboard2 and read the temperature and barometric pressure from the BMP085 sensor via I2C.

I've put down my steps and created 2 posts:
1. How to enable I2C port on cubieboard: http://homecircuits.eu/blog/i2c-on-cubieboard-with-lubuntu/
2. How to get data from the BMP085 sensor: http://homecircuits.eu/blog/cubieboard-with-bmp085-barometer/

I'm now able to read temperature and atmospheric mean see level pressure (wheater forcast pressure) via python and store it in my cubieboard2.




Please let me know, if you used I2C or some RX/TX wireless modul like RF433 Wireless to get distant data (e.g. temperature from outside).
Now I use my arduino mini as a serial communication that gets me data from RF433 modul.
This is how I enabled serial communication (UART) with my arduino: http://homecircuits.eu/blog/cubieboard-lubuntu-open-uart/

thanks,
mihi
« Last Edit: July 10, 2015, 07:09:47 pm by mihi »

Offline actkk2000

  • Hero Member
  • *****
  • Posts: 572
  • Karma: +2/-11
    • View Profile
Re: Cubieboard2 with barometric/temperature sensor BMP085 via I2C
« Reply #1 on: May 24, 2014, 12:29:12 pm »
Very cool!  ;)
Thx for sharing!

Offline wantmymoneyback

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +4/-0
    • View Profile
Re: Cubieboard2 with barometric/temperature sensor BMP085 via I2C
« Reply #2 on: May 27, 2014, 02:28:12 pm »
I tried to get my RTC i2c to finally work using your instructions.
But then I bin2fex, it seems that those two pins are already assigned to twi1.
Do you have any idea how to get a DS3207 RTC to actually be detected?

Offline mihi

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: Cubieboard2 with barometric/temperature sensor BMP085 via I2C
« Reply #3 on: May 27, 2014, 06:41:57 pm »
yes, that is also the reason why I used twi1, but in my case I have to change that part of fex file from:
[twi1_para]
twi1_used = 0
twi1_scl = port:PB18<2><default><default><default>
twi1_sda = port:PB19<2><default><default><default>
 
to:
[twi1_para]
twi1_used = 1
twi1_scl = port:PB18<2><default><default><default>
twi1_sda = port:PB19<2><default><default><default>


then save, convert, reboot and try:
sudo i2cdetect -r 1

My twi0_used is also set to 1, so that is why it is I2C port 1 and not 0.
If you will have still problem I can try to connect my RTC to I2C.

 If you have internet, you can use NTP for time adjustment. Simple guide how to configure it: http://homecircuits.eu/blog/ububtu-setting-time-zone-and-ntp/

mihi
« Last Edit: July 10, 2015, 06:55:43 pm by mihi »

Offline mihi

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: Cubieboard2 with barometric/temperature sensor BMP085 via I2C
« Reply #4 on: May 27, 2014, 07:00:31 pm »
I tried to get my RTC i2c to finally work using your instructions.
But then I bin2fex, it seems that those two pins are already assigned to twi1.
Do you have any idea how to get a DS3207 RTC to actually be detected?

also try:
Code: [Select]
i2cdetect -l
my cybieboard responds:
Code: [Select]
i2c-0   unknown         sunxi-i2c.0                             N/A
i2c-1   unknown         sunxi-i2c.1                             N/A
i2c-2   unknown         sunxi-hdmi-i2c                          N/A



Offline jiv

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +0/-0
    • View Profile
Re: Cubieboard2 with barometric/temperature sensor BMP085 via I2C
« Reply #5 on: May 28, 2014, 05:59:21 am »
pekne pekne :P

Offline calhemp

  • Newbie
  • *
  • Posts: 11
  • Karma: +3/-0
    • View Profile
Re: Cubieboard2 with barometric/temperature sensor BMP085 via I2C
« Reply #6 on: May 28, 2014, 08:10:54 am »
thanks for share

Offline wantmymoneyback

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +4/-0
    • View Profile
Re: Cubieboard2 with barometric/temperature sensor BMP085 via I2C
« Reply #7 on: May 28, 2014, 03:59:36 pm »
I do not have internet, why I want an RTC to finally work. i2c starts, as it is address 35 or so that gets the EIDE to determine the screen size. The info for twi1 or that is, the second one, is exactly like you show in your script, but in there by default.
I have been trying for over a year to get the RTC to work. Everyone on line says that these DS1302 clocks are at address 68, but NOTHING ever appears there. I have the /dev/i2c created at startup. To save boot time I finally disabled the RS1302 module. But it would make RTC1 but never work.

EVERY time I start my Cubieboard it is DEC 31, 1969 at 7 PM. I am so tired of setting the time I'm ready to just stop using it. If it would at least learn to save the time from its last boot would save hundreds of clicks. I have thought of buying the Arduino $11 ethernet and the $30 DS3234 with SPI and just try to have it as the net work time server, but that would be as much as the Cubieboard.

The Arduino wire library is cascaded on other things, so the software for setting up the Arduino RTC just can not be compiled by me.

Offline mihi

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: Cubieboard2 with barometric/temperature sensor BMP085 via I2C
« Reply #8 on: May 28, 2014, 06:47:46 pm »
Hi,

I have DS1307 and not DS1302.
http://datasheets.maximintegrated.com/en/ds/DS1302.pdf
http://datasheets.maximintegrated.com/en/ds/DS1307.pdf

What I saw is that 1307 supports I2c and 1302 is 3wire.
The DS1302 uses three lines (CE, I/O, SCLK). It is not I2C, it's not OneWire, and it is not SPI. So I'm not sure how you connected DS1302 to cubieboard I2C.


I have connected my RTC DS1307 with 5V vcc and on the first try I got no response. On my 2nd try I got response on address 68 (I'm not sure why only after the second try).

Code: [Select]
linaro@cubieboard2:~$ sudo i2cdetect -r 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
linaro@cubieboard2:~$ sudo i2cdetect -r 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

linaro@cubieboard2:~$ sudo i2cdump 1 0x68
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1, address 0x68, mode byte
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 32 11 23 04 28 05 14 00 49 0a 14 01 86 68 01 12    2?#?(??.I????h??
10: e4 05 42 a0 a4 e8 00 00 5d ad 40 da 19 28 00 e1    ??B???..]?@??(.?
20: 66 0f 26 9c 49 43 08 b0 90 d0 42 2a 18 22 00 02    f?&?IC????B*?".?
30: c0 00 1e 00 c6 49 80 88 16 93 00 40 04 e2 20 b0    ?.?.?I????.@?? ?
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

this might help: http://www.cubieforums.com/index.php/topic,137.30.html


mihi
« Last Edit: May 28, 2014, 07:10:51 pm by mihi »

Offline wantmymoneyback

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +4/-0
    • View Profile
Re: Cubieboard2 with barometric/temperature sensor BMP085 via I2C
« Reply #9 on: May 29, 2014, 04:11:08 pm »
Thank you for your help.
This is what I bought:
http://www.ebay.com/itm/like/121014967852?lpid=82
It seems to me that I may be using the wrong side of the board to connect? I'll try changing.
But how did you set the clock and then get the Cubieboard to then read that time upon booting?

Offline mihi

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: Cubieboard2 with barometric/temperature sensor BMP085 via I2C
« Reply #10 on: May 27, 2015, 02:04:13 pm »
But how did you set the clock and then get the Cubieboard to then read that time upon booting?

To update time and date try:
Quote
sudo ntpdate europe.pool.ntp.org

or read this post, how I did it:
http://homecircuits.eu/blog/ububtu-setting-time-zone-and-ntp/
« Last Edit: July 10, 2015, 06:53:13 pm by mihi »