2

I Took a output from ESP8266 and Connected it with Arduino Nano Analog input A0

i use BLYNK app to on/off D0 pin in ESP8266 , and i connected ESP8266 D0 pin with Arduino Nano A0 analogPin.

when esp8266 D0 in high state , the analogRead value in arduino nano serial monitor it show the value 395.

why not 1023 on high state .enter image description here

6
  • 3
    esp8266 has a 3.3 V TTL level. the ATmega analog pin reads 1023 at 5 V. and if you toggle the pin fast then not even 3.3 V will be read. – Juraj Apr 13 at 18:54
  • Did you connect the ground pins together? – Majenko Apr 13 at 20:11
  • @Majenko no i didnt connected the esp8266 ground pin to Arduino nano Ground pin , should i? – MD ZIAUR RAHMAN Apr 13 at 20:13
  • Absolutely - otherwise how can the nano know what the 3.3V from the ESP8266 is relative to...? – Majenko Apr 13 at 20:14
  • @Juraj please be specific , it will help me to learn . – MD ZIAUR RAHMAN Apr 13 at 20:14
2

There are two problems here - one immediate and one which will be come apparent.

First off, you appear not to have connected the ground pins of the two boards together. This is important. Voltage is not an absolute value, it's a value relative to some other point in the circuit. This is why "voltage" is sometimes called "potential difference". Normally the point in the circuit that voltages are referenced to is termed "ground". Note: there is nothing special about ground, it's just an arbitrary point in the circuit - usually, but not always, the point where the voltage is lowest. If the ground of the Arduino that it's using to compare incoming voltages against is not the same as the ground that the ESP8266 is using to create its output voltage in relation to, then the Arduino really can't know what the voltage is.

You can think of it as a person standing on the ground. Now I am about 6 feet tall. When I am stood up the top of my head is about 6 feet above the ground. But to someone who is stood on a nearby rise in the ground my head is only maybe 3 feet above the ground. Their ground is not the same as my ground.

The second problem, which will become apparent once you have connected the grounds, is that the Arduino measures voltages between 0 and 5V as values between 0 and 1023. However the ESP8266 doesn't operate at 5V, it operates at 3.3V. The highest voltage it can ever put out is 3.3V. The Arduino can never read that as 1023 because it's not 5V. Instead it will read somewhere around 675. That is, 3.3V is two thirds of 5V, and 675 is two thirds of 1023.

1
  • yes now i got it ., thanks a lot . you are genuis. – MD ZIAUR RAHMAN Apr 16 at 9: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.