These are chat archives for esp8266/Arduino

27th
Mar 2017
ongvanor
@ongvanor
Mar 27 2017 01:18
thanks i got it working, what is the maximum voltage of the A0 of ESP-01 NodeMcu can handle? i heard it can only handle 1V
Wino24
@Wino24
Mar 27 2017 02:21
Hi all.....I'm trying to monitor the temperature in my basement with an arduino nano using a TMP36 temp sensor and then send the data to my mqtt server using an esp8266-01. I was hoping soemone could send me in the right direction because I am having a difficult time finding examples to help me along.
esp-01 default baudrate is 115200 and i think arduino nano software serial is not compatible with that baudrate.
Wino24
@Wino24
Mar 27 2017 02:32
ooooh.....ok thank you
nicelight
@nicelight
Mar 27 2017 03:41
hello. Can anybody share a project with good stability and minimal web interface of web server. I need at least 1 week uptime with solid wifi connection. Because there is a lot of disconnections in my scatches. ( I am using delay() and don't use long time cycles like "for", "while" etc, but still problems with reliable long time connection)
bobcroft
@bobcroft
Mar 27 2017 07:01
@ongvanor You are correct in that the internal ADC on the ESP2866 can only handle up to 1 v. If you need yo use higher voltages you could use a resistor divider or an external ADC device using an I2C device or possibly SPI. however, if you are using ESP-Link with an Arduino could you not use the Arduino's ADC(s). If you have the ESP-Link firmware loaded on your ESP I don't see how you can use the ADC anyway as the ESP is dedicated to the link.
ongvanor
@ongvanor
Mar 27 2017 08:07
@bobcroft thanks for the input. i changed my plans for the hardware im currently using this http://www.electrodragon.com/product/nodemcu-lua-amica-r2-esp8266-wifi-board/
cause its more stable and its already a package though the pins are really limited. what im planning is use this kind of idea http://forum.arduino.cc/index.php?topic=8558.0 1 analog pin multiple buttons
Tejas H
@CodingCreate101
Mar 27 2017 08:25

Hello guys, currently I am working on ESP's EEPROM.
This is the code I have written.. just to start with.

#include <EEPROM.h>

struct createObject
{
    String title;
    String startFrom;
    String endAt;
    String location;
    String appl;
    short int itsStat;
};
int damnsize;

void setup()
{
EEPROM.begin(1024);
struct createObject object1;
damnsize = sizeof(createObject);
Serial.begin(115200);
Serial.print(damnsize);

object1.title = "This is some string";
object1.startFrom = "123456789012";
object1.endAt = "abcdefghijkl";
object1.location = "Sun";
object1.appl = "greenlight"; 
object1.itsStat = 1;

Serial.println();
Serial.println(object1.title);
Serial.println(object1.startFrom);
Serial.println(object1.endAt);
Serial.println(object1.location);
Serial.println(object1.appl);
Serial.println(object1.itsStat);

EEPROM.put(damnsize, object1);
//while(!EEPROM.commit());
object1.title = "randomStringHere";
object1.startFrom = "newnum";
object1.endAt = "booya";
object1.location = "random";
object1.appl = "something";
object1.itsStat = NULL;
damnsize = sizeof(createObject);
EEPROM.get(damnsize, object1);

Serial.println(object1.title);
Serial.println(object1.startFrom);
Serial.println(object1.endAt);
Serial.println(object1.location);
Serial.println(object1.appl);
Serial.println(object1.itsStat);

delay(5000);
}

void loop(){//Empty}

And I got this output in Serial monitor:

This is some string
123456789012
abcdefghijkl
Sun
greenlight
1
randomStringHere  ng
newnum 89012
booya ghijkl
ran
something 
1
Tejas H
@CodingCreate101
Mar 27 2017 08:32

This is code algorithm
1) create a structure
2) Create new structure(roughly, an object)
3) Store values manually
4) Write those values to EEPROM using EEPROM.put() method.
5) Change values in the code manually.
6) Read values back from EEPROM to check whether the info was written in EEPROM or not.

But I am getting weird output on serial monitor.

ongvanor
@ongvanor
Mar 27 2017 10:02
can anyone help? im having this error rst cause:2, boot mode:(3,7)
blob
if i add that in my code in the setup() it shows that. but if i remove it , it runs okay. what could be the problem?
Tejas H
@CodingCreate101
Mar 27 2017 10:04
It's because of EEPROM.commit(). Remove that line and test it. I am facing similar issues.
ongvanor
@ongvanor
Mar 27 2017 10:06
errr but i need that line to save the settings of the eeprom
Tejas H
@CodingCreate101
Mar 27 2017 10:06
Wait, there is also EEPROM.write(). That might be additional possibility for the problem.
Of course. How many bytes you have allocated for EEPROM?
ongvanor
@ongvanor
Mar 27 2017 10:08
it ranges to 512 right i just used until address 100
Tejas H
@CodingCreate101
Mar 27 2017 10:09
No, you can use more than that. Try increasing that value to 1024 and test. I guess the error is because of over flow. I am not certain about it, yet.
ongvanor
@ongvanor
Mar 27 2017 10:09
hmmm somewhere in EEPROM.begin(512)? so i should change it to 1024?
Tejas H
@CodingCreate101
Mar 27 2017 10:10
Yeah, try that.
ongvanor
@ongvanor
Mar 27 2017 10:10
okay trying right now
the error is still the same
Tejas H
@CodingCreate101
Mar 27 2017 10:11
Cross your fingers :)
Oops.
ongvanor
@ongvanor
Mar 27 2017 10:11
lol haha still error i tried this code in mega. but here in the esp8266 doesnt work wierd
Tejas H
@CodingCreate101
Mar 27 2017 10:14
Wait, previously what values you are storing? I meant, which data type values?
ongvanor
@ongvanor
Mar 27 2017 10:18
if im not mistaken char lol, im just wonder why it wont work
i have a part of my code in setup which is this
blob
but it runs okay just the first image code i sent gives me those error
my aim is that the user can save the SSID and pass via mobile but if the user wants to erase the value of the SSID and Pass in the eeprom the user can press hte button to erase them
Tejas H
@CodingCreate101
Mar 27 2017 10:20
Now, in first image code, replace 0(zero) with \0 and try .
ongvanor
@ongvanor
Mar 27 2017 10:24
I'll try to omit some of the codes line by line just to see where the error occurs
blob
okay i got where the error occurs it starts in the while loop
Tejas H
@CodingCreate101
Mar 27 2017 10:28
Its because of EEPROM.write()
Try this line:
EEPROM.write(i, '\0');
ongvanor
@ongvanor
Mar 27 2017 10:32
that part works just the while loop gives the error
blob
this code runs fine, as you can see I comment out the while loop, the error is in the while loop
Tejas H
@CodingCreate101
Mar 27 2017 10:37
That looks strange
ongvanor
@ongvanor
Mar 27 2017 10:46
maybe in my firmware version?
is there anyway to display the firmware version?
Clemens Kirchgatterer
@everslick
Mar 27 2017 11:15
guys, you cannot write strings that are stored in a 'String' object like that. (i'm referring to the struct above!) @tejas007tez
String is a complex type, it will only contain a pointer to the real data it holds and not the data itself. writing that String object to the EEPROM is bogus.
Tejas H
@CodingCreate101
Mar 27 2017 11:45
Thanks for responding. So, it should be character array, then?
Ohh right. Now I have realised. So that's the reason why I was getting weird output. It's because of inefficient way of handling of address' right?
Nikolas Beutler
@biacz
Mar 27 2017 12:10
hey guys, i got this and this and it does not work. any advice whats wrong? http://imgur.com/a/tABZR - https://gist.github.com/biacz/d1255d44841736e09f1234d0e4418cae
Lan-Hekary
@Lan-Hekary
Mar 27 2017 12:11
I am Wondering why nobody is looking in the Pull requests ?? There is a lot of them ..
ongvanor
@ongvanor
Mar 27 2017 12:15
hi guys how to use pin D4 to pin D9 of the NodeMCU esp8266-12e dev board?
Nikolas Beutler
@biacz
Mar 27 2017 12:18
@ongvanor what do you mean exactly?
just use as described here
ongvanor
@ongvanor
Mar 27 2017 12:20
im using pin D0 to D4 in output for LEDS i want to use D5 to D8 as input pins is that possible?
Nikolas Beutler
@biacz
Mar 27 2017 12:22
sure
ongvanor
@ongvanor
Mar 27 2017 12:23
so i can say that pinMode(D4,INPUT); to declare as input?
Nikolas Beutler
@biacz
Mar 27 2017 12:23
i always use the GPIO numbers
like pinMode(12, INPUT);
ongvanor
@ongvanor
Mar 27 2017 12:23
ohhhh i see thanks :)
ongvanor
@ongvanor
Mar 27 2017 12:29
is there libraries i should add? im getting confused its not working lol
Nikolas Beutler
@biacz
Mar 27 2017 12:32
no
is this true that GPIO16 can only be used in read and write? other pins like D5 to D10 cant be used?
Martin Ayotte
@martinayotte
Mar 27 2017 13:13
As the notice says, GPIO16 can't support interrupt. Also, it has a PullDown, but no PullUp. Other than that, it can be use as normal GPIO.
ongvanor
@ongvanor
Mar 27 2017 13:15
how about D5 to D8 can i use it for input button? i've been coding for hours cant find a solution
ongvanor
@ongvanor
Mar 27 2017 13:38
im having this error rst cause:2, boot mode:(3,6), can this be a not enough power, im powering up in VIN 5+ 2A power supply will that be enough or i should really have a 3.3v converter to power up the module
Nikolas Beutler
@biacz
Mar 27 2017 13:38
thats fine
hmm when do you have the error exactly?
ongvanor
@ongvanor
Mar 27 2017 13:44
blob
when the loop goes in that function
resetSsidandpwd is D0 and is set to input
Nikolas Beutler
@biacz
Mar 27 2017 13:46
well you are resetting your ESP. so you would see the above rst cause message
ongvanor
@ongvanor
Mar 27 2017 13:48
oh crap i missed that area thanks for noticing
it should be inside the if statement
Steve Nelson
@zenmanenergy
Mar 27 2017 13:55
Am I looking at the wrong page... the filesystem docs don't have the file.write() method. https://github.com/esp8266/Arduino/blob/master/doc/filesystem.md
Martin Ayotte
@martinayotte
Mar 27 2017 14:13
@zenmanenergy , File class is derived from Stream, and Stream is derived from Print, and Print has the write() method.
Steve Nelson
@zenmanenergy
Mar 27 2017 14:14
So, the file object itself does not have a write method?
Martin Ayotte
@martinayotte
Mar 27 2017 14:14
No need to overwrite this method, simply use the derived one.
Steve Nelson
@zenmanenergy
Mar 27 2017 14:15
ok. I think I understand. thanks
Martin Ayotte
@martinayotte
Mar 27 2017 14:15
Welcome
ongvanor
@ongvanor
Mar 27 2017 14:46
node mcu has really have small number of inputs is there a way i can use PWM as input with buttons that have different resistors that makes them unique in pressing?
Steve Nelson
@zenmanenergy
Mar 27 2017 14:53
There are very inexpesive modules on ebay that will increase the number of GPIOs. I got some a few years ago, haven't played with them since, but if I recall, you connect the module to the esp through i2c, then there are libraries to read and write to the additional pins. I think the ones I used added 8 GPIOs
ongvanor
@ongvanor
Mar 27 2017 14:54
can i have a sample? i might find one in here locally (hopefully)
Martin Ayotte
@martinayotte
Mar 27 2017 14:55
PCF8574 or MCP23017
Steve Nelson
@zenmanenergy
Mar 27 2017 14:55
Here's one from my purchase history PCF8574T
jesus martin is fast.
$1.30 from China
I didn't need to, but I'm pretty sure you can add a whole crapton of these to a single device by changing the dipswitches. I think you can add up to 64 GPIOs with these.
ongvanor
@ongvanor
Mar 27 2017 15:07
never saw this kinds of module here locally errrr i need 4 GPIO
Steve Nelson
@zenmanenergy
Mar 27 2017 15:40
The ESPhttpUpdate class only updates the bin file, correct? It doesn't overwrite the SPIFFS files. Is that right?
bobcroft
@bobcroft
Mar 27 2017 16:15
@ongvanor, Hi I would scrap the idea of using a resistor ladder to determine which of 4 buttons is pressed, its not reliable. As Martin suggested use an I2C port expander. I use the PCF8574 with great success for both inputs and outputs. for example I use one to get the address of a particular module. I also use one a relay driver for eight relays. So I get 8 extra inputs and 8 extra outputs for just two ESP8266 I/O pins SDA/SCL. If you use different I2C addresses with PCF8574 modules then you can expand to 256 I/O. PCF8574 modules are readily available on Ebay.
I would also suggest the as you develop code to use the library examples, get them working then tweak them to suit your specific need. In that way you are starting from a solid base. Another suggestion is to go on line and look for Neil Kolban's book on the ESP8266. Its excellent!
Michael Miller
@Makuna
Mar 27 2017 17:00
@ongvanor @bobcroft Not reliable? I have done this with at least one project and there are several prebuilt button boards that are analog (using resistor networks). I built a library to turn it into input events here GitHub/Makuna/AnalogKeypad.
The only thing you have to understand is that you can't press more than one button at a time AND that its not interrupt based so that when you code, using delays() will make it not work well; but any project of significance will avoid delays() already.
bobcroft
@bobcroft
Mar 27 2017 19:13
@Makuna . Good points. I too have used analogue buttons, I was trying to use 10 buttons so probably a bit ambitious for me and I wasn't aware of your library at the time. I also found that if I accidentally caught two buttons I got erroneous readings. I agree about delays. Anyway ongvanor now has a few ideas to help him on his way
Michael Miller
@Makuna
Mar 27 2017 20:41
Theorically, if the resistors are power of 2, then you should be able to read multiple buttons down, but due to limited analog (10bit) and general noise, this would at best equate to only 8 buttons (2 bits of error); and more likely around 5-6 buttons.
ongvanor
@ongvanor
Mar 27 2017 23:34
@bobcroft and @Makuna thanks for the input guys. i just need 4 buttons and each buttons is unique, i wont be pressing multiple buttons,
@Makuna can i use that library in the esp-12e dev module?
ongvanor
@ongvanor
Mar 27 2017 23:56
the A0 is pretty inconvenient for 1Vmax input
it would be better if it was 3.3v