<< Summary

Use the Adafruit BMP183 with a Raspberry PI, in Java Raspberry PI
Temperature and Pressure

The board we are talking about here is the SPI Barometric Pressure/Temperature/Altitude Sensor.

Important: Unlike the BMP180 that has an I2C interface, this one has an SPI interface!
This makes the code and the wiring substancially different.

Wiring

BMP183Raspberry PI
Vin# 2. 5.0 VDC Power
GND# 6. 0V (Ground)
SCK#23. SCLK
SDO#21. MISO
SDI#19. MOSI
CS#24. CE
Raspberry PI P1 Connector map Click to enlarge

Note: There are on the Raspberry PI header pins labeled MISO, MOSI, SCLK, CE0. These are the ones we use in this example. But this is absolutely not mandatory. You can very well use any GPIO pins you like, as long as they are used in the right direction (input or output).

Running

In your code, nmake sure you read the Temperature before the Pressure. Pressure depends on Temperature.
The class to run is adafruitspi.sensor.main.SampleBMP183Main. Run it from a script like this:

 #!/bin/bash
 PI4J_HOME=/home/pi/pi4j/pi4j-distribution/target/distro-contents
 CP=./classes
 CP=$CP:$PI4J_HOME/lib/pi4j-core.jar
 sudo java -cp $CP adafruitspi.sensor.main.SampleBMP183Main
      
The output would look like this:

 Temperature: 22.5°C
 Pressure   : 1019.32 hPa
      


Oliv did it