Shop OBEX P1 Docs P2 Docs Learn Events
Navigate Robot Lawn Mower - Page 4 — Parallax Forums

Navigate Robot Lawn Mower

124»

Comments

  • kwinnkwinn Posts: 8,697
    edited 2011-08-21 21:51
    The MCP3202 is a dual version of the MCP3201, and a better choice since you will need to measure 2 input signals. You may even want to consider the 4 or 8 channel version (MCP3204/8) to allow for future expansion.

    Alex123, the schematic in post #90 looks pretty good as far as amplifying the signal goes but I do not see how it can detect or allow the adc to measure a peak. To me it looks like you will get an amplified signal on top of a 2.5V DC level. Perhaps I am so tired I am missing something. Do you have a reference or source for how this circuit works?

    Yianie, ADC stands for Analog to Digital Converter. It converts the voltage to a number the microcontroller program can use. The REF chip provides a reference voltage of about 1/2 of the +5V supply voltage to the INA2126.
  • alex123alex123 Posts: 102
    edited 2011-08-22 07:13
    This what I have in mind.
    When you sample the signal at 100kHz you get 10 samples (if the loop runs at 10kHz) per period. From these samples you get the max level.

    SineWave.PNG


    If you want even more precision you can interpolate the max value based on the next or the previous sample or the sample close to the 2.5V level. I'm pretty sure we won't need that though. Getting the highest value per period will be enough.
    321 x 106 - 6K
  • alex123alex123 Posts: 102
    edited 2011-08-22 07:24
    Yianie, You'll get all the reading from 0 to 5V from the sensor (assuming my last schematic). I was asking why you think that the 1.7V is the right level for the signal detection. It's not. This is why I propose to use an ADC so that you make the decision of selecting the level in the code.

    This is how the setup would go: Set the amp gain so that you get ~5Vp-p on the amp when the detector is directly above the wire. Make sure it's the same distance above the wire as it will be on the mower. Move the sensor away from the wire unitl the amp voltage is close to a flat line at 2.5V. This will be your critical distance at which you lose the signal. Ideally both detectors should be twice this distance apart from each other.

    INA118 is a single amp in DIP8 while INA2126 has 2 amp in DIP14. INA2126 is lot cheaper than 2 INA118 and work just fine for our 10kHz signal.
  • kwinnkwinn Posts: 8,697
    edited 2011-08-22 08:28
    alex123 wrote: »
    This what I have in mind.
    When you sample the signal at 100kHz you get 10 samples (if the loop runs at 10kHz) per period. From these samples you get the max level.

    SineWave.PNG


    If you want even more precision you can interpolate the max value based on the next or the previous sample or the sample close to the 2.5V level. I'm pretty sure we won't need that though. Getting the highest value per period will be enough.

    I thought you might have something like that in mind. That should work provided the uC chosen can handle the data burst coming in at that rate. I would suggest acquiring data for more than one cycle (perhaps 3 cycles), finding the min and max, and then subtracting min from max to use for the calculations. That will remove any DC drift from the results.
  • alex123alex123 Posts: 102
    edited 2011-08-22 09:25
    kwinn wrote: »
    That should work provided the uC chosen can handle the data burst coming in at that rate. I would suggest acquiring data for more than one cycle (perhaps 3 cycles), finding the min and max, and then subtracting min from max to use for the calculations. That will remove any DC drift from the results.

    If it's the Propeller chip, it can handle 8 of these simultaneously at 10MHz sampling :D. The 20MHz RISC can easily do 2 at 100kHz...

    Yeah, the "max - min" will yield a better result unless the amp gets saturated. Averaging is good too to get rid of the noise. That's the beauty of the software... So easy to change... :cool:
  • YianieYianie Posts: 49
    edited 2011-08-22 11:05
    Alex, in your reponse 65, why does the amp require a negative voltage?
  • kwinnkwinn Posts: 8,697
    edited 2011-08-22 11:33
    alex123, I hope that you and Yianie realize that the op amp and adc need to be on a well designed pcb in order for this circuit to work well. A perf board or prototyping board will not give good reliable results.
  • alex123alex123 Posts: 102
    edited 2011-08-22 12:05
    Yianie wrote: »
    Alex, in your reponse 65, why does the amp require a negative voltage?

    Because it does. See its DS. In post #75 I told you that it's possible to "fool it". That's what I showed you in post #90....
  • alex123alex123 Posts: 102
    edited 2011-08-22 12:22
    kwinn wrote: »
    alex123, I hope that you and Yianie realize that the op amp and adc need to be on a well designed pcb in order for this circuit to work well. A perf board or prototyping board will not give good reliable results.

    Obviously having the board fabbed would be ideal. A nice ground and power plain... Oh well... Since we have no other choice I'd shoot for the perf board. The proto board would be the worst. We don't need to read the signal down to one digit. If we get 16 distinct values (with averaging) out of 4096 we should be good. Better than a fixed threshold. It helps that we'll be running this on batteries. On the other hand using this high speed (80MHz) Propeller actually worries me because of the fast edges. Now that you made me think about it it seems that using the Stamp may work better from the circuit noise perspective.
  • alex123alex123 Posts: 102
    edited 2011-08-22 14:26
    Yianie, I would suggest using the SMT resistors and capacitors instead of leaded ones. I found out long time ago that 0805 size parts work perfect with the 100 mil grid proto boards. You may need tweezers but you'll save a lot of time anyway.
Sign In or Register to comment.