Shop OBEX P1 Docs P2 Docs Learn Events
Evaluating a set of readings on the fly - techniques wanted. — Parallax Forums

Evaluating a set of readings on the fly - techniques wanted.

stamptrolstamptrol Posts: 1,731
edited 2013-11-26 04:55 in General Discussion
Hi folks,

I've got a controller project on the go where I measure the weight of a truck and trailer as it drives onto a weighscale.

As it comes on at low speed, I get about 200 readings as the weight builds up from zero to the full weight of the assembly.

I'm interested in picking out two particular weights: first, I want to grab the weight of the front axle of the vehicle. If you plot the weight build up (y) versus time (x) on a graph, this appears as a definite horizontal segment.

As the vehicle continues on, there is a small blip as the first drive axle gets on the weighscale and shortly after the second drive axle comes on there is another horizontal segment, which I want to grab.

Right now, I'm using a rolling average of 5 readings to predict when the horizontal segment has been reached. That works reasonably well.

Any thoughts on a better way to calculate a trigger point to see these transitions? Sort of like doing a dx/dy to generate a nice sharp spike when there's a sudden, significant change in weight. There is a lot of variability in the x-direction depending on how fast the truck comes on the weighscale.

I've attached a typical roll-on curve.

Tom Sisk

Comments

  • SRLMSRLM Posts: 5,045
    edited 2013-11-25 08:05
    Can you post a pdf or an image of the graph? It doesn't show up for me.

    Also, can you post a CSV with the x,y's of an example reading?
  • stamptrolstamptrol Posts: 1,731
    edited 2013-11-25 08:43
    Please see attached scan.
  • Mark_TMark_T Posts: 1,981
    edited 2013-11-25 11:39
    The peaks on a histogram should show you where the level sections are, you just need to keep track
    of these peaks and detect when a new one starts up (then the previous peak can be deemed
    recognised and its value averaged?) The art will be choosing the right bucket-size for the
    histogram and dealing with the case a peak falls on bucket-boundary. That data looks pretty
    clean at least!
  • stamptrolstamptrol Posts: 1,731
    edited 2013-11-25 12:48
    I've got it to the point I can find the level section by doing a moving, 5-reading average then comparing to the previous 5-reading average value. Gives a pretty satisfactory go/no-go indication.

    The challenge is to do it in a Stamp-type processor on the fly where it takes about 100 readings for an average vehicle to get fully on the deck. Time-wise, it means gathering the 100 readings first, then processing them.

    Nonetheless, an interesting project.

    Cheers,
  • skylightskylight Posts: 1,915
    edited 2013-11-25 15:08
    It never ceases to amaze me the clever ways people come up with to solve everyday problems using the Parallax controllers. Good luck with your project
  • FranklinFranklin Posts: 4,747
    edited 2013-11-25 21:14
    Tom, if you can find the flats with the stamp why not just record the weight at the flats? Are you having trouble keeping the 10 samples you are running the average on or is it the average you are having trouble with?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-11-25 21:17
    Mark_T wrote:
    The peaks on a histogram should show you where the level sections are,
    Ditto. You have a multimodal distribution of weights with three key peaks. Locating those via a histogram is your key to a solution here.

    -Phil
  • stamptrolstamptrol Posts: 1,731
    edited 2013-11-26 04:55
    Thanks for all the suggestions. I now have a working algorithm which gives a transition indicator early enough to allow some settling time before grabbing the "official" weight.

    The critical issue is seeing the transition as soon as possible so the ringing subsides before taking the true weight measurement. This has to occur before the next transition.

    Thanks again. Cheers.
Sign In or Register to comment.