Shop OBEX P1 Docs P2 Docs Learn Events
Sharp IR Sensor Fluctuation — Parallax Forums

Sharp IR Sensor Fluctuation

ChrisL8ChrisL8 Posts: 129
edited 2014-08-25 13:49 in Accessories
I'm using the Sharp IR Sensors from Parallax with the MCP3208 ADC. I find that when they have something to look at they are very stable and relatively accurate. They don't fluctuate more than a centimeter in either direction as long as there is something within, or even a little outside of, their range.

However, if the Sharp IR sensor is looking out into "open space" the readings fluctuate all over the place, including all of the way up to the highest reading.

The problem is that I cannot tell the difference between a sudden obstacle and these random fluctuations.
If the path is 100% clear and I suddenly get a 14cm reading, is that just my sensor's randomness or a cat*?

I've tried to solve this with code, but the reading for the sensor really is identical between a sudden obstacle and this fluctuation.
I could require "obstacles" to remain in place for a certain period of time before responding to them, but then I risk running over the "cat", or whatever it was that got in the way.

What would cause the Sharp IR sensors to give random near readings when they have nothing to look at, and yet never do this if they have an object in range?

*No cats were harmed during my testing . . . unfortunately.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-08-15 09:22
    How high is the sensor from the surface the robot moves over? I wonder if it is possibly getting random reflections from the floor/ground? I have seen this happen when the PING))) sensor is too low. Stands to reason it could happen with the Sharp Sensors as well.
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2014-08-15 09:29
    Without knowing the internals of the Sharp IR signal processor (you would need to contact Sharp directly for that), my guess is that what you are seeing might be part of an automatic gain control trying to dynamically adjust and becoming so sensitive that any IR diffused background scatter is getting picked up. If the nature of the sensor was different I would suggest using two sensors and comparing the output differentially, but the IR between them would most likely interfere.

    How are you looking at the Data? ... Just the Raw output? ...or are you looking at the average?

    It might be beneficial to look at the first derivative by looking at the Delta (or change) from one reading to the next, and then perhaps an average of that.

    A slow average (several samples) vs. a fast average (a few samples) over the same data set might be an intuitive way to look at the data also by comparing the difference between the two averages. This method has a tendency to migrate over any subtle slow changes that can occur over long periods of time due to temperature, humidity, ambient sun light , etc.
  • ChrisL8ChrisL8 Posts: 129
    edited 2014-08-15 10:18
    Here is an example of the running output from one IR sensor. The readings are spaced 100 milliseconds apart.
    The first column is the reading from the ADC, the second is the voltage calculated from that, and the third is the centimeters calculated from the voltage.
    1337    1.632080        15
    822     1.003418        27
    348     0.424805        74
    18      0.021973        2248
    18      0.021973        2248
    18      0.021973        2248
    18      0.021973        2248
    18      0.021973        2248
    40      0.048828        897
    52      0.063477        663
    182     0.222168        157
    298     0.363770        89
    152     0.185547        193
    512     0.625000        47
    516     0.629883        47
    461     0.562744        53
    745     0.909424        31
    643     0.784912        36
    846     1.032715        26
    752     0.917969        30
    935     1.141357        23
    898     1.096191        25
    827     1.009521        27
    704     0.859375        33
    744     0.908203        31
    817     0.997314        27
    599     0.731201        39
    693     0.845947        33
    444     0.541992        56
    706     0.861816        33
    593     0.723877        40
    684     0.834961        34
    465     0.567627        53
    450     0.549316        55
    546     0.666504        44
    692     0.844727        33
    608     0.742188        39
    717     0.875244        32
    1184    1.445313        18
    1692    2.065430        12
    1462    1.784668        14
    1208    1.474609        17
    524     0.639648        46
    152     0.185547        193
    28      0.034180        1352
    18      0.021973        2248
    18      0.021973        2248
    52      0.063477        663
    131     0.159912        229
    134     0.163574        223
    51      0.062256        678
    280     0.341797        95
    98      0.119629        320
    343     0.418701        75
    430     0.524902        58
    552     0.673828        43
    466     0.568848        53
    561     0.684814        43
    975     1.190186        22
    612     0.747070        38
    576     0.703125        41
    494     0.603027        49
    332     0.405273        78
    559     0.682373        43
    947     1.156006        23
    491     0.599365        50
    196     0.239258        144
    327     0.399170        80
    197     0.240479        143
    497     0.606689        49
    37      0.045166        981
    367     0.447998        70
    411     0.501709        61
    1105    1.348877        19
    1382    1.687012        15
    1717    2.095947        11
    2048    2.500000        9
    877     1.070557        25
    19      0.023193        2112
    17      0.020752        2400
    20      0.024414        1991
    18      0.021973        2248
    19      0.023193        2112
    17      0.020752        2400
    145     0.177002        204
    97      0.118408        324
    168     0.205078        172
    416     0.507813        60
    494     0.603027        49
    859     1.048584        26
    799     0.975342        28
    757     0.924072        30
    396     0.483398        64
    510     0.622559        48
    496     0.605469        49
    393     0.479736        64
    620     0.756836        38
    499     0.609131        49
    215     0.262451        129
    41      0.050049        872
    364     0.444336        70
    99      0.120850        316
    379     0.462646        67
    285     0.347900        93
    660     0.805664        35
    401     0.489502        63
    467     0.570068        53
    413     0.504150        61
    432     0.527344        58
    540     0.659180        44
    1104    1.347656        19
    1626    1.984863        12
    1784    2.177734        11
    1570    1.916504        13
    282     0.344238        94
    18      0.021973        2248
    19      0.023193        2112
    18      0.021973        2248
    20      0.024414        1991
    18      0.021973        2248
    18      0.021973        2248
    19      0.023193        2112
    151     0.184326        194
    42      0.051270        848
    20      0.024414        1991
    315     0.384521        83
    266     0.324707        101
    459     0.560303        54
    607     0.740967        39
    771     0.941162        29
    828     1.010742        27
    1039    1.268311        21
    523     0.638428        46
    632     0.771484        37
    671     0.819092        35
    441     0.538330        56
    174     0.212402        165
    317     0.386963        83
    672     0.820313        34
    
  • ChrisL8ChrisL8 Posts: 129
    edited 2014-08-15 10:58
    How are you looking at the Data? ... Just the Raw output? ...or are you looking at the average?

    It might be beneficial to look at the first derivative by looking at the Delta (or change) from one reading to the next, and then perhaps an average of that.

    A slow average (several samples) vs. a fast average (a few samples) over the same data set might be an intuitive way to look at the data also by comparing the difference between the two averages. This method has a tendency to migrate over any subtle slow changes that can occur over long periods of time due to temperature, humidity, ambient sun light , etc.

    I am certainly open to the idea of using math to weed out the garbage, I'm just not proficient enough to imagine the solution on my own.

    I've tried averaging, but averaging garbage results in garbage. :)

    I need a way to say, "If the reading is steady, or trending upward or downward at a reasonable rate, then accept the value, but if it is wildly fluctuating, ignore it."

    I can imagine how to only accept stable values:
    Take X readings, compare them, if all X are not within Y of each other, discard them.

    However, I think that would also throw out values obtained while in motion, since each reading would be higher or lower than the previous.
  • ChrisL8ChrisL8 Posts: 129
    edited 2014-08-15 11:31
    Ah you caught me with the lights on!

    Here is a new set of output in a darkened room with no artificial lighting and the curtains closed.
    It still fluctuates a lot, but it looks different in the graph now.
    149     0.181885        197
    787     0.960693        29
    364     0.444336        70
    122     0.148926        248
    245     0.299072        111
    372     0.454102        69
    116     0.141602        263
    41      0.050049        872
    616     0.751953        38
    621     0.758057        38
    778     0.949707        29
    691     0.843506        33
    719     0.877686        32
    264     0.322266        102
    444     0.541992        56
    85      0.103760        377
    229     0.279541        120
    480     0.585938        51
    83      0.101318        387
    131     0.159912        229
    591     0.721436        40
    496     0.605469        49
    675     0.823975        34
    543     0.662842        44
    542     0.661621        44
    791     0.965576        29
    732     0.893555        31
    578     0.705566        41
    684     0.834961        34
    714     0.871582        32
    415     0.506592        60
    51      0.062256        678
    413     0.504150        61
    263     0.321045        102
    267     0.325928        101
    304     0.371094        87
    576     0.703125        41
    165     0.201416        175
    432     0.527344        58
    681     0.831299        34
    648     0.791016        36
    559     0.682373        43
    752     0.917969        30
    384     0.468750        66
    248     0.302734        110
    704     0.859375        33
    839     1.024170        27
    792     0.966797        28
    887     1.082764        25
    731     0.892334        31
    288     0.351563        92
    118     0.144043        258
    283     0.345459        94
    278     0.339355        96
    418     0.510254        60
    427     0.521240        58
    504     0.615234        48
    575     0.701904        41
    440     0.537109        56
    565     0.689697        42
    527     0.643311        46
    572     0.698242        42
    639     0.780029        37
    740     0.903320        31
    800     0.976563        28
    639     0.780029        37
    663     0.809326        35
    495     0.604248        49
    495     0.604248        49
    473     0.577393        52
    495     0.604248        49
    359     0.438232        71
    545     0.665283        44
    499     0.609131        49
    368     0.449219        69
    229     0.279541        120
    166     0.202637        174
    248     0.302734        110
    163     0.198975        178
    365     0.445557        70
    276     0.336914        97
    526     0.642090        46
    259     0.316162        104
    626     0.764160        37
    595     0.726318        40
    892     1.088867        25
    729     0.889893        31
    368     0.449219        69
    18      0.021973        2248
    20      0.024414        1991
    25      0.030518        1540
    447     0.545654        55
    260     0.317383        104
    197     0.240479        143
    430     0.524902        58
    364     0.444336        70
    702     0.856934        33
    661     0.806885        35
    923     1.126709        24
    704     0.859375        33
    363     0.443115        71
    463     0.565186        53
    332     0.405273        78
    200     0.244141        140
    450     0.549316        55
    546     0.666504        44
    216     0.263672        129
    64      0.078125        522
    280     0.341797        95
    282     0.344238        94
    472     0.576172        52
    384     0.468750        66
    591     0.721436        40
    480     0.585938        51
    490     0.598145        50
    299     0.364990        88
    736     0.898438        31
    513     0.626221        47
    443     0.540771        56
    363     0.443115        71
    217     0.264893        128
    197     0.240479        143
    18      0.021973        2248
    248     0.302734        110
    426     0.520020        59
    119     0.145264        256
    411     0.501709        61
    349     0.426025        74
    307     0.374756        86
    514     0.627441        47
    552     0.673828        43
    407     0.496826        62
    623     0.760498        38
    602     0.734863        39
    994     1.213379        22
    947     1.156006        23
    784     0.957031        29
    779     0.950928        29
    923     1.126709        24
    850     1.037598        26
    776     0.947266        29
    943     1.151123        23
    789     0.963135        29
    575     0.701904        41
    624     0.761719        38
    616     0.751953        38
    593     0.723877        40
    546     0.666504        44
    575     0.701904        41
    626     0.764160        37
    648     0.791016        36
    459     0.560303        54
    523     0.638428        46
    583     0.711670        41
    688     0.839844        34
    832     1.015625        27
    584     0.712891        41
    466     0.568848        53
    452     0.551758        55
    426     0.520020        59
    135     0.164795        221
    410     0.500488        61
    211     0.257568        132
    264     0.322266        102
    280     0.341797        95
    349     0.426025        74
    612     0.747070        38
    687     0.838623        34
    625     0.762939        38
    781     0.953369        29
    465     0.567627        53
    683     0.833740        34
    379     0.462646        67
    648     0.791016        36
    367     0.447998        70
    432     0.527344        58
    383     0.467529        66
    213     0.260010        131
    396     0.483398        64
    130     0.158691        231
    155     0.189209        189
    576     0.703125        41
    528     0.644531        46
    327     0.399170        80
    363     0.443115        71
    472     0.576172        52
    637     0.777588        37
    687     0.838623        34
    735     0.897217        31
    551     0.672607        43
    248     0.302734        110
    184     0.224609        155
    18      0.021973        2248
    182     0.222168        157
    247     0.301514        110
    401     0.489502        63
    53      0.064697        649
    434     0.529785        57
    442     0.539551        56
    674     0.822754        34
    630     0.769043        37
    724     0.883789        32
    511     0.623779        47
    712     0.869141        32
    480     0.585938        51
    499     0.609131        49
    602     0.734863        39
    667     0.814209        35
    397     0.484619        64
    347     0.423584        74
    478     0.583496        51
    527     0.643311        46
    576     0.703125        41
    532     0.649414        45
    662     0.808105        35
    754     0.920410        30
    799     0.975342        28
    499     0.609131        49
    780     0.952148        29
    581     0.709229        41
    798     0.974121        28
    667     0.814209        35
    893     1.090088        25
    1016    1.240234        21
    991     1.209717        22
    677     0.826416        34
    719     0.877686        32
    664     0.810547        35
    512     0.625000        47
    383     0.467529        66
    688     0.839844        34
    481     0.587158        51
    384     0.468750        66
    472     0.576172        52
    

    Still, perhaps this is proving the limits of what I can rely on the IR sensors for.
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2014-08-15 11:44
    Is your power supply adequate? There could be noise from a power supply that can just as easily make it's way into the sensor.
  • ChrisL8ChrisL8 Posts: 129
    edited 2014-08-15 11:44
    And just so you understand what I mean.
    Here is the results with an object at 49cm:

    Lights OFF:
    513     0.626221        47
    516     0.629883        47
    511     0.623779        47
    498     0.607910        49
    505     0.616455        48
    527     0.643311        46
    520     0.634766        46
    512     0.625000        47
    511     0.623779        47
    515     0.628662        47
    512     0.625000        47
    517     0.631104        47
    494     0.603027        49
    522     0.637207        46
    493     0.601807        49
    496     0.605469        49
    511     0.623779        47
    495     0.604248        49
    490     0.598145        50
    543     0.662842        44
    500     0.610352        49
    516     0.629883        47
    496     0.605469        49
    492     0.600586        50
    501     0.611572        49
    507     0.618896        48
    504     0.615234        48
    526     0.642090        46
    516     0.629883        47
    511     0.623779        47
    511     0.623779        47
    499     0.609131        49
    496     0.605469        49
    489     0.596924        50
    495     0.604248        49
    516     0.629883        47
    500     0.610352        49
    495     0.604248        49
    511     0.623779        47
    497     0.606689        49
    507     0.618896        48
    512     0.625000        47
    536     0.654297        45
    504     0.615234        48
    511     0.623779        47
    499     0.609131        49
    498     0.607910        49
    494     0.603027        49
    495     0.604248        49
    494     0.603027        49
    511     0.623779        47
    514     0.627441        47
    492     0.600586        50
    491     0.599365        50
    498     0.607910        49
    495     0.604248        49
    522     0.637207        46
    510     0.622559        48
    512     0.625000        47
    495     0.604248        49
    491     0.599365        50
    490     0.598145        50
    489     0.596924        50
    525     0.640869        46
    500     0.610352        49
    508     0.620117        48
    493     0.601807        49
    475     0.579834        52
    501     0.611572        49
    494     0.603027        49
    480     0.585938        51
    508     0.620117        48
    496     0.605469        49
    495     0.604248        49
    512     0.625000        47
    506     0.617676        48
    507     0.618896        48
    515     0.628662        47
    511     0.623779        47
    492     0.600586        50
    515     0.628662        47
    495     0.604248        49
    515     0.628662        47
    520     0.634766        46
    491     0.599365        50
    516     0.629883        47
    539     0.657959        45
    511     0.623779        47
    495     0.604248        49
    495     0.604248        49
    495     0.604248        49
    496     0.605469        49
    495     0.604248        49
    492     0.600586        50
    516     0.629883        47
    495     0.604248        49
    495     0.604248        49
    510     0.622559        48
    512     0.625000        47
    511     0.623779        47
    513     0.626221        47
    526     0.642090        46
    524     0.639648        46
    514     0.627441        47
    510     0.622559        48
    511     0.623779        47
    502     0.612793        48
    521     0.635986        46
    514     0.627441        47
    493     0.601807        49
    500     0.610352        49
    516     0.629883        47
    516     0.629883        47
    513     0.626221        47
    511     0.623779        47
    501     0.611572        49
    519     0.633545        47
    505     0.616455        48
    512     0.625000        47
    511     0.623779        47
    503     0.614014        48
    521     0.635986        46
    512     0.625000        47
    491     0.599365        50
    509     0.621338        48
    517     0.631104        47
    509     0.621338        48
    513     0.626221        47
    500     0.610352        49
    492     0.600586        50
    501     0.611572        49
    479     0.584717        51
    494     0.603027        49
    513     0.626221        47
    504     0.615234        48
    504     0.615234        48
    495     0.604248        49
    499     0.609131        49
    499     0.609131        49
    489     0.596924        50
    495     0.604248        49
    518     0.632324        47
    511     0.623779        47
    511     0.623779        47
    493     0.601807        49
    528     0.644531        46
    491     0.599365        50
    497     0.606689        49
    507     0.618896        48
    516     0.629883        47
    488     0.595703        50
    480     0.585938        51
    490     0.598145        50
    496     0.605469        49
    506     0.617676        48
    491     0.599365        50
    512     0.625000        47
    521     0.635986        46
    511     0.623779        47
    500     0.610352        49
    491     0.599365        50
    496     0.605469        49
    495     0.604248        49
    491     0.599365        50
    511     0.623779        47
    493     0.601807        49
    495     0.604248        49
    495     0.604248        49
    

    Lights ON:
    495     0.604248        49
    516     0.629883        47
    511     0.623779        47
    475     0.579834        52
    487     0.594482        50
    486     0.593262        50
    514     0.627441        47
    495     0.604248        49
    512     0.625000        47
    496     0.605469        49
    490     0.598145        50
    495     0.604248        49
    496     0.605469        49
    519     0.633545        47
    500     0.610352        49
    497     0.606689        49
    480     0.585938        51
    495     0.604248        49
    496     0.605469        49
    476     0.581055        52
    599     0.731201        39
    494     0.603027        49
    504     0.615234        48
    496     0.605469        49
    496     0.605469        49
    507     0.618896        48
    498     0.607910        49
    519     0.633545        47
    516     0.629883        47
    504     0.615234        48
    502     0.612793        48
    513     0.626221        47
    492     0.600586        50
    503     0.614014        48
    516     0.629883        47
    507     0.618896        48
    516     0.629883        47
    519     0.633545        47
    504     0.615234        48
    499     0.609131        49
    492     0.600586        50
    493     0.601807        49
    474     0.578613        52
    489     0.596924        50
    500     0.610352        49
    498     0.607910        49
    511     0.623779        47
    493     0.601807        49
    508     0.620117        48
    511     0.623779        47
    492     0.600586        50
    532     0.649414        45
    512     0.625000        47
    494     0.603027        49
    497     0.606689        49
    512     0.625000        47
    489     0.596924        50
    587     0.716553        40
    516     0.629883        47
    499     0.609131        49
    494     0.603027        49
    498     0.607910        49
    492     0.600586        50
    503     0.614014        48
    496     0.605469        49
    495     0.604248        49
    495     0.604248        49
    490     0.598145        50
    512     0.625000        47
    512     0.625000        47
    509     0.621338        48
    495     0.604248        49
    494     0.603027        49
    512     0.625000        47
    523     0.638428        46
    506     0.617676        48
    564     0.688477        42
    500     0.610352        49
    511     0.623779        47
    504     0.615234        48
    496     0.605469        49
    507     0.618896        48
    491     0.599365        50
    499     0.609131        49
    526     0.642090        46
    508     0.620117        48
    499     0.609131        49
    496     0.605469        49
    511     0.623779        47
    496     0.605469        49
    511     0.623779        47
    505     0.616455        48
    528     0.644531        46
    510     0.622559        48
    493     0.601807        49
    500     0.610352        49
    495     0.604248        49
    497     0.606689        49
    495     0.604248        49
    490     0.598145        50
    500     0.610352        49
    481     0.587158        51
    503     0.614014        48
    494     0.603027        49
    496     0.605469        49
    484     0.590820        51
    490     0.598145        50
    519     0.633545        47
    502     0.612793        48
    509     0.621338        48
    495     0.604248        49
    495     0.604248        49
    509     0.621338        48
    505     0.616455        48
    512     0.625000        47
    520     0.634766        46
    495     0.604248        49
    493     0.601807        49
    476     0.581055        52
    475     0.579834        52
    496     0.605469        49
    516     0.629883        47
    505     0.616455        48
    507     0.618896        48
    512     0.625000        47
    518     0.632324        47
    492     0.600586        50
    491     0.599365        50
    512     0.625000        47
    503     0.614014        48
    495     0.604248        49
    495     0.604248        49
    

    The results are VERY stable when it has something to look at. Even the florescent light issue is very easy to ignore.

    It would be nice if they were steadily "out of range" when there is nothing to look at, instead of fluctuating wildly, causing random hits in the near range.
    I thought maybe this was something wrong with my setup, but if it is just the nature of the beast, then I will have to find some formula (math and/or programming function) to deal with it.
  • ChrisL8ChrisL8 Posts: 129
    edited 2014-08-15 11:48
    Is your power supply adequate? There could be noise from a power supply that can just as easily make it's way into the sensor.

    It is running off of the Activity Board's 5 volt line. The Activity Board is running off of the Arlo Power distribution board's 6.5V output.

    I did find this article that suggests capacitors not only on the power supply line, but perhaps right at the IR sensor's power line and also on the signal line:
    http://www.robotroom.com/DistanceSensor3.html

    I don't have enough capacitors on hand to experiment with that, but if you think it may make a difference I will go buy some at Radio Shack today and try them.

    I had assumed originally that since the reading was so stable when there was something in range, that I had no noise issues, but perhaps I am wrong?
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2014-08-15 12:01
    It wouldn't hurt, and you might be surprised. As far as actual value? ..that depends on how noisy the power is. So some empirical testing might be required.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-08-15 13:51
    ChrisL8 wrote: »
    I'm using the Sharp IR Sensors from Parallax with the MCP3208 ADC. I find that when they have something to look at they are very stable and relatively accurate. They don't fluctuate more than a centimeter in either direction as long as there is something within, or even a little outside of, their range.

    Are you sure you're setting the correct channel for reading? What about the correct mode? If I recall the MCP3208 can be configured for differential mode, which could cause some interesting readings if you're using one channel.
  • ercoerco Posts: 20,256
    edited 2014-08-15 17:05
    I have found that an electrolytic filter cap right on the Sharp sensor leads is usually required for reliable operation, fyi.

    If that doesn't solve your problem, temporarily try a separate clean 5v source for your sensor and see the results.
  • xanaduxanadu Posts: 3,347
    edited 2014-08-15 18:24
    Have you tried replacing the IR sensor signal with power supply voltage (3.3v or 5v) and observing a steady reading?
  • ercoerco Posts: 20,256
    edited 2014-08-15 19:28
    xanadu wrote: »
    Have you tried replacing the IR sensor signal with power supply voltage (3.3v or 5v) and observing a steady reading?

    Good call. Or even simpler, use a battery or two, since the problem only shows up at low input voltages. I haven't tried that particular ADC myself.
  • xanaduxanadu Posts: 3,347
    edited 2014-08-15 23:34
    Thanks Erco.

    What about the input side of the ADC?

    I've had issues with bad readings on channels adjacent to floating inputs. How do you have your input wired to the ADC?

    This is how I have mine setup

    adc.JPG
  • ChrisL8ChrisL8 Posts: 129
    edited 2014-08-18 07:40
    Thank you for all of the help and input!

    I took your advice and tried running from other power sources and various capacitor placements.

    Here is what I found over the weekend:

    I. A single Sharp IR Sensor GP2Y0A21YK0F connected to the Activity Board's ADC via the built in breadboard, with no resistors or capacitors, with the Activity Board powered from a computer USB port works perfectly. Virtually no ripple, and a constant low voltage for out of range values and steady values for in range distances.

    So the issue seems to be with power, noise and interference.

    Here is how I got the IR Sensors working satisfactorily on the ArloBot:

    1. Power the MCP3208, the reference voltage, and all of the IR sensors (in other words, all of it) from the 5V output on the Arlo Power Distribution board and not the Activity Board.
    This alone made a huge difference.

    2. Add a 10uF capacitor across the power input and ground.
    1uF was recommended in some diagrams, but those were generic for the MCP3208 usage. The IR Sensor data sheet does actually recommend a 10uF capacitor or larger, so I guess that is just a matter of reading all of the fine print, and knowing enough about things to be looking for it. :)
    This brought things to a very stable level.

    However, I found no benefit from adding any capacitor to the sensor signal line. I tried both 0.1uF and 0.047uF capacitors both at the MCP3208 end and right at the sensor itself, and I did not see any benefit to the output either with in range or out of range signals. If anything it seemed to make things worse by making any transient "spikes" last longer.

    3. Finally, there was still that intermittent "beat", even with no fluorescent lights. The culprit is the other sensors. I have 5 across the front. Most of the time they cause no problem. However, if one of them is seeing "nothing", and another IS seeing something, at just the right angle, then the one seeing nothing will display a steady low voltage with a periodic spike at regular intervals. This assumes everything is very still, if you are moving obviously this gets very complex.
    This is easy to prove when it happens by just covering up the one sensor that sees something and the "beat" goes away immediately and consistently.
    Note that this is very dependent on what angle the other sensor sees something at, so it isn't easy to reproduce on purpose.
    This is just something to be aware of in programming. I will obviously have to be aware of various IR tendencies in my testing and programming logic, such as how they respond to florescent light, and how they pick up interference from each other.

    For background, I did test the IR sensors before mounting them, but I see now what I missed.
    1. I tested all 5 sensors on a flat board, but they interfere with each other not when they both look straight ahead, but when one is at an angle to the other and sees something at an angle and the other sees "nothing". This isn't a scenario I had tested, nor is it easy to reproduce on purpose.
    2. I tested with the Activity Board on AA battery power. Things are obviously different when running from a voltage converter that in turn comes from a 12v battery.
    3. I did a lot of testing for steady values within range, but I didn't pay any attention to out of range values. I had assumed low voltage was low voltage. I had not considered the possibility of noise causing confusing when the path was clear.

    Again, thank you for all of the help. I understand all of this a lot better, I learned a lot, and I have some good tools (spreadsheets, formulas, capacitor location ideas and values, pictures of breadboards) to use in future debugging of this and similar systems!
  • ercoerco Posts: 20,256
    edited 2014-08-18 18:58
    Chris:

    Thank you for all of the time you spend documenting your findings on numerous items here. You're a one-man development tour de force and you have singlehandedly raised the bar for everyone to aspire to your level of detail to help others avoid the pitfalls you discover.

    You're an excellent writer and communicator as well. Grammar & spelling are not everyone's strong point, even some very technically bright people I know. I'm guessing you're young and energetic. If you're not a technical writer professionally, you sure could be. Consider writing some articles for SERVO magazine. I have found them to be very receptive, organized, and downright pleasant to work with. They also pay better than average, so it's a great way to subsidize your hobby. Contact Robin Lemieux<robin@nutsvolts.com> and get to work!

    Ken, any openings for a skilled tech writer? :)
  • ChrisL8ChrisL8 Posts: 129
    edited 2014-08-25 12:00
    erco wrote: »
    Thank you for all of the time you spend documenting your findings on numerous items here. You're a one-man development tour de force and you have singlehandedly raised the bar for everyone to aspire to your level of detail to help others avoid the pitfalls you discover.

    Wow, thank you for the encouragement erco! It really means a lot to me. Careful though, this is the kind of praise that will make a man give up his day job! :)
  • ZootZoot Posts: 2,227
    edited 2014-08-25 13:49
    About 33uf is recommended across Vout and Gnd on the Sharps. Much higher than what you tested.
Sign In or Register to comment.