6Jakes (Customer) asked a question.

Why is the analog input on the P1AM is not linear when the voltage and current from the device are linear.

I have an ultrasonic sensor UK1F-E1-0A connected to the A6 pin on the P1AM. I set P1 at 9 inches and P2 at 36 inches. My code is pretty simple for now. Every 500ms, I do an Analog Read from A6 and output the value to the COM port. At 9 inches, the output is 1023; at 36 inches the output is 309. This is very similar to other devices I've tested with. However, as I move my block further from the sensor, the output remains 1023 until I get to about 21 inches then it starts dropping off. If I measure the current across the 250ohm resister, it does begin to drop as soon as I start moving the block. At 22.5 inches (about half way) the input is reading around 960, but the current reads about 12mA. I've done basically the same thing with a laser and an EZ-Array light curtain with an Arduino Uno and it worked fine. Any suggestions are appreciated.


  • Tinker (Customer)

    For a start, the SAMD21 in the P1AM is a 3.3 volt device, 20mA across 250 ohms is 5V, significantly too high, maybe try a 150 ohm resistor (for a single standard value resistor, or maybe two 330 in parallel for 165 ohms)

    Selected as Best
  • Tinker (Customer)

    For a start, the SAMD21 in the P1AM is a 3.3 volt device, 20mA across 250 ohms is 5V, significantly too high, maybe try a 150 ohm resistor (for a single standard value resistor, or maybe two 330 in parallel for 165 ohms)

    Selected as Best
    • 6Jakes (Customer)

      The voltage was the issue. I changed the resistance to 165 ohms and the output is scaling as I expect. Thanks for your help!. @FACTS_AdamC (AutomationDirect)​ Thanks for the recommendation on the module, I'll take a look.

  • FACTS_AdamC (AutomationDirect)

    Tinker is correct about the voltage levels being incorrect for the SAMD21.

    A straightforward option without additional conditioning would be to purchase a P1000 IO module such as the P1-04ADL-2, P1-04AD, etc. that support the 0-10V range of your sensor.