HP5508A replacement v1.1 - pressure and humidity sensors

The wavelength of the laser is dependent on temperature, pressure and humidity. So I chose to add those sensors.

The pressure sensor is a BMP180. This one connects via I2C.

The humidity sensor is a AM2302. This one connects via a 1 wire interface.

Both have temperature, so we get that value twice. These sensors are readily available on eBay.

In order to accommodate these sensors some rerouting has to be performed. The I2C interface on the DP32 board is on a pin that we are currently using. Specifically:

I2C clock - RB8

I2C data - RB9 - This one currently has REF on it.

So we will move REF from RB9 to RB14 which will open the I2C bus for the BMP180.

The firmware change is very simple in deed:

// set up pps pin for external counters
T3CKR = 0b0001; // RPB5 using T3CK PPS pin
T5CKR = 0b0001; // RPB14 using T5CK PPS pin

You don't have infinitely variable connectivity with the pins and peripherals on the PIC. Timer 3 and Timer 5 can connect only to certain pins. T3CKR, for example, is the register that connects timer 3 to other resources. Here, 0b0001 specifies pin B5. For T5CKR 0b0001 specifies pin B14.

The DP32 very conveniently has I2C pull up resistors on board, which can be set with jumpers. They now have to be set.

The AM2302 only needs a single signaling pin, and a pull up resistor. This then goes onto RB7. Like this:

NOTE: There seem to be various versions of the BMP180 board available on eBay and other places. Make sure you adjust the pinout to the BMP board you have. There is more information on the pinout differences available on Sam Goldwassers site:


I am switching the development environment here to UECIDE, because its plugin manager makes it easy to pull in the support libraries for the two chips. The BMP is implemented using the Adafruit_BMP085 library. And the DHT22 is implemented using the dht library.

If MPLAB works with the DP32, chances are the drivers are set up already and UECIDE works out of the box:


I like to use the 'full' versions that come with Java, and I prefer the beta versions too. But occasionally they don't work right and it is prudent to temporarily switch back to the latest release version.

Installing the project then becomes relatively simple. A quickFile->Import SAR allows the whole project including the support files to be imported.

Here is the file : https://sites.google.com/site/janbeck/Interferometer.sar