
austin.m.bryan (Customer) asked a question.
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:
- // Potentiometer Test - reads the current being output by the draw wire sensor
-
- #include <P1AM.h>
-
- // Declare variables for counts and Amps
- int inputCounts = 0;
- float inputAmps = 0;
-
- void setup() {
- Serial.begin(115200); //initialize serial communication at 115200 bits per second
- while (!P1.init()){
- ; //Wait for Modules to Sign on
- }
- }
-
- void loop() {
-
- inputCounts = P1.readAnalog(1,1); //Reads analog data from slot 1 channel 1 of the analog input module
- inputAmps = 20 * ((float)inputCounts / 8191); //converts the value of inputCounts to float with the units mA
- //moduleStatus = P1.readStatus(int byteNum, int slot);
-
- Serial.print(inputAmps);
- Serial.println();
-
- }
Any help is appreciated. Thank you in advance!
It looks like that sensor outputs 0-5VDC, but from your description it appears that you have a P1-08ADL-1, which measures current.
I would confirm with a multimeter that your sensor is outputting what you expect at various points. I'd also use a bench supply to confirm that the module will read a known good signal. You can find the input impedance here for your voltage calculation.
Good luck on your project! Senior Design can be very stressful, though hopefully it will be equally as rewarding.
Hi austin.m.bryan
Your input is a 0-5 Volts DC. You will need an analog voltage input card like the P1-04AD.
https://facts-engineering.github.io/modules/P1-04AD/P1-04AD.html
Regards,
Garry
https://accautomation.ca/series/productivity-open-arduino-compatible-industrial-controller/
Sorry, I accidentally linked the wrong sensor. Here's the one we're using, it's very similar but outputs 4-20mA:
https://www.amazon.com/CALT-Encoder-Supply-Analog-Output/dp/B07PKMDTNM
Thank you for the response. We will go through and check each signal, hopefully it works!
Hi Austin,
The following thread may give you some ideas for testing.
https://community.automationdirect.com/s/question/0D53u000038Wn0gCAC/i-have-a-click-c002drd-that-i-am-trying-to-use-with-a-linear-position-sensor-lrsi18025a0020a-420ma-however-i-am-not-able-to-get-an-analog-signal-via-the-input-ad1i-has-anyone-had-this-issue-or-similar
Regards,
Garry