Interfacing with max187

I am working on a project that uses a pressure sensor. So far, I have used the pressure sensor (Motorola/Freescale mpx4115ap) connected to an analog port on the Arduino NG. This worked ok, but since the 10-bit adc, I decided to start using an MAX187 12-bit adc to get better resolution. For an electronics Noob, this is quite an adventure.

I need some help to get started. I take it that I need to use a digital input and can use digitalread() to gather data. So far, I read that digitalread() just returns HIGH or LOW. When I used the pressure sensor with on an analog port, I just got a number that I could work with. Now it seems that I have to take some HIGH and LOW values to come to a number.

I don't see how to do this. Anyone who can help?

Thanks in advance!

Jan-Dirk

The MAX187 is a serial A/D: the values that it samples get sent to the processor (Arduino) encoded in as serial data.
The serial interface it uses is SPI.. search that in the search window above.

You'll need to figure out
-the hardware connections, and then

  • write the code to read the serial data in the Arduino.

Normally you would connnect this chip to the SPI pins, but if you look at page 11 of the datasheet, it tells you how to request a sampling, and then how to shift out the data from the chip, at any rate from something like 0 to 5Mhz.

So, in theory you could:

  • use one (digital) pin to select the chip,
  • use another to sense when the A/D sampling is finished,
  • use a third pin to supply a clock signal to "shift out" the sampling result data, and
  • use another pin to read the resulting data.

Or you could just search for SPI above. :slight_smile: Beware that this kind of thing could be headache-inducing for someone new to electronics. REad the bottom part of this post on SPI to get started on that migraine. Or it might be really easy, who knows?

Thanks Daniel,

That is a start... I have taken your note in the thread about SPI problems!

  • use one (digital) pin to select the chip,

This seems to be the easy part

  • use another to sense when the A/D sampling is finished,

Any hints on how to do that? Edit: I mean, how to 'sense when the A/D sampling is finished'.

  • use a third pin to supply a clock signal to "shift out" the sampling result data, and

I need also a hint for this.

I hope I won't regret starting with this.... lol

Beware that this kind of thing could be headache-inducing for someone new to electronics. REad the bottom part of this post on SPI to get started on that migraine. Or it might be really easy, who knows?

Heh. That's my post. Once I got past the little problem with the board, SPI wasn't too bad.

I'm not exactly new to electronics, but I am new to SPI. Here is the thing that caused me problems:

SPI has four modes determined by two parameters, clock polarity (CPOL) and clock phase (CPHA). The standard doesn't really specify which to use, so different vendors come up with different ways of doing it. Of course #4 was the one that finally worked for my device.

The tutorials page http://www.arduino.cc/en/Tutorial/HomePage has intros to using SPI on a couple of peripherals. That's what I used to get started. Once I get the code cleaned up a bit I plan to post my code for the DS1722 to the playground, since it's a bit different than the other two devices in the tutorials.

Oh yeah, and if you have an Arduino NG you'll either need to remove the LED or relocate R13 before the standard SPI pins will work (specifically the clock). You should be able to use SCK from the ICSP header, but I haven't tested that one (and I've already modified my board so I can't test it).

I suspect that if you used a different pin for the SCK you'd have to bit-bang SPI instead of using the ATmega's built in hardware, and that might not be fun.

I got interested in the Arduino because of SPI - there are lots of peripherals out there with SPI interfaces. I've seen digital pots, temp sensors, FAT filesystem controllers with SD/MMC interfaces, UARTs, thermocouple interfaces, digital IO interfaces (add an extra 28 IO lines to your project), etc. My personal goal is to talk to a direct digital synthesis chip (Analog AD9954) to directly generate RF signals on the 2m ham band.

Don't forget, you can put the ATmega into slave mode and talk to it with another ATmega via SPI.

It's a bit complex, but it's too cool not to try. (:

-j