Shop OBEX P1 Docs P2 Docs Learn Events
Calculus and STAMPS — Parallax Forums

Calculus and STAMPS

TGTG Posts: 36
edited 2006-08-07 16:57 in BASIC Stamp
I want to use a STAMP and accelerometer to calculate speed. I need to integrate the g-force to go from meters/second squared to meters per second. Has anyone done integration with a STAMP and if so I would appreciate some input.
Thanks
Toby

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-08-06 17:35
    The think you might want to look at the Propeller. It has 32bit floating point math and log charts in ROM.
    The BS has always been an 8 bit machine and it really prefers math that is close to the machine level, mostly integer counting.

    The Propeller has 8 parallel processors and can run much faster than the BS. It also is cheaper at $25 for the 40PIN dip version.
    SPIN is an easy language.

    IMHO, I don't think you could do much better with· competators' products. The AVRs and such are 32bit with a 8bit I/O, slower clocking, and no parallel processing. Plus the language and their architecture is more complex.

    I am begining to wonder why anyone would want to buy a BasicStamp if they understand the choices and the greater value. About the only reason for staying with the BS is that the Propeller is a 3.3volt device.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • TGTG Posts: 36
    edited 2006-08-07 00:06
    Thanks, you bring up some good points. My question is still out there. How to integrate? Can it be done easier with a propeller?
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-08-07 00:26
    Yes, you can "integrate", with some limitations.

    "Pure" integration assumes that the 'slices' you take in your function are infinitely small. In reality, your Delta-T for a BS2 is going to be some small fixed number -- like 100 mSec. So instead of adding up a bunch of dv/dt, you'll be adding delta-V / 100 mSec.

    Now, this also assumes you have "accurate" time -- which the BS2 doesn't really give you. So your answer is going to have some 'slop', unless you add a co-processor to give you true 50 mSec (or 100 mSec) 'ticks' to go by.
  • Mike GreenMike Green Posts: 23,101
    edited 2006-08-07 01:01
    It all depends on the time slice. It takes a certain amount of time to read the accelerometer and that time varies depending on the actual current acceleration (the pulse widths vary). The Stamp processors don't have an absolute time reference. They can time pretty accurately if they're doing nothing else (with the PAUSE statement), but that's all in any practical way. If your time slice is large compared to all this "work", the "jitter" will get averaged out over a number of time slices. Parallax's accelerometer can be read about every 10ms. If you need something like this dt, you should use something like a Propeller or SX. Both can keep absolute time and sample an accelerometer that quickly. The Stamp just isn't fast enough to do well anywhere near that rate.
  • TGTG Posts: 36
    edited 2006-08-07 02:05
    thanks guys I appreciate the input

    Post Edited (TG) : 8/7/2006 11:59:53 PM GMT
  • George99George99 Posts: 16
    edited 2006-08-07 16:57
    At the risk of being a thread hijacker
    Kramer said...

    ...I am begining to wonder why anyone would want to buy a BasicStamp if they understand the choices and the greater value...

    Once problem IS understanding the choices... I chose the BS2 because I wanted to get my feet wet in micro-controllers and one frequently mentioned product is the BASIC Stamp. An initial visit to the Parallax site gave me a confusing array of choices: BS1, BS2 along with its e, sx, p40, pe, px, p24, and JS1 variants. Then there were a bunch of robots and some sort of Propeller thing.

    I gave up trying to decide until I spotted the "What's a Microcontroller?" book and parts kit at Radio Shack. It looked like everything I needed to get started, so I bought it and had an LED blinking within 30 minutes of opening the package. I must be on the right track, my wife said, "$80 to make that light blink?!" shocked.gif
Sign In or Register to comment.