austin.m.bryan (Customer) asked a question.

Using a Draw Wire Potentiometer with P1AM-100

Hey everyone,

 

I'm working on a senior design project and am using the P1AM-100 controller on conjunction with a few sensors. One of them is this draw wire potentiometer my team found on Amazon:

 

https://www.amazon.com/2000mm-Encoder-Supply-Analog-Output/dp/B07K17XLTK

 

We are wiring it with a P1-08ADL Analog Input module as suggested by AutomationDirect customer service. We believe we have it wired correctly, but when we test the code out, we are only getting readings of 0mA instead of 4mA. This is the code we using, based off the P1-08ADL github documentation and example AnalogInput. Made sure to convert inputCounts to Amps instead of Volts but still nothing:

  1. // Potentiometer Test - reads the current being output by the draw wire sensor
  2.  
  3. #include <P1AM.h>
  4.  
  5. // Declare variables for counts and Amps
  6. int inputCounts = 0;
  7. float inputAmps = 0;
  8.  
  9. void setup() {
  10. Serial.begin(115200); //initialize serial communication at 115200 bits per second
  11. while (!P1.init()){
  12. ; //Wait for Modules to Sign on
  13. }
  14. }
  15.  
  16. void loop() {
  17. inputCounts = P1.readAnalog(1,1); //Reads analog data from slot 1 channel 1 of the analog input module
  18. inputAmps = 20 * ((float)inputCounts / 8191); //converts the value of inputCounts to float with the units mA
  19. //moduleStatus = P1.readStatus(int byteNum, int slot);
  20.  
  21. Serial.print(inputAmps);
  22. Serial.println();
  23.  
  24. }

Any help is appreciated. Thank you in advance!