1

dear member. I have 4 ESP-12 averything OK but one chip behave weird. always return 1024 on analogRead(A0); once use ADC_MODE(ADC_VCC) and reflash using ADC_MODE(ADC_TOUT); and never back to normal, is my Chip Error..?

FM 4MB

ArduinoIDE 1.8.13

BR 115200

PS 80MHz

int iVal = 0; 
void setup() { 
  Serial.begin(115200);
  delay(999);
  pinMode(A0,INPUT) ; 
  pinMode(LED_BUILTIN, OUTPUT); 
}

// the loop routine runs over and over again forever:
void loop() {
  iVal=analogRead(A0); 
  Serial.println(iVal); 
  
  if (iVal > 900) digitalWrite(LED_BUILTIN,HIGH);
  else   digitalWrite(LED_BUILTIN,LOW);
  delay(720);  
}
  • ADC_MODE(ADC_TOUT); still return 1024 on analogRead(A0); while other 3 Chip just fine – Rendra_HMD Sep 20 at 15:52
  • 1
    If 4 devices are working correctly, but 1 device not, with the very same program, there seems to be a hardware difference. Check for short circuits, open wires, bad soldering, and so on. You might even have a defective device. – the busybee Sep 20 at 16:44
  • Sounds to me like the ADC has been overpowered and the ESD protection diode has failed short. – Majenko Sep 20 at 17:31
  • @Majenko so, should i let it go? you are right. once, i was powering switch accident between vcc and ground about 2 minute. is it problem? and how to accept your comment as solved? – Rendra_HMD Sep 20 at 23:22
0

First be sure your voltage on the analog input is less then 1V and greater then zero, that is the range for the input. If nothing connected no guarantee what you will get. Just guessing, no circuit or definition.

| improve this answer | |
  • I have voltage devider, also multimeter test trying to measure 0,6 volt still return 1024. also 0,8 Volt input and measuring after Voltage devider get 0,2Volt still return 1024. – Rendra_HMD Sep 21 at 3:04
  • I assume you are saying you get 0.6V reading on the pin with a multimeter, if so consider the unit toast. Probably good for digital usage but for A/D you need another board. The only real test is to try another board or add an external A/D. – Gil Sep 21 at 15:38
  • agree with you @Gil, i was order ather board, let this one go, or use without ADC. seem my board ADC has been overpowered.. because weird on testing: ADC pin floating(no conection) measure with voltmeter always 2,8Volt – Rendra_HMD Sep 23 at 13:29
  • Actually you did a good job and most of the work. These things are very hard to diagnose unless it is on the lab bench in front of you. – Gil Sep 24 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.