it was quite a challenge to solder this but and i do not if i broke the sensor for over-heating XD
this is what i go on the serial port when reading the calibration words...
Calibration word 1 =18820
Calibration word 2 =35237
Calibration word 3 =22501
Calibration word 4 =27826
2352
4646
351
217
2405
50
Temperature raw =65535
Pressure raw =65535
Real Temperature in °C=285.00
Compensated pressure in mbar =-209082
2nd order compensated temperature in °C =285.00
some of the values are pretty similar to yours...
but the temperature somehow is not working.. another interesting think is that i am using a 8 MHZ arduino not the 16....
so i wonder if the divider is set correctly for the frequency...
second try i hooked the 32.768 khz clock i bought directly to the sensor and things got better
first reading is good, second reading is bad...
Temperature raw =30027
Pressure raw =2047
Real Temperature [°C]=31.00
Compensated pressure [mbar] =-12747
2nd order compensated temperature [°C] =31.00
Temperature raw =49151
Pressure raw =2047
Real Temperature [°C]=175.00
Compensated pressure [mbar] =-16794
2nd order compensated temperature [°C] =175.00
i reset and put my finger and temperature increases
buton:
second try i hooked the 32.768 khz clock i bought directly to the sensor and things got better
first reading is good, second reading is bad...
Temperature raw =30027
Pressure raw =2047
Real Temperature [°C]=31.00
Compensated pressure [mbar] =-12747
2nd order compensated temperature [°C] =31.00
Temperature raw =49151
Pressure raw =2047
Real Temperature [°C]=175.00
Compensated pressure [mbar] =-16794
2nd order compensated temperature [°C] =175.00
i reset and put my finger and temperature increases
I solder it again and it is working perfect
thank you man..
the diving community really appreciate your effort
Temperature raw =29659
Pressure raw =14623
Real Temperature [°C]=28.00
Compensated pressure [mbar] =981
2nd order compensated temperature [°C] =28.00
Great, congratulations!
Let me know if you by chance modify the code, because for some reason it only gives X.00 (point zero) temperature values and I would like to have a better resolution.
It is great to contribute to the community after I received so much help and advice, I am very happy to share!
godo:
Great, congratulations!
Let me know if you by chance modify the code, because for some reason it only gives X.00 (point zero) temperature values and I would like to have a better resolution.
It is great to contribute to the community after I received so much help and advice, I am very happy to share!
i think that i got it
change the calculation of the temeperature to double
Wow, great, that is a bit of a surprise though, because:
The double implementation on the Arduino is currently exactly the same as the float, with no gain in precision.
But, on the other hand:
Users who borrow code from other sources that includes double variables may wish to examine the code to see if the implied precision is different from that actually achieved on the Arduino.
I realized that having the microsd card and the sensor on the same buss will be too complicated due to the libray SDFAT.. and i dont want to add another IC
so i was thingking about doing some bit banging to get the data...
somehow i got it to work(i think) the reset and pressure conversion sequence works because i am getting data
where i am having problems is on the reading, no reading the correct raw value...how ever if i manually press the sensor with my finger... i start getting numbers...also if i modify the delay on the clk while reading it also changes...
godo please helpme out if you see something weird.. i almost follow the datasheet and some insights of you spi code..
word start=0b1111010000000000;//start sequence
unsigned int p1,p2;
long reset=0b10101010101010100000000000000000;//reset sequence
byte counts;//for debug
int dout= 2;//pin for data out MOSI
int din=3;//pin for data in MISO
int clk=4;//data clock
boolean data=0;
void setup() {
// initialize the digital pin as an outputand input
Serial.begin(9600);
pinMode(dout, OUTPUT);
pinMode(din, INPUT);
pinMode(clk,OUTPUT);
}
void loop() {
pressure(); //main function
delay(3000); // wait for a second
}
void pressure()
{
Serial.println("start Reset");
//---start REset sequence...
for(int i=31;i>10;i--)
{
boolean x;
x=bitRead(reset,i);
digitalWrite(dout,x);
digitalWrite(clk,HIGH);
digitalWrite(clk,LOW);
}
//--------Start Conversion sequence
for(int i=15; i>5;i--)
{
boolean x;
x=bitRead(start,i);
digitalWrite(dout,x);
//--DRIVE CLOCK
digitalWrite(clk,HIGH);
digitalWrite(clk,LOW);
}
//wait unti conversion
// i keep runing the clock and wait until the Din(miso) detects that it went to 0 and the data is ready
data= digitalRead(din);
while(data==1)
{
digitalWrite(clk,HIGH);
digitalWrite(clk,LOW);
data=digitalRead(din);
}
//------------
//---start reading
//Serial.println("Read raw pressure");
for(int i=16; i>=0;i--)
{
digitalWrite(clk,HIGH); // drive the clock down
delay(10);
digitalWrite(clk,LOW);
delay(10);
data= digitalRead(din);// i read on low cycle de input(output of the sensor)
if(data==1)
{
bitWrite(p1,i,1);// write the value and i index the int to the right..
}
else
{
bitWrite(p1,i,0);
}
counts++;
}
//testing to see if shifting will help also
Serial.println(p1);
p2=p1>>1;
Serial.println(p2);
Serial.println(counts);//test to se how many times went into for cycle
counts=0;
}
Hey buton,
sorry, I did not see your previous post. I am impressed of your code, I myself have no idea about bit banging. Way to go, I saw your video, very nice.
At work I use the MS5803 sensor which is also very interesting, same size, but with both an I2C and SPI interface. And you could actually use the logging device for climbing as well
So keep us updated about the mechanical work which is coming up, especially how to get the sensor sealed and water tight.
Greetings
i tried to put today the sensor in a hole and then put some sillicon but i broke it
i order two more just in case, i will try them out next week in a 9 feet pool, and take some video... i just want to finish the ugly prototype get the software running and then i will focus in getting a quote for and actual board//shield for the "DIVE-DUINO"... still a lot of work to do.
Oh no, that's bad, we did something similar two days ago, a catastrophic leakage in the sensor housing... man, I thought the programing was the toughest part, but no!
So good luck and don't give up!
Cheers
Seb
i got the new sensor i ordered, i soldered it it did not work with the software already compiled.. it was weird.. so then i tried you example about the calibration factors and it work, then i compile the second version without the calibration factors and it did not work...
i dont know is weird...
so i finally made it to work but i am unsure what was the issue becuase is the SAME CODE...
I also play with a similar sensor, the MS5535 which I intend to use for a basic underwater mini observatory and your work was of great help for me! I am using a arduino adk board and my plan was to use a Andrid phone to store and transfer the data. However, it seems as if the USB host of this board conflicts with SPI ... I assume this is a similar case like the SD card pin conflict. In an earlier post godo proposed to
put a 74HC125 or so into the DOUT
. This might also be the solution for my problem however I have no idea how to assemble that, it would be very nice if you could post an image or similar of the circuit?
Godo also mentioned he was playing with another sensor, the MS5803, do you know a reseller of that product?
thank you very much for this hint and I will consider to use this as a data backup.
However, as I mentioned before I intend to use a Android phone for data transmission and the SPI sensor communication seems to conflict with the USB of the Mega ADK board this was the reason why I was asking for assitance in using the 74HC125.. any advice on that would be very welcome..
I found this post about depth sensor so i post my question.
I have a project who it is necessary to take the information from the sensor (in meters) and sent a command to one of outputs e.g to move one servo when to depth measures for example 2 meters etc.
Where can i found a code similar to that?
Thanks and sorry if i hijack this thread,
bilaouras