i2c w/ SCP1000 D11 Pressure sensor

Boondocker

New Member
Hello All,

I went ahead and purchased a PCB mount SCP1000 D11 pressure sensor. So far I’m unable to obtain the raw pressure data into an 18X chip using the i2c commands. The result sent is 65535. I’ve doubled check the circuit and attached photo and PCB carrier link.

Code:
'18X  Program for barometeric pressure
'i2c SCP1000D11 Sensor
'Slave address 0x11- %00010001



Symbol DRDY=input1  		' Data Ready from sensor	

Symbol TempOut = %10000001    ' 0x81 Raw Temperature, 16 bit retrive
Symbol DATARD8 = %01111111    ' 0x07 Raw Pressure, 8 bite read
Symbol DATARD16= %10000000    ' 0x80 Raw Pressure, 16 bite retrive  




symbol Mode = %00001010      ' 0x0A- High Resolution, continue
'symbol Mode = %00001001     ' 0x09- High Speed,continue
'symbol Mode = %00001011     ' 0x0B- Ultra Low Power, Continue
'symbol Mode = %00001100     ' 0x0C- Low Power, Trigger


Pause 500

I2cSlave %00100010, I2Cslow, I2Cbyte  'selects i2c device, set clock speed,  word
I2Cwrite %00000011,(Mode)                 'sets mode in operation address 0x03

Pause 45
Rdyck:					        'Data Ready Check	
  If DRDY=1 then Press
  Pause 10
  Goto Rdyck

Press:

I2cSlave %00100010, I2Cslow, I2Cword

I2cRead DATARD16,(b1,b0)
SerTxd( "Raw Reading = ", #w0, CR, LF ) 

Goto Rdyck
In reviewing the manual under Readi2c it explains “ If the i2c hardware is incorrectly configured, or the wrong i2cslave data has been used, the value 255 ($FF) will be loaded into each variable.” I believe some communication is occurring because when I change the slave address, from %00100010 to %00010001, the data ready (DRDY) remains at zero and will not proceed to out of the Rdychk loop.

After closer reading the datasheet, on page 12, it states the raw pressure output is between 120000 and 480000. The result is larger than word variable. Is this the problem? If so, is there a solution?

Any help and suggestions are appreciated.

Thanks,

Boondocker

http://www.vti.fi/midcom-serveattachmentguid-a5eab1b6104f11dd83cf7774ee6a7f057f05/tn38_scp1000_test_pcb_carrier_rev_1.3.pdf

http://www.vti.fi/midcom-serveattachmentguid-e9735f5baea5692c3b9753f9069511c7/scp1000_product_family_specification_rev_0.08.pdf
 

Attachments

westaust55

Moderator
About to go out so do not have time to investigate fully but here are a couple of comments:
1. Try writing $00 to the operation window before writing $03.
This stops operation before a mode change (see datasheet 2.2.2.1)

2. Instead of PAUSE 45 extend the period to say PAUSE 55.
The datsheet suggests a minimum period of 50 ms required. (2.2.2.1)

3. for now remove the PAUSE 10 in the waiting for data ready loop.
Not sure how long to generate the next pressure data but if you wait too long, the new reading overwrites the old data, the rrro bit is set and the reading you take may have corrupt data


The data uses two registers: one is 8 bits (MSB), the other is 16 bits, you are only reading the lower 16 bits for now but should still see something other than $FF in each byte.

The Slave address %00100010 is correct
When the datasheet mentions $11, they are only talking about the upper 7 bits which is fairly obvious if you look at the waveforms in the datasheet.
 
Last edited:

Boondocker

New Member
Westaust55,

Thanks for helping a novice on the datasheet. Made the suggested changes and still getting the 65535 result.

Also tried the different modes and reading TempOut instead, verified 3 volts feeding the sensor, checked the resistance on the pull-ups (4.6K); no joy.

Next going to let the project rest for awhile, then review the pinouts and circuits again for errors.

Code:
'18X  Program for barometeric pressure
'i2c SCP1000D11 Sensor
'Slave address  %00100010



symbol DRDY=input1  		' Data Ready from sensor	

Symbol TempOut = %10000001    ' 0x81 Raw Temperature, 16 bit retrive
Symbol DATARD8 = %01111111    ' 0x07 Raw Pressure, 8 bite read
Symbol DATARD16= %10000000    ' 0x80 Raw Pressure, 16 bite retrive  




symbol Mode = %00001010      ' 0x0A- High Resolution, continue
'symbol Mode = %00001001     ' 0x09- High Speed,continue
'symbol Mode = %00001011     ' 0x0B- Ultra Low Power, Continue
'symbol Mode = %00001100     ' 0x0C- Low Power, Trigger

'---------------------------Initialize------------------------------------------
Pause 500

I2cSlave %00100010, I2Cslow, I2Cbyte  'selects i2c device, set clock speed,  word
I2cwrite %00000011,(%00000000)        'Stops the active mode, prepares to reset 
Pause 55
I2Cwrite %00000011,(Mode)             'sets mode in operation address 0x03
Pause 55

'--------------------------Main------------------------------------------------


Rdyck:				        'Data Ready Check	
  If DRDY=1 then Press
  Goto Rdyck

Press:

I2cSlave %00100010, I2Cslow, I2Cword

I2cRead DATARD16,(b1,b0)
SerTxd( "Raw Reading = ", #w0, CR, LF ) 

Goto Rdyck



							'raw /4 = Pa
							'1 inHg60 °F = 3,376.85 Pa 
						


End
 

westaust55

Moderator
As best I could see from the slightly oblique photo, the wiring was correct and in accordance with the datasheet.

Now here is a potential issue.

I do see that you have resistors to the 3V supply for i2c pull-up.
As the PICAXE i2c lines are open collector should not have cooked the pressure sensor but ultimately not ideal.

Are the pull-up resistors 4.7 kOhm? Should work okay at that value.
(I am using 4.7 kOhm on both the 3.3V and 5V side of the i2c comms for a project I am currently working upon.)

What voltage are you operating the PICAXE at?

Try operating the PICAXE at 3V as well.
If that works then you may need to incorporate some form of buffer on the i2c comms between the 3V and 5V devices.

The data ready pin should be okay as the 3V high is generally high enough for a PICAXE input.
Ah will check if the input 1 is a schmidt trigger input - that could be a cause of problems . . .
 
Last edited:

hippy

Technical Support
Staff member
Can you post a complete circuit diagram of what you have. I've no idea what that transistor / voltage regulator is on the breadboard or what voltage you are running your PICAXE from.

Added : As westaust55, says; beat me to it !
 

Boondocker

New Member
The Pixaxe is currently on a 5v supply off a PH Anderson project board.
78L33 is used to step down the voltage to 3v. Used 4.6K pull-up reisistors instead of 4.7K because they were at hand. Made the diagram in VSM and includes layout of the major components to match the photo.

Made an error in the drawing, Drdy in on IN1 pin.
 

Attachments

Last edited:

hippy

Technical Support
Staff member
I appreciate it's probably a 'thrown together' job just to give a circuit for forum members to see, but there are numerous errors on it which doesn't make it that useful.
 

Boondocker

New Member
Updated the diagram by correcting the volt in/out on the 78L33, drawing proper wire connections, change C2 to 0.1u, and showing how the 18X is actually place on the project board with it's power supply.

Hippy, my apologies for posting a poor circuit diagram. I hope this one will allow you to help troubleshoot.

Thanks,

Boondocker
 

Attachments

westaust55

Moderator
Suggest that you add a tantalum type capacitor to the 3V output side of the voltage regulator feeding the pressure sensor.

For example, HOPERF suggest a 4.7uF capacitor for their pressure modules.
Another manufacturer recommends 47uF. With my HopeRF HP03S module, I have gone the way of a 47uF tantalum.
 

MartinM57

Moderator
I'd certainly be researching interfacing 3.3v i2c (sensor) to 5v i2c (PICAXE) - I have no experience I'm afraid, tending to keep things simple with 5v or 3.3v throughout. Maybe try, as suggested earlier, running the PICAXE at 3.3v...

Also, although you're not reporting poblems, your download circuit is incorrect - there is a missing earth at the diode/10k jucntion.

Your circuit diagram looks OK otherwise (apart from the maybe missing cap). It is a bit hard to follow to be honest - it is almost entirely upside down and right to left ;) Normal convention is to have positive voltages at the top and ground at the bottom, and for power supplies to have the input voltage at the left and output voltages at the right.
 

westaust55

Moderator
bi-directional i2c level shifter

Unless you have other components that cannot function at 3.3V (for example a DS1307 RTC which only works down to 4.5V min) suggest that you do first try with the PICAXE at 3.3V – otherwise you are adding more components to a circuit before initial problem is solved. If that works, then yes add the MOSFETS to enable the PIACXE to operate at 5V.

That Sparkfun schematic concept is taken from a 1997 Philips i2c Application Note and is the same arrangement that I am currently using for 4.5/5V to 3.3V with a single 2N7000 MOSFET transistor per line.

Do a search for AN97055 “Bi-directional Level Shifter for i2c-bus and other systems”
 

Texy

Senior Member
It would be easier to move the project over to the newly released 20X2 chip, which has a much wider operating voltage - I don't think the 18X is spec'ed as low as 3v3.

Texy
 

MFB

Senior Member
I have found the 18-X to operate reliably from 3 volts, even whilst running at 8MHz. This included the use of 3 volt EEPROM at an I2C fast clock rate of 800KHz.

It would be really good if you do manage to get this useful pressure sensor to work and are able to post the results. SparkFun only sell the SPI version and give PIC assember example code.
 

MFB

Senior Member
Sorry, that should have been 1 MHz FRAM not 'EEPROM'. The latter has a longer write time of about 5mS.
 

westaust55

Moderator
I have found the 18-X to operate reliably from 3 volts, even whilst running at 8MHz. This included the use of 3 volt EEPROM at an I2C fast clock rate of 800KHz.
Likewise, I am running an 18X at 3V directly with a HP03 pressure sensor without problems.
Have a second 18X at 4.5V with HP03S at 3.3V and using two FETS for the i2c interface.
 

MFB

Senior Member
It also proved possible to program the 18X whilst operating from a 3 volts supply. Even allowing for the fact that I'm using an RS-232 derivative that only swings over the +/- 5 volt range, this was a pleasant surprise.
 
Top