Message Boards Message Boards

Read sensor data of I2C BMP180 directly from MMA?

GROUPS:

Excuse me please, are there any example codes available for I2C devices like BMP180, reading the sensor data directly from Mathematica?

Thank you, Libor

POSTED BY: Libor Caha
Answer
1 month ago

Hi Libor,

While I don't have any explicit examples for the BMP180 device, you can see the documentation for how to use the built-in I2C driver in Mathematica here : http://reference.wolfram.com/language/ref/device/I2C.html

Specifically, you can read/write with:

dev=DeviceOpen["I2C",address]
DeviceWrite[dev,bytes]
DeviceRead[dev,numBytes]

Where bytes is a list of integers 0-255, and numBytes is the number of bytes to read from the bus.

Adafruit has an example library that you can look at for reference of what bytes to read/write, etc. The library source code is here : https://github.com/adafruit/Adafruit-BMP085-Library/blob/master/Adafruit_BMP085.cpp

Ian

POSTED BY: Ian Johnson
Answer
1 month ago

Group Abstract Group Abstract