Shop OBEX P1 Docs P2 Docs Learn Events
SCP1000 Engine - cleaned up the code some — Parallax Forums

SCP1000 Engine - cleaned up the code some

FranklinFranklin Posts: 4,747
edited 2007-06-26 02:40 in Propeller 1
I don't know if this will be of use to anyone but here it is. I used the code at the VTI site, the code at SparkFun and the work Sharpie and Beau Schwabe had already. The demo code will display the data from all three devices on one page so you can see the differences ( I noticed the SCP100's temperature was higher than the other two ) Hope someone can use it. If I stepped on anyones toes by reusing code I'm truly sorry.

edited-- Can someone look at the code and see if I did something wrong or if the scp's temperature is just not accurate? Thanks

edited-- Some of you that looked at this couldn't find the SPI Engine code written by Beau Schwabe so I asked him if I could include it here and he agreed so it is now attached.

edited-- Changed code a bit and cleaned it up.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

Post Edited (Franklin) : 6/26/2007 2:40:09 AM GMT

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-06-01 18:39
    Was the scp1000 code helpful to anyone? I'd like to know if it worked for anyone else or if no one is using the scp1000.
    Thanks,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • FranklinFranklin Posts: 4,747
    edited 2007-06-09 15:53
    Added Beau's SPI Engine code for those that could not find it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • sharpiesharpie Posts: 150
    edited 2007-06-10 08:06
    Franklin, I'm glad your doing something with the scp1000... My project that involves it is currently on hold, but I plan on checking out your code as soon as I can. It will certainly be useful in due time for me, I plan on using it in a device I take flying with me that helps determine things like how much runway is required at a certain altitude and temp, etc... Could save a life someday =)
  • APAP Posts: 24
    edited 2007-06-12 16:12
    Franklin - with your SCP1000 I was getting pressure values around 60_000. This doesn't align w/ Pascal units, or millibar * 1000 or anything like that. I was confused.
    I checked your ReadPressure code against example code from sparkfun.com. The only change I made that I remeber explicitly right now is below. I'm at work, so when I get home tonight I'll send you my edited version of your code. I also added some initialize code commands.

    PUB ReadPressure : Value
    Value := ReadDirect($1F, 8) ' correct, this is the proper reading of most significant 3 bits of pressure.
    Value &= $07 <
    change to %111
    Value <<= 16
    Value |= ReadDirect($20, 16)
    Value >>= 2

    I'll post the edited code when I get home.

    The end result is I was getting Pressure in Pascals - around 101_325. I went further and measure 30 samples (at about 1.5 Hz) with unit on my worktable, then raised the elevation of my breadboard setup by about 1 foot and collected another 30 measurements. In Excel, calc'd mean of both populations, I don't recall the deltaP in pascals, but I plugged it through an altimeter formula from wikipedia.org (search "altimeter"), which told me the difference in altitude was about 0.4 meters (pretty darn close!!)

    details tonight.
  • APAP Posts: 24
    edited 2007-06-12 16:41
    Anyone interested in I2C version of SCP1000 as a breakout board with 0.1" spaced header pins???

    People seem to be·struggling confused.gif·w/ SPI communication version of the SCP1000 baro sensor.· Digikey carries the I2C·version for about $22, and I do surface mount contruction at home (photoresist PCB creation, solder paste stencils, reflow).

    I am more than willing to construct a few·breakout board versions·of·these with 0.1" space header pins, similar to sparkfun.com. I don't plan on going into business on this or make profit. I would just want cost+shipping+maybe $10 for my time, around $40/unit. I would do it to help out fellow hobbyist get their projects off the ground. Maybe sparkfun.com will start making the I2C breakout version, but they don't sell that right now.

    Attached is example of my surface mount skill: a "Stamp" version of the propeller QFN chip I made about 4 months ago.



    Dean
    1024 x 768 - 332K
    1024 x 768 - 324K
    1600 x 1200 - 490K
  • FranklinFranklin Posts: 4,747
    edited 2007-06-12 21:56
    I'll look at my readings tonight. It may be that using $07 isn't the same as $7 (I'm used to 0x07 as a hex 7)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-06-12 22:15
    Attopilot, could you providea few details on your stencil, is it just etched copper? Do you etch double sided or attach to a substrate?

    Graham
  • APAP Posts: 24
    edited 2007-06-13 04:22
    Is there a way to split this off to another thread? I'm new to the forum.

    Short answer: Yes copper, double side photoresist patterned then double side etched in Ferric Chloride.

    Long description: Copper (1/2 ounce/ft^2, maybe 5 mils thick) is double-side etched, no substrate. I got the sheet copper from onlinemetals.com, big huge roll of it for about $40. I scrub the copper with clean cotton cloth and baking soda/water slurry, rinse in hot water, dry with blow dryer, then in "red lit" dark room hold copper by corner with pliers, warm with hair dryer on low, spray one side with Datak ER-71 negative photoresist, allow to dry a minute, reheat copper and spray the other side. It's kind of hard to get uniform coating without runs on one hand, or incomplete coverage on the other hand - this is the hardest part. Trying to re-spray a 2nd coat always causes runs for me. Next step is to sandwich the coated copper between two mirror-image transparencies, which I print on a slightly modified HP photosmart 7850 inkjet at 1200 dpi. The transparencies are aligned to each other, ink (fully dried!) on the inside, by laying them on each other over white paper, and I tack them together at one edge with medium CA glue. It takes a bright light and 10x jeweler's loup to make sure the transparecy images are aligned perfectly for the tiny dots that define stencil holes on thermal pad of a QFN package. The sandwich of transparency/copper/transparency is clamped between two clean glass panes, exposed 15 minutes per side 4" under a fluorescent UV bulb.

    The subsequent develop and etch steps are tricky in that you MUST NOT let either side of copper touch bottom of container. I use 1/4"x1/8" balsa sticks with a thin slot cut in the side of the stick, and slide the sticks onto two opposing sides of the copper, like making a picture frame. I the develop the exposed resist in Datak ER-8 for 1 minute, then float the balsa/copper assembly in Ferric chloride etchant, warmed to about 120 F. The important thing is that the assembly floats on the top of developer and etchant, so you do have to carefully flip it over with a plastic fork a few times (fork only touches the balse frame).

    This sounds like a pain and lots of work, but I believe I get faster turn-around for quickie prototypes versus sending an Eagle design to some shop, plus I have 100% containment of intellectual property of my designs/projects.
  • APAP Posts: 24
    edited 2007-06-13 05:38
    I modified these two PUB methods in Franklin's code:

    PUB ReadPressure·· : Value············· ' units are Pa - 101305 = 760 torr
    ··· Value := ReadDirect($1F, 8)········ ' MSB 3 bits of pressure
    ··· Value &= %111··························' Maybe this doesn't matter, as $07 should be equivalent to %111
    ··· Value <<= 16
    ··· Value |= ReadDirect($21, 16)······· ' LSB 16 bits of pressure·· ' Typo - old code had $20
    ··· Value >>= 1······························ ' only need to shift by 1, not 2

    PUB SCP_init····· ''SCP1000 startup and configuration section
    ··· outa[noparse][[/noparse]CSB] := low
    ··· wait_ms(200) 'wait 200ms for startup (no power mgmt, no startup status)
    ··· 'set low noise configuration
    ··· WriteIndirect($02, $2D)·················· ' I added two more setup commands for the low noise configuration , per sparkfun.com's code example
    ··· wait_ms(100)
    ··· WriteIndirect($01, $03)
    ··· wait_ms(100)
    ··· WriteIndirect($03, $02)
    ··· wait_ms(100)
  • APAP Posts: 24
    edited 2007-06-13 05:46
    Oh - just realized your original post was asking about proper temperature values. I'm not sure about that - I was only concerned about the pressure data for now. I'm sure the answer could be found in either sparkfun's code example or the product data sheet available from digikey.com:

    http://www.sparkfun.com/commerce/product_info.php?products_id=8161 download link called "Example PIC Code" near bottom of page.

    Or here:
    http://www.vti.fi/midcom-serveattachmentguid-cc8aee01c2fdb69696289d17b704d3d8/SCP1000_Product_Family_Specification_rev_0.07.pdf
  • FranklinFranklin Posts: 4,747
    edited 2007-06-26 02:40
    OK, I cleaned the code up a bit. It works for me and gives me correct pressure values as close as I can tell. Temperature seems to be off a bit though. Let me know if it works for you, Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.