Understanding how to develop an lookup algorithm


+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 15 of 36
  1. #1
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,676
    Thumbs Up
    Received: 47
    Given: 95
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default Understanding how to develop an lookup algorithm

    Hello....

    Today's problem I'm having is how to develop an algorithm to use on what could be a very large table with many data points.

    So let be back up and describe what I want to do.

    I need to very accurately measure a liquid level to < 1mm over a range of say 200mm

    For various reasons it will be float based. The option that seems to have most potential is using a magnet and a large number of hall effect sensors.

    This is a visualisation of the set up

    Click image for larger version

Name:	Hall effect level.jpg
Views:	12
Size:	5.4 KB
ID:	3392

    The signal I should get out of one of the sensors will change (as a % of VDD) from sitting at 50% then rising to say 80% as the magnet approaches then dropping past 50% as it comes in line and going to say 20% before rising back up to 50%

    This is the best image I can find of the expected wave form

    Click image for larger version

Name:	Hall effect signal.jpg
Views:	15
Size:	6.9 KB
ID:	3393


    In the implementation the whole set up will be calibrated by pumping in a fixed volume and taking a reading of all 30 sensors. Incrementing the volume a fraction and taking another batch of readings.

    As you can imagine it would be massive table. I am looking to find a way to shrink the table and actually use it. Most of the signals will be hovering around 50% as the magnet is out of range. Then you will get and range of + and - % readings as you approach the magnet.

    My thoughts were:-
    Look at what sensor is directly affected eg the magnet is producing the strongest signal level +/- of the 50% point then just focus on that signal and use a lookup for that HF chip. But as you can see there will be occasions when the signal could be very weak as the magnet crosses the middle point with the chips either side having much higher signal levels.

    So please do you have any tips on how to work out an algo to implement in my device?

    Thanks
    Tim

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,338
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    1.01 GB

    0 Not allowed!

    Default Re: Understanding how to develop an lookup algorithm

    Hi Tim,
    Cant help with the programming but could this be any help for the sensing?.
    https://thepihut.com/products/adafru...5f&fo_s=gplauk

    Bob

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,676
    Thumbs Up
    Received: 47
    Given: 95
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default Re: Understanding how to develop an lookup algorithm

    Hi

    Those e-sensors are unfortunately of no use. I am aware of them and looked into the accuracy etc. Not up to my requirments

    Thanks
    Tim

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,676
    Thumbs Up
    Received: 47
    Given: 95
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default Re: Understanding how to develop an lookup algorithm

    Its always good to make a post asking for help. In most cases just the act of writting the question gives the answer and I never bother to make the post.

    This is how I'm doing so far

    1 Scan the results looking for the sensors that are out side the mid point range eg 5,6,7,8,9,10
    2 Get the sensor that is in the middle eg 7
    3 Use the lookup table for sensor 7 to lookup the volume based on the calibration data
    4 If there is no middle sensor eg 7+8 then lookup the value for 7 and 8. They should be around the same as there will be an overlap then get the median of the 2

    Another method is to lookup the value of all the sensors that have a signal. Each sensor will have a level but the accuracy will be less on the outer ones. Add then div the result to get the median of them.

    The end result will mean you have to have a very large lookup but in reality the magnet is small and I only need to store the results for the section that actually has detected the magnet.
    Tim

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Prolific Poster normnet's Avatar
    Join Date
    Jul 2004
    Posts
    2,367
    Thumbs Up
    Received: 78
    Given: 45
    Total Downloaded
    1.39 GB

    0 Not allowed!

    Default Re: Understanding how to develop an lookup algorithm

    Could you position a 2nd magnet to be above the first to provide readings when the first is in-between? Perhaps it would need to be a distance above to avoid interfering with the first but would align when the first does not.

    Norm

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #6
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,676
    Thumbs Up
    Received: 47
    Given: 95
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default Re: Understanding how to develop an lookup algorithm

    Another system would be similar

    Scan the sensors for the first one that has a signal out side a set value of the middle eg 512 is the middle. So if < 500 and > 524
    Lookup the values for the sensors x number ahead of the first eg 7 is seen with a signal then 8,9,10,11,12.
    Get the median

    Now as I said it will be a big table but the chips with 30+ ADC's have a lot of Flash memory and I can flash the table into the memory during calibration.
    Tim

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #7
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,676
    Thumbs Up
    Received: 47
    Given: 95
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default Re: Understanding how to develop an lookup algorithm

    Hi Norm

    I'm not sure on the range the magnet will reach. The magnet will be say 6-8mm wide and 1 to 4mm tall. With that in mind I will place the sensors around 5-8mm apart so the magnetic field will extend across a number of sensors

    This is a good ref https://sensing.honeywell.com/hallbook.pdf

    I note that the sensor Bipolar slide-by mode (2) is classed as high accuracy. However the magnet arrangement is odd. I will be just using a one magnet, not a extended type using legs.

    I'm still waiting on comps so cannot try a few magnets out.
    Tim

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #8
    Prolific Poster normnet's Avatar
    Join Date
    Jul 2004
    Posts
    2,367
    Thumbs Up
    Received: 78
    Given: 45
    Total Downloaded
    1.39 GB

    0 Not allowed!

    Default Re: Understanding how to develop an lookup algorithm

    A digital vernier caliper is very accurate if a float could smoothly operate something similar.

    Norm

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #9
    Prolific Poster normnet's Avatar
    Join Date
    Jul 2004
    Posts
    2,367
    Thumbs Up
    Received: 78
    Given: 45
    Total Downloaded
    1.39 GB

    0 Not allowed!

    Default Re: Understanding how to develop an lookup algorithm

    Perhaps motorize a single hall effect sensor to increment vertically until aligned with the float by use of the hall sensor readings? Then take the hall sensor height reading by the method used on vernier calipers. I'm not sure if this would be easier than a massive lookup table however?

    Norm
    Last edited by normnet; 18th November 2017 at 23:23.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #10
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,232
    Thumbs Up
    Received: 75
    Given: 181
    Total Downloaded
    5.15 GB

    0 Not allowed!

    Default Re: Understanding how to develop an lookup algorithm

    Following on from Norms post. Do you even need the vernier? If going up and down a few times either side of the max you should end up with the accuracy of the stepper motor.
    George.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #11
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,676
    Thumbs Up
    Received: 47
    Given: 95
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default Re: Understanding how to develop an lookup algorithm

    After a bit more reading I think I now understand the way the magnet / H Effect sensor output will work.

    If you look at the picture you will see that the length of the magnet will dictate how long the signal will be in a usable range. The extra marks I made indicate the length of the magnet on the output.

    Click image for larger version

Name:	magnet length vers signal.jpg
Views:	22
Size:	11.9 KB
ID:	3394

    If in my case where I want to use a number of sensors, it can be seen that the magnet length needs to be > the spacing between the sensors. In the example shown in the link below they use a 10mm long magnet and space it at 7mm.

    With this in mind all I need to do in the code is work out which sensor is the one to read by looking at the others around it then use a lookup table to determine the position of the magnet/float. If the sensors are accurately located It could be that just 1 lookup table is needed and you just add an offset for the sensors location.


    http://www.allegromicro.com/en/Desig...ensor-ICs.aspx
    Tim

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #12
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,466
    Thumbs Up
    Received: 71
    Given: 29
    Total Downloaded
    6.08 GB

    0 Not allowed!

    Default Re: Understanding how to develop an lookup algorithm

    Very, very interesting Tim.

    One thing I am not sure about is the mechanical factor of how much free the magnet is going to move in that 1mm resolution you need
    Regards

    Joseph

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #13
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,676
    Thumbs Up
    Received: 47
    Given: 95
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default Re: Understanding how to develop an lookup algorithm

    Joseph

    There are 2 applications I need it in.

    The first is in a small tube ~10mm ID, so a 8-9mm dia magnet inside a capsule/float with an OD of ~9.8mm works great.
    The second is in a larger dia tube. But in that instance I will have the smaller tube inside the larger mounted to the edge. So the water volume will rise in both. The float will reflect the level in the larger tube.
    Tim

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #14
    Prolific Poster normnet's Avatar
    Join Date
    Jul 2004
    Posts
    2,367
    Thumbs Up
    Received: 78
    Given: 45
    Total Downloaded
    1.39 GB

    0 Not allowed!

    Default Re: Understanding how to develop an lookup algorithm

    Quote Originally Posted by Tim View Post
    After a bit more reading I think I now understand the way the magnet / H Effect sensor output will work.

    If you look at the picture you will see that the length of the magnet will dictate how long the signal will be in a usable range. The extra marks I made indicate the length of the magnet on the output.

    Attachment 3394

    If in my case where I want to use a number of sensors, it can be seen that the magnet length needs to be > the spacing between the sensors. In the example shown in the link below they use a 10mm long magnet and space it at 7mm.

    With this in mind all I need to do in the code is work out which sensor is the one to read by looking at the others around it then use a lookup table to determine the position of the magnet/float. If the sensors are accurately located It could be that just 1 lookup table is needed and you just add an offset for the sensors location.


    http://www.allegromicro.com/en/Desig...ensor-ICs.aspx
    Makes sense. Gap issue resolved.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #15
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,676
    Thumbs Up
    Received: 47
    Given: 95
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default Re: Understanding how to develop an lookup algorithm

    Ok so an update.

    I received some hall effect sensors and a few magnets. Wired them up and did some testing.

    First off the sensors
    The Allegro Microsystems A1301EUA-T is a 5v part that goes rail to rail. This is actaully very nice as the other part the Allegro Microsystems A1319LUA-5-T is 3v and not rail to rail. Getting those extra bits out of your ADC is very handy

    The next thing is that they saturate pretty easy when close. eg a AG of say 4mm with a 4mm dia Neodymium Magnet will max out the signal at either end for a big'ish period of the travel past it.

    If you use a long magnet you get a very usable section in the middle. In combination with other sensors either side you will get an overlap that will enable you to cover the saturated bits.

    The other option is to use a smaller magnet. I might order some at say 3mm dia x 12mm. Or just mount my sensor further away. I shall see what will work best.

    Lastly you should be able to get very high accuracy. I tried moving the magnet on a slide next to the sensor in the working range and was getting jumps of 20-30 adc readings for what I thought was the slightest adjustment.

    All in all I'm very optimistic about how well this will work.

    Cheers

    Tim
    Tim

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. Understanding errors
      By Peter Truman in forum Proton Plus Compiler v3
      Replies: 5
      Last Post: 14th October 2010, 10:22
    2. Understanding operands
      By John Drew in forum Proton Plus Compiler v3
      Replies: 2
      Last Post: 24th December 2009, 06:06
    3. MD5 algorithm.
      By speeder in forum The Lounge
      Replies: 4
      Last Post: 12th August 2005, 12:10
    4. MD5 algorithm.
      By speeder in forum Proton Plus Compiler v3
      Replies: 0
      Last Post: 11th August 2005, 16:12

    Members who have read this thread since 7th December 2019, 12:15 : 0

    Actions :  (Set Date)  (Clear Date)

    You do not have permission to view the list of names.

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts