Using SPI for pressure sensor

This forum is for posts that might be considered off-topic but that may be useful or interesting to members. Examples include posts about electronics or programming in general, other microcontrollers or interesting devices, useful websites, etc.
mikep
Posts: 796
Joined: 24 September 2005, 15:54 PM

Post by mikep »

For those of us who don't use ExpressPCB, I made a PDF of the schematic.

I also corrected one of the ground signals so it pointed down instead of up and disconnected the 1/OE ground on U1 because it is not being used.
Attachments
Altimeter.pdf
(19.71 KiB) Downloaded 3390 times
Mike Perks
victorf
Posts: 342
Joined: 01 January 2006, 4:08 AM
Location: Schenectady, New York

Post by victorf »

:oops:

I sent the wrong schematic. I have actually put the resistors where you showed them on your schematic. Sorry about that.

Regardless, adding the resistors made NO difference. The circuit behaved as I reported in my last post. Any ideas?

As always, any enlightenment will be appreciated.

Vic
Vic Fraenckel
KC2GUI
windswaytoo ATSIGN gmail DOT com
victorf
Posts: 342
Joined: 01 January 2006, 4:08 AM
Location: Schenectady, New York

Post by victorf »

Mike wrote:
For those of us who don't use ExpressPCB, I made a PDF of the schematic.
It never occurred to me about the format of the schematic. Is PDF the preferred format here? If so, I will convert to PDF in the future.

Vic
Vic Fraenckel
KC2GUI
windswaytoo ATSIGN gmail DOT com
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

victorf wrote:Is PDF the preferred format here?
It is true that using a PDF or a standard image format (e.g. JPEG or GIF) makes it easier for those that want to look at your schematic. If you have a single page schematic and you have a PDF print driver installed it is easy to make a PDF. There are several free print-to-pdf conversion programs available that allow you to convert to a PDF virtually anything that is printable from within any Windows app.
- Don Kinzer
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

victorf wrote:adding the resistors made NO difference.
I suppose that it is possible that the 74AHC125 has been damaged. I don't have one on hand at the moment but I tested the suggested configuration with a 74HC125 and it worked as expected.
- Don Kinzer
victorf
Posts: 342
Joined: 01 January 2006, 4:08 AM
Location: Schenectady, New York

Post by victorf »

He's BACK :)

I have replaced the original 74HC125 (U1) with a brand new IC. My test setup is an altimeter board with U1 and U2 installed along with the LM3940, 3.3v regulator. The Breakout board is NOT installed and J1 has nothing connected to it. 5v (actually 4.96v) is provided at J2 and a jumper is installed on JP1. JP1 is there so I can easily make current measurments. U1 is marked CD74HC125E and U2 is marked M74HCT125B1. U1 and U2 is installed

First, I remove U1 and apply power to J2. I measure 3.5v at pin 14 of U1. If I put 5v on pin 3,4 and 5 of J1, I measure 5V at U1-9, U1-12 and U1-5 respectively. U1-14 remains at 3.5v.

Second, replace U1 and apply power. No connections to J1. Here are the results:

U3 out 3.4V

DRDY 3.3v to 5v

BO1-1 0.96v
U2-12 0.96v
U2-11 2.79v
J1-2 2.79v

MISO 3.3v to 5v

BO1-3 0.83v
U2-9 0.83v
U2-8 2.89v
J1-1 2.95v

CSB 5v to 3.3v

J1-3 1.07v
U1-9 0.83v
U1-8 2.29v
BO1-2 2.07v

SCK 5v to 3.3v

J1-5 1.11v
U1-5 0.83v
U1-6 1.78v
BO1-5 1.98v

MOSI 5v to 3.3v

J1-4 1.18v
U1-12 0.81v
U1-11 1.91v
BO1-4 1.90v


Third, With both U1 and U2 installed and 5v on J1-5 (SCK). Here are the results:


U3 out 4.2V

DRDY 3.3v to 5v

BO1-1 0.62v
U2-12 0.62v
U2-11 3.18v
J1-2 3.22v

MISO 3.3v to 5v

BO1-3 0.65v
U2-9 0.62v
U2-8 3.33v
J1-1 3.28v

CSB 5v to 3.3v

J1-3 0.71v
U1-9 0.63v
U1-8 3.61v
BO1-2 3.46v

SCK 5v to 3.3v

J1-5 4.96v
U1-5 4.36v
U1-6 3.65v
BO1-5 3.43v

MOSI 5v to 3.3v

J1-4 0.98v
U1-12 0.54v
U1-11 3.08v
BO1-4 2.82v

Similar results occur when the 5v is applied to J1-4 or J1-3.

I am at a loss to understand these results.

I have attached a zip of the schematic and PCB (as PDFs).

Any further enlightenment will be appreciated.

Vic
Attachments
Altimeter.zip
Altimeter Schematics and PCB as PDF
(41.35 KiB) Downloaded 3431 times
Vic Fraenckel
KC2GUI
windswaytoo ATSIGN gmail DOT com
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

I would suggest breadboarding the converter circuit to confirm its operation. I have attached a schematic of a test configuration. When the switch connects 5 volts to the resistor, the output on pin 3 should be 3.3 volts. If this works (as it does here) the next step is to determine how your printed circuit board is different from the test setup.
Attachments
5-3_conv.jpg
5-3_conv.jpg (15.15 KiB) Viewed 7850 times
- Don Kinzer
victorf
Posts: 342
Joined: 01 January 2006, 4:08 AM
Location: Schenectady, New York

Post by victorf »

Don,

Thanks for the suggestion. I notice that you refer to a 74AHC125 and I am using a 74HC125
U1 is marked CD74HC125E
on my PCB. What is the difference between the two? Perhaps that is the cause of my problem :?:

Vic
Vic Fraenckel
KC2GUI
windswaytoo ATSIGN gmail DOT com
victorf
Posts: 342
Joined: 01 January 2006, 4:08 AM
Location: Schenectady, New York

Post by victorf »

Don,

I ran the test as suggested in your last post. Here are the results:

V5V = 4.96v

first with a 4.7k resistor:

SW 0.0v
U1-2 0.06v
U1-3 0.58
V3.3 3.32v

SW 4.96v
U1-2 3.64v
U1-3 2.91v
V3.3 2.95v

with 10k resistor

SW 0.0v
U1-2 0.08v
U1-3 0.58
V3.3 3.16v

SW 4.96v
U1-2 3.71v
U1-3 3.01v
V3.3 3.03v

I am generating the 3.3v with a 3940 regulator driven by 5V and configured in accordance with it's data sheet as per the schematic. I am surprised that the voltage does not seem to be regulated very well. The 2940 providing the 5V and driven by 12v seems to regulate well. I thought these regulators are LDO and should work well with a voltage difference of 5 - 3.3 = 1.7v. Am I wrong about this?

Any further enlightenment will be appreciated.

Vic
Vic Fraenckel
KC2GUI
windswaytoo ATSIGN gmail DOT com
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

victorf wrote:I thought [the 3940] regulators are LDO and should work well with a voltage difference of 5 - 3.3 = 1.7v. Am I wrong about this?
The datasheet for the LM3940 suggests that it is designed specifically for generating 3.3V from a 5V source. The data points that you've shown suggest that the limiting resistor should be larger. You might try 47K, 68K and 100K. The potential problem with the larger resistance values is the voltage drop across the resistor due to the input leakage current - less than 1uA according to the datasheet.

The primary difference between the 74HC and 74AHC series gates is the propagation delay. There may also be differences in the input switching thresholds. I've seen the 74AHC125 recommended for 5V to 3.3V signal conversion applications. I haven't analyzed whether the 74HC125 would work equally well or not.
- Don Kinzer
victorf
Posts: 342
Joined: 01 January 2006, 4:08 AM
Location: Schenectady, New York

Post by victorf »

Would this get the job done? The author says that the scheme is bi-directional.


http://delphys.net/d.holmes/hardware/levelshift.html

Seems like a lot better way to do the level shifting. The MOSFETs are cheap and so are the resistors.

Any enlightenment will be appreciated.

Vic
Vic Fraenckel
KC2GUI
windswaytoo ATSIGN gmail DOT com
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

victorf wrote:Would this get the job done?
That's an elegant way to solve the problem of bidirectionality. The Philips application note gives technical details of how the circuit operates.
- Don Kinzer
spamiam
Posts: 739
Joined: 13 November 2005, 6:39 AM

Post by spamiam »

It also solves the 3.3V to 5V I2C bus issue I posted in another thread!

-Tony
victorf
Posts: 342
Joined: 01 January 2006, 4:08 AM
Location: Schenectady, New York

Post by victorf »

Tony,
It also solves the 3.3V to 5V I2C bus issue I posted in another thread!
This use is the topic of the Phillips Application note AN97055 found here:

http://www.standardics.nxp.com/support/ ... n97055.pdf

Vic
Vic Fraenckel
KC2GUI
windswaytoo ATSIGN gmail DOT com
kranenborg
Posts: 57
Joined: 27 July 2009, 14:20 PM
Location: Groningen, The Netherlands
Contact:

Post by kranenborg »

Hello,

Considering the software part of the problem (SPI interface code to read temperature and pressure data from the SCP1000) as discussed in this thread: I have added a working test program (strongly based on Don Kinzer's code as presented in this thread) in the "Files" section of the ZBASIC forum: http://www.zbasic.net/forum/about1306.html. Test set-up was a ZX-328L + SparkFun's SCP1000 breakout board (SPI variant).

This is part of an effort to build a simple water rocket (being built by my eldest son) altitude measurement system based on a pressure-based altitude model as described in the Wiki link in this thread. We will report this summer as this is a perfect holiday season project!

/Jurjen
Post Reply