ESP8266 analog read

Great! thanks for the tutorial.

should be:

thing["LDR"] >> [](pson & out){

Nice tutorial!
To use ACS712, what I could change?

Hy Augusto!
Same code could be used with all analog devices, but remember to use the ADC pin (A0) :smile:

Good evening,

I am trying to measure curent with acs712 as mentioned above but i get a static measure of 1024 which is th max value of the ADC.
Does anyone know why is thiw hapening?

Thank you in advance

Maybe your shield don’t have a pullup/down resistor to create a current comparator in the output line… or it is possible that 1024 is the output value for 0A input current.
Can you expecify the exactly version of your acs shield?

I dont think it is due to the version. I have to measure AC curent…

Hi @giorgiol, I think that the problem while reading the acs712, is that the ESP8266 has an input voltage range from 0 to 1v. I suppose that the acs712 is providing more voltage, so you get always 1024. Check the voltage output with a multimeter to be sure.

Yes you are right…I need to create a lower voltage rate for th acs…

"The formats 07, 08, 12 and 12E, are the only one that have the necessary analog pin"
hi, the esp8266-01 have the analog pin? can read analog values? I can do this project with the esp8266-01? thanks.

Hi, what are you doing the sketch on ? The arduino IDE ? or do you write lua code and use esplorer to upload ?
Im very new, and there are different ways people are uploading tot his device, but no one says how they do it. Thank you.

Hi @joesgarage !
The Sketch uses Arduino libraries and IDE. I recomend you to read next tutorials for begin learning how Thinger.io works:
https://community.thinger.io/t/esp8266-with-arduino-ide/20/12
https://community.thinger.io/t/register-a-device-in-the-console/23

This video from PDAControl explains the same process:

i’m sure that, if you follow this instructions, you should be uploading data in two hours.

@hkjavier! I fear that ESP-01 don´t have analog pin.

Can I get a output file from thinger interface in text format

Hello @arpit! Yes you can do it making a data bucket and downloading it into a CSV file.

Can you explain me the above statement. More specifically, please explain me the general syntax

Can I sample data in bucket @ 1ms interval

Basic Thinger.io account is able to sample data 1 time per minute.

ok, this three lines of code are the definition of a C++ lambda, it is a way to create a non instance function that you can call using the ID that you have written inside the ["…"].

thing["LDR"] >> [](pson & out){
out = analogRead(A0);
};

In this case, LDR function will create an output Pson and fill it with an analog read.

I advise you to read the documentation and use the library examples to learn all thinger.io features and code functions here: Thinger.io Arduino documentation

“ In general, analog sensors are variable resistors that allows higher or lower current ”
You may want to rewrite that sentence… the rest of the guide is pretty good, but I almost stopped when I read that as an opener !