Problem using LPS35 Pressure/temp sensor with Arduino over a

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
DianeMIT
 
Posts: 5
Joined: Mon Nov 28, 2016 4:55 pm

Problem using LPS35 Pressure/temp sensor with Arduino over a

Post by DianeMIT »

I'm using the Adafruit LPS35HW pid 4258 with an Arduino Uno. The board does not always initialize working when connected over a cable ~30' . The first time we built one it did work, but other very similar applications did not. The sensor did not start (I did not see anything printed on the Serial Monitor) when used with a long cable. However, it did work when used with short jumpers. We have checked the cable and it appears to be weel constructed with good pins/sockets at the ends.
Code is here:

Code: Select all

// Pressure Sensor test code 7/30/22 Leo Wang, revised by Diane Brancazio
// Overview of product at https://learn.adafruit.com/lps35hw-water-resistant-pressure-sensor
// You will need to install the Adafruit LPS35HW Library and the Adafruit BusIO library 
// using the Library Manager in the Arduino IDE.
// 
//Connections and wiring notes. Uses Serial Peripheral Interface (SPI) Logic

//Vin - power in from Arduino - connect to 5V (3.3V is ok too)
//GND - Ground from Arduino
//SCK - This is also the SPI Clock pin, its an input to the chip
//SDO (MISO) - this is the Serial Data Out / Microcontroller In Sensor Out pin, for data sent from the LPS35HW to your processor
//SDI (MOSI) - this is also the Serial Data In / Microcontroller Out Sensor In pin, for data sent from your processor to the LPS35HW
//CS - this is the Chip Select pin, drop it low to start an SPI transaction. Its an input to the chip


#include <Adafruit_LPS35HW.h>
Adafruit_LPS35HW sensor = Adafruit_LPS35HW();

#define LPS_CS  8  
#define LPS_SCK  13 
#define LPS_MISO 12 
#define LPS_MOSI 10 

float temperatureC, pressure_hpa, pressure_psi;

void setup() {
  //starting the serial monitor, which can be found in "Tools" 
  Serial.begin(115200);
  while (!Serial) { delay(1); }
  sensor.begin_SPI(LPS_CS, LPS_SCK, LPS_MISO, LPS_MOSI);
  sensor.zeroPressure();
}

void loop() {
  //retrieving and printing the temperature detected onto the monitor
  temperatureC = sensor.readTemperature();
  Serial.print("Temperature: ");
  Serial.print(temperatureC); 
  Serial.println(" C");

  //retrieving and printing the pressure detected onto the monitor
  pressure_hpa = sensor.readPressure();
  Serial.print("Pressure: ");
  Serial.print(pressure_hpa,3); 
  Serial.println(" hPa");[url][/url]

  //Senses temperature and pressure every half a second
  delay(500);
}
I then tried it with a STEMMA QT connector and the I2C interface and it worked over a cable. On the info page https://learn.adafruit.com/lps35hw-wate ... ure-sensor it says (Arduino only SPI support, for now) so I wondered if this implementation is reliable.

So my question is, how can I use this board relialy with the SPI or I2C interface, over a 30' cable? thanks!

User avatar
adafruit_support_carter
 
Posts: 29172
Joined: Tue Nov 29, 2016 2:45 pm

Re: Problem using LPS35 Pressure/temp sensor with Arduino ov

Post by adafruit_support_carter »

I2C was designed for short cable lengths.
https://learn.adafruit.com/working-with ... ble-length

For very long cables, something like this can be used:
https://www.adafruit.com/product/4756

User avatar
DianeMIT
 
Posts: 5
Joined: Mon Nov 28, 2016 4:55 pm

Re: Problem using LPS35 Pressure/temp sensor with Arduino ov

Post by DianeMIT »

Thanks - that booster looks like a good solution for I2C.
If I use the SPI interface should the length of the cable matter? We are using ethernet cable - 8 wires about 24awg - hoping to go to 30'
thanks again!

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”