Shop OBEX P1 Docs P2 Docs Learn Events
Memsic 2125 Dual-axis Accelerometer = Dryer Machine Monitor — Parallax Forums

Memsic 2125 Dual-axis Accelerometer = Dryer Machine Monitor

Tony11Tony11 Posts: 41
edited 2013-01-28 15:04 in Accessories
Hi All

One Led, one Memsic 2125 Dual-axis Accelerometer and one BS2.

Is there A way with the Memsic 2125 Dual-axis Accelerometer sensor, to take and put the sensor on top of A dryer
with the BS2 and Led.

So data from the sensor would make the led
turn on or off, from the motion from the
dryer being on or off.

So if the dryer is on and moving, the led would be off.
So if the dryer is off and was moving, the led would be on.


The link= is what I am shooting for...



http://diy.viktak.com/2012/07/washing-machine-monitor.html?m=1

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-01-22 20:49
    Tony11 wrote: »
    Is there A way with the Memsic 2125 Dual-axis Accelerometer sensor, to take and put the sensor on top of A dryer
    with the BS2 and Led.

    The project you describe is very doable with parts you list.

    I doubt there's ready made code to do just what you want, but the Memsic product page has Basic Stamp 2 example code. You'll need to decide how much acceleration indicates the dryer is on and when this accerleration isn't present have the code turn on the LED.

    Do you already have a BS2? Have you tried the example Memsic code? Can you get the BS2 to turn on a LED?
  • Tony11Tony11 Posts: 41
    edited 2013-01-23 15:54
    What I am having A hard time with is making the Memsic, read the data when the dryer is running.
    Is there A way to take the (x and times it by 1000) and the (y and times it by 1000). The
    Memsic sensor needs to be more sensitive to the vibrations of the dryer moving.
    I think why, its not working well is because I am reading the tilt of the Memsic.
    How do I make code that will read the vibrations of the dryer moving...........

    Right now when I put this code in to the bs2 and run it.
    X = 2455
    Y = 2455

    Read the same if the dryer is running or not running.


    I have used this code.
    ' SimpleTilt.bs2
    ' Measure room temperature tilt.
    '{$STAMP BS2}
    '{$PBASIC 2.5}
    x              VAR     Word
    y              VAR     Word
    DO
    PULSIN 6, 1, x
    PULSIN 7, 1, y
    DEBUG CLS, ? X, ? Y
      PAUSE 100
    LOOP
    
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-01-23 18:25
    The only way I know of to increase the precision of the Memsic reading is to use a microcontroller that's able to detect smaller time differences.

    Do the x and y values change over multiple readings when the Memsic is sitting on a running dryer? You could try having the Memsic positioned on a bit of a tilt in order to include the vertical component of the vibration.

    How much do the x and y values change from one reading to the next when the dryer is off? How much do the x and y values change from one reading to the next when the dryer is on?If the change from one reading to the next is greater when the dryer is on, then you can use the difference between two subsequent readings as an indicator to let the program know if the dryer is on or off.

    BTW, it's easier to read code in the forum if you use code tags. Here's a link to Phil's tutorial on using code tags.

    attachment.php?attachmentid=78421&d=1297987572
  • Tony11Tony11 Posts: 41
    edited 2013-01-24 06:32
    When the dryer is running the
    only # that moves is the last one on the right.

    From X=2455 to Y=2456
    From Y=2455 to Y=2457

    The #'s move very little.

    If I could only make the #'s move a lot,
    then it would be easy.
    But I need A sensor that will read little movement.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-01-24 11:30
    Tony11 wrote: »
    When the dryer is running the
    only # that moves is the last one on the right.

    From X=2455 to Y=2456
    From Y=2455 to Y=2457

    The #'s move very little.

    If I could only make the #'s move a lot,
    then it would be easy.
    But I need A sensor that will read little movement.

    The Y value chages by two. Is this consistant? If so, it might be enough to do what you want.

    A faster microcontroller would probably be able to measure the pulse from the sensor with greater precision.

    There's also the option of using a different accelerometer.
  • Dave HeinDave Hein Posts: 6,347
    edited 2013-01-24 12:59
    I seems like it would be easier to detect when the dryer is on by using a microphone. If the microphone is attached to the dryer using double-stick tape the sound level should be quite high when its running.
  • Tony11Tony11 Posts: 41
    edited 2013-01-25 18:51
    ((There's also the option of using a different accelerometer.))
    So what other kind of accelerometer would work?
  • Tony11Tony11 Posts: 41
    edited 2013-01-27 09:49
    I guess what I am trying to do, is way tooooo hard. 154 people have looked at my post, and only 2 people have sent me A reply back. I am going to punt........

    Thank you two people for your help........
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-01-27 10:38
    Tony11 wrote: »
    I guess what I am trying to do, is way tooooo hard. 154 people have looked at my post, and only 2 people have sent me A reply back. I am going to punt........

    Thank you two people for your help........

    Duane Degn wrote: »
    . . . You could try having the Memsic positioned on a bit of a tilt in order to include the vertical component of the vibration.

    How much do the x and y values change from one reading to the next when the dryer is off? . . .

    Have you tried tilting the Memsic to see if you get a larger change in the readings?
    Duane Degn wrote: »
    The Y value chages by two. Is this consistant? If so, it might be enough to do what you want. . . .

    If you think you need a more sensitive accelerotmeter Sparkfun has "Buying Guide" that lists many of the properties of various acclerometers. If you purchase a different accelerometer (which I'm not sure is necessary), you might want to get one from Parallax in order to take advantage of their BS2 sample code.
  • kwinnkwinn Posts: 8,697
    edited 2013-01-27 10:44
    An op amp with a low pass filter to amplify the memsic signal should help. You could also use a comparator to get a square wave output.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-01-27 10:47
    kwinn wrote: »
    An op amp with a low pass filter to amplify the memsic signal should help. You could also use a comparator to get a square wave output.

    kwinn, The Memsic's output is a pulse length. It already is a square wave.
  • tingotingo Posts: 87
    edited 2013-01-27 11:50
    Question: why are you using the tilt example, and not the Motion detector example from the Memsic 2125 datasheet?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-01-27 12:29
    @kwinn, I do see mention of a low pass filter in the datasheet but I doubt noise is the problem in this case. I think the precision in this case is limited by the speed of the BS2.

    @tingo, Which datasheet are you looking at? I don't see a motion detector example in the datasheet I found on the product page.
  • ZootZoot Posts: 2,227
    edited 2013-01-27 13:37
    Have you tried turning the accelerometer on it's edge? It would seem that if it's flat you would need a Z-axis reading to get the "vibrations", but on edge, you might get a greater range of output from the X or Y axis.
  • tingotingo Posts: 87
    edited 2013-01-28 15:04
    Duane Degn wrote: »
    @tingo, Which datasheet are you looking at? I don't see a motion detector example in the datasheet I found on the product page.
    This pdf (second hit on Google).
Sign In or Register to comment.