Activity › Forums › Questions & Troubleshooting › Hardware › [MAXI Automation] Analog IN and internal 5V supply deviation › Reply To: [MAXI Automation] Analog IN and internal 5V supply deviation
-
Dear Jarda!
I’ve now tried the following:
- Switched ADC to external reference as first command of setup()
- After loading the code I switched on a lab supply (4.500 V) connected to GND/VREF on X2
- AI12 is driven by another lab supply with 4.500 V (GND=screw terminal of Controllino, measured versus GND of Controllino)
- ADC value: 602 (expected (1024/2-1)=511)
- reduce VREF till ADC value gives 1023
- VREF measured: 2.653 V (expected 4.500V/2 = 2.25V)
The internal reference is off and connecting an external reference does not really work either.
Code:
#include <Controllino.h>
/*
* CONTROLLINO MAXI AUTOMATION - using analog VREF input
*
* Reads out converted analog values from a screw terminal input AI12
* of CONTROLLINO using VREF on X2 as reference.
*
* ------------------------
* 24V ---------o--------------| 24V |
* external | | |
* supply | | |
* -------------- | CONTROLLINO MAXI |
* | Lab Supply |--------| AI12 | ---------------
* | 4.500V | | X2-VREF |--------| Lab Supply |
* -------------- | | | 4.500V |
* | | | ---------------
* | | | |
* GND ---------o--------------| GND X2-GND |---------------o
* ------------------------
* remark: AI12 = internal divider 2:1
* ATTENTION: Only switch on the lab supply on VREF after you've downloaded the code the first time!
*/
void setup() {
analogReference(EXTERNAL);
pinMode(CONTROLLINO_AI12, INPUT);
Serial.begin(115200);
delay(300);
}
void loop() {
int val = analogRead(CONTROLLINO_AI12);
Serial.print(F("raw value: ")); Serial.println(val);
delay(100);
}- This reply was modified 3 years, 6 months ago by Friedl_AP. Reason: stray DIV tags removed