Sie sind auf Seite 1von 4

technology workshop craft home food play outside costumes

NODEMCU LUA ESP8266 How to use ADC / TOUT pin


by JohnL142 on July 16, 2016

Table of Contents

NODEMCU LUA ESP8266 How to use ADC / TOUT pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Intro: NODEMCU LUA ESP8266 How to use ADC / TOUT pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 1: Connecting things together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 2: Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Step 3: Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

http://www.instructables.com/id/NODEMCU-LUA-ESP8266-How-to-Use-ADC-TOUT-Pin/
Author:JohnL142 author's website
I like tinkering with electronics, PCs, ESP8266s and Arduinos. Would like to share what I have done as it may help others getting started or just trying
something new.

Intro: NODEMCU LUA ESP8266 How to use ADC / TOUT pin


The Analogue pin on the ESP8266 can easily be accessed especially on the larger ones where the pin is broken out. The ESP7, ESP12E and ESP201 are good
examples of this. On some boards it is identified as ADC or TOUT, it is also known as pin 6 or A0. It has 10 bit precision and its voltage range is between 0 and 1 volt.
The 2 resistors (220 and 100 ohm) make a voltage divider in roughly this range. A variable resistor of 1K is used to vary the input voltage. The output from this pin is in
the range of 0 to 1024.

Step 1: Connecting things together


To read the ADC / TOUT pin you need to connect things together as in the circuit above.

I am using Esplorer as I find it is about the best of the IDEs that are available at present.

I am assuming you know how to connect your UART and power supply to the ESP8266 board.

http://www.instructables.com/id/NODEMCU-LUA-ESP8266-How-to-Use-ADC-TOUT-Pin/
Step 2: Coding
The LUA code is simple for this one. All you have to do is read and print the pin value.

You don't even need to load the program as you can type it straight into Esplorer (as above)

It is even possible to access ADC on an ESP01 See this instructable for more.

File Downloads

ADC.lua (170 bytes)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'ADC.lua']
Step 3: Conclusion
I have written this instructable for all those who are new to the ESP8266 and LUA programming. I have tried using the Arduino IDE to load programs into the ESP8266,
but find that it is very clumsy to use, even when you are used to programming the Arduino.

I am fairly new to this myself and I have spent many hours and days getting nowhere. There is code out there and some of it does work. At times it is very frustrating that
nothing seems to work, no matter how hard you try.

It is also a very steep learning curve, even to do the simple stuff until you understand what is going on. Perseverance is the best plan of action and eventually things will
start to click into place.

I wish you good luck with what you are doing in the future.

Related Instructables

ESP8266 ADC - Programming Direct to Excel Arduino High Multiple analog Reading
Analog Sensors ESP8266 ESP- Measurement by speed inputs using sensors with a
by breagan22 12E NodeMCU Jaimeara Oscilloscope one analoge microprocessor.
Using Arduino with PC pin by by rickharris
IDE - a Tutorial interface by Ingenerare
by DavidPatterson
TheElectromania

http://www.instructables.com/id/NODEMCU-LUA-ESP8266-How-to-Use-ADC-TOUT-Pin/
Advertisements

Comments

http://www.instructables.com/id/NODEMCU-LUA-ESP8266-How-to-Use-ADC-TOUT-Pin/

Das könnte Ihnen auch gefallen