Autor Thema: Arduino / Firmata (FRM) I2c bmp180  (Gelesen 4343 mal)

Offline kroonen

  • Full Member
  • ***
  • Beiträge: 191
    • http://www.kroonen.eu/mobile
Arduino / Firmata (FRM) I2c bmp180
« am: 06 Januar 2015, 21:19:10 »
Hi,

I'm trying to connect the bmp180 i2c pressure sensor on the arduino with firmata

I installed ConfigurableFirmata on the arduino nano, and that works.

Then I connect the bmp180 with 3.3v , dang en sda to a4 and scl to a5

I have this config:

define Arduino FRM /dev/ttyUSB0@57600
attr Arduino i2c-config 1

define bmp180 FRM_I2C 77 0 7

I get in the log fhem

015.01.06 21:09:21 1: Including ./log/fhem.save
2015.01.06 21:09:21 3: Opening Arduino device /dev/ttyUSB0
2015.01.06 21:09:21 3: Setting Arduino baudrate to 57600
2015.01.06 21:09:21 3: Arduino device opened
2015.01.06 21:09:24 3: querying Firmata Firmware Version
2015.01.06 21:09:25 3: querying Firmata Firmware Version
2015.01.06 21:09:25 3: Firmata Firmware Version: ConfigurableFirmata.ino V_2_06
2015.01.06 21:09:25 2: SecurityCheck:  WEB,WEBphone,WEBtablet has no basicAuth attribute. telnetPort has no password/globalpassword attribute.  Restart FHEM for a new check if the problem is fixed, or set the global attribute motd to none to supress this message.
2015.01.06 21:09:25 0: Server started with 10 defined entities (version $Id: fhem.pl 7301 2014-12-22 07:12:41Z rudolfkoenig $, os linux, user root, pid 2833)

But no data ...

What do I wrong

regards Richard

Offline kroonen

  • Full Member
  • ***
  • Beiträge: 191
    • http://www.kroonen.eu/mobile
Antw: Arduino / Firmata (FRM) I2c bmp180
« Antwort #1 am: 06 Januar 2015, 22:43:43 »
I got some more info

I configured it as follow, i think still that the values behind the i2c for register and bytes to read are wrong?? Any idea what the should be?

define Arduino FRM /dev/ttyUSB0@57600
attr Arduino i2c-config 1

define bmp_180 FRM_I2C 77 aa 22
attr bmp_180 IODev Arduino


2015.01.06 22:39:06 3: telnetPort: port 7072 opened
2015.01.06 22:39:06 3: WEB: port 8083 opened
2015.01.06 22:39:06 3: WEBphone: port 8084 opened
2015.01.06 22:39:06 3: WEBtablet: port 8085 opened
2015.01.06 22:39:06 2: eventTypes: loaded 56 events from ./log/eventTypes.txt
2015.01.06 22:39:06 1: Including ./log/fhem.save
2015.01.06 22:39:06 3: Opening Arduino device /dev/ttyUSB0
2015.01.06 22:39:06 3: Setting Arduino baudrate to 57600
2015.01.06 22:39:06 3: Arduino device opened
2015.01.06 22:39:09 3: querying Firmata Firmware Version
2015.01.06 22:39:09 3: Firmata Firmware Version: ConfigurableFirmata.ino V_2_06
2015.01.06 22:39:10 1: PERL WARNING: Argument "aa" isn't numeric in bitwise and (&) at FHEM/lib/Device/Firmata/Protocol.pm line 1083.
2015.01.06 22:39:10 2: SecurityCheck:  WEB,WEBphone,WEBtablet has no basicAuth attribute. telnetPort has no password/globalpassword attribute.  Restart FHEM for a new check if the problem is fixed, or set the global attribute motd to none to supress this message.
2015.01.06 22:39:10 0: Server started with 10 defined entities (version $Id: fhem.pl 7301 2014-12-22 07:12:41Z rudolfkoenig $, os linux, user root, pid 2809)
2015.01.06 22:39:11 3: received String_data: I2C: Too few bytes received
2015.01.06 22:39:12 3: received String_data: I2C: Too few bytes received
2015.01.06 22:39:13 3: received String_data: I2C: Too few bytes received
2015.01.06 22:39:14 3: received String_data: I2C: Too few bytes received

Offline Tom Major

  • Sr. Member
  • ****
  • Beiträge: 592
    • TomMajor@github
Antw: Arduino / Firmata (FRM) I2c bmp180
« Antwort #2 am: 13 Januar 2015, 23:19:59 »

try this line instead:

define bmp_180 FRM_I2C 119 208 1

this should read the chip id register 0xD0 and if this returns 85 (0x55), this means success and you can go further by reading the actual pressure data registers.

I have conf. Firmata working fine with a I2C EEPROM.
Früher: FHEM 5.x
Jetzt: RaspberryMatic / ioBroker

Offline kroonen

  • Full Member
  • ***
  • Beiträge: 191
    • http://www.kroonen.eu/mobile
Antw: Arduino / Firmata (FRM) I2c bmp180
« Antwort #3 am: 16 Januar 2015, 13:46:51 »
I get 85 as result, but how should I make the config to read the pressure?

regards Richard

Offline Tom Major

  • Sr. Member
  • ****
  • Beiträge: 592
    • TomMajor@github
Antw: Arduino / Firmata (FRM) I2c bmp180
« Antwort #4 am: 16 Januar 2015, 18:03:19 »
Hi Richard,

well, reading the id register was just a test to verify that Fhem/Firmata can communicate with the BMP180.
I haven't used this chip, so I can only give kind of general I2C advice.

You could go further and read all the registers that you would need for calculating the pressure, e.g.
define bmp_180_1 FRM_I2C 119 170 22
would read the 22 bytes calibration data (registers 0xAA..BF)

and also a
define bmp_180_2 FRM_I2C 119 246 3
would read the 3 bytes ADC data

and with that you need to somehow setup some Perl math to calculate the pressure.
Früher: FHEM 5.x
Jetzt: RaspberryMatic / ioBroker

 

decade-submarginal