Hi,
First time posting, so I hope this in the right place and I have included all the detail you need.
I think trying to attach 3 files is making this post too large, some files mentioned here may be attached to a comment, below.
I am trying to read and log a pressure measurement to an SD card using Arduino.
My first purchases were Arduino Uno and a Honeywell HSCMAND015PA5A2 pressure sensor.
The datasheet for these sensors is here: Safety and Productivity Solutions | Honeywell
- I connected up the pressure sensor - picture of set up in attached pdf.
- I followed these instructions, downloading the library on that page: Arduino Playground - HoneywellTruStabilitySSC-HSCPressureSensors
- I created a sketch based on Option #2 in the above link, controlling the sensor from the serial monitor. I had to make a couple of modifications to get it to work, here’s my code:
#include <Wire.h>
#include <SSC.h>
//create an SSC sensor with I2C address 0x28 and power pin 8.
//If you have connected the SSC sensor to another pin, change this number!
//If you are using something other than model HSCDANN015PA2A5 check that the address is 0x28 (manual)
SSC ssc(0x28, 8);
void setup() { // put your setup code here, to run once:
//while (!Serial); is needed for the Feather board, unless using the 'void wait for serial' loop, above
//while (!Serial);
Serial.begin(9600);
Wire.begin();
//set min and max reading and pressure values, see datasheet for eqn
ssc.setMinRaw(1638); // output at minimum calibrated pressure (counts)
ssc.setMaxRaw(14745); //output at maximum calibrated pressure (counts)
ssc.setMinPressure(0.00); // min value of pressure range (ours 0-15 PSI gage)
ssc.setMaxPressure(15.00); // max value of pressure range (ours 0-15 PSI gage)
//start your sensor
Serial.println("the sensor is starting");
ssc.start();
Serial.print("the starting pressure is:");
Serial.println(ssc.pressure()); //returns the starting pressure)
Serial.println("end of starting section");
}
void loop() {
// put your main code here, to run repeatedly:
while(Serial.available()) {
ssc.commandRequest(Serial);
}
delay(100);
}
This seems to work, the first output of ssc.pressure is '73.13', but after a ‘u’ for update I get a sensible pressure, 14.8, which can be changed if I raise or lower the ambient pressure.
Then I wanted to see if I could get this set up to measure repeatedly, so I used Option #1 from the Arduino link, above. Again, a couple of modifications later I had this:
#include <Wire.h>
#include <SSC.h>
//create an SSC sensor with I2C address 0x28 and power pin 8
SSC ssc(0x28, 8);
void setup() { // put your setup code here, to run once:
Serial.begin(9600);
Wire.begin();
//set min and max reading and pressure values, see datasheet for eqn
ssc.setMinRaw(1638); // output at minimum calibrated pressure (counts)
ssc.setMaxRaw(14746); //output at maximum calibrated pressure (counts)
ssc.setMinPressure(0); // min value of pressure range (ours 0-150 PSI gage)
ssc.setMaxPressure(15); // max value of pressure range (ours 0-150 PSI gage)
//start your sensor
Serial.println("the sensor is starting"); // this prints in the serial print "the sensor is starting() and two tabs" (\t = tab)
ssc.start(); // the 'println' bit does a carriage return
Serial.print("the starting pressure is:");
Serial.println(ssc.pressure()); //returns the starting pressure)
}
void loop() {
// put your main code here, to run repeatedly:
//update pressure/temperature
Serial.println("updating...");
ssc.update();
Serial.print("pressure is: "); //returns the new pressure
Serial.println(ssc.pressure());
delay(5000);
}
And again, this works fine.
I have also then gone on to get this to save to an SD card and successfully used it for a couple of multi-hour experiments, so far so good.
My problem is that I wanted to switch to a smaller board. I have an Adafruit Feather MO Proto. These, I believe, have 3.3 not 5V logic so I purchased a new pressure sensor:
HSCSANN015PA2A3
(the datasheet I linked to above covers this as well).
Again, photo of set up in attached pdf.
I followed the step-by-step instructions here - Overview | Adafruit Feather M0 Basic Proto | Adafruit Learning System – to prepare the Arduino IDE for use with this feather board.
Then I loaded my first sketch. The only changes I made where the “while Serial” bit, which I got from the adafruit link and to change the pin number:
#include <Wire.h>
#include <SSC.h>
//create an SSC sensor with I2C address 0x28 and power pin 8.
//If you have connected the SSC sensor to another pin, change this number!
//If you are using something other than model HSCDANN015PA2A5 check that the address is 0x28 (manual)
SSC ssc(0x28, 6);
void setup() { // put your setup code here, to run once:
//while (!Serial); is needed for the Feather board, unless using the 'void wait for serial' loop, above
while (!Serial);
Serial.begin(9600);
Wire.begin();
//set min and max reading and pressure values, see datasheet for eqn
ssc.setMinRaw(1638); // output at minimum calibrated pressure (counts)
ssc.setMaxRaw(14745); //output at maximum calibrated pressure (counts)
ssc.setMinPressure(0.00); // min value of pressure range (ours 0-15 PSI gage)
ssc.setMaxPressure(15.00); // max value of pressure range (ours 0-15 PSI gage)
//start your sensor
Serial.println("the sensor is starting");
ssc.start();
Serial.print("the starting pressure is:");
Serial.println(ssc.pressure()); //returns the starting pressure)
Serial.println("end of starting section");
}
void loop() {
// put your main code here, to run repeatedly:
while(Serial.available()) {
ssc.commandRequest(Serial);
}
delay(100);
}
My verbose output is attached as a text file.
The serial port, when opened, immediately prints:
"the sensor is starting
the starting pressure is:-1.87
end of starting section"
These are the commands available:
• '1': start the sensor
• '0': stop the sensor
• 'a': return the I2C address
• 'q': return the power pin
• 'u': update pressure / temperature
• 'p': return pressure (as a float)
• 't': return temperature (as a float)
• 'b': return min pressure (float)
• 'c': return max pressure (float)
• 'd': return min reading (raw: uint16_t)
• 'e': return max reading (raw: uint16_t)
• 'B': set min pressure (float)
• 'C': set max pressure (float)
• 'D': set min reading (raw: uint16_t)
• 'E': set max reading (raw: uint16_t)
‘p’ doesn’t change, even if preceded with a ‘1’ or a ‘0’ and it freezes the entire serial monitor window if type ‘u’ (best case scenario, serial monitor won’t let me type anything else and I can close it, but sometimes it ‘freezes’ so bad I have to ctrl+alt+delete.
I can replicate this set up on the Arduino Uno by getting my SDA and SCL cables the wrong way round, but I’ve tested that.
Other things I’ve tried:
• Using a different pin instead of pin 6
• Rebooting the feather and trying again
• Using a different breadboard
• Checking soldering on the feather
• Trying with and without pull up resistors
• Trying this library (GitHub - rodan/honeywell_hsc_ssc_i2c: avr library for honeywell hsc and ssc series pressure sensors (i2c version)) – still just reports -1.87 for pressure
• Accepting I'm a beginner and could have screwed something up royally, uninstalled Arduino (completely) and reinstalled it and the SAMD drivers and SSC library, etc.
It says here - Adapting Sketches to M0 & M4 | Adafruit Feather M0 Basic Proto | Adafruit Learning System - that pin outputs/pullups are different for the M0 – perhaps I need to change something in my SSC library .h and .cpp files?
I have also read online the Feather M0 might have trouble with the standard wire library for I2C, but I’m not sure what I would do about that, I don’t want to fiddle with standard libraries and I downloaded the SAMD packages as per the adafruit instructions, so I would hope this is OK.
This has been several days of tests now…I’m a beginner so I’m sure it’s something simple/stupid I’ve overlooked.
Any suggestions gratefully received!
I'm wondering at this point whether to give up on the M0 and try and find a feather board that is more similar to the Uno... (I've got a feather wing logger, and they're the perfect shape so I want to carry on down this route if I can)
Thanks in advance.
HSC-tests-verbose.txt (16.3 KB)
set ups.pdf (271 KB)