I'm after a little advice as struggling to get my head around something!!!
i have a esp8266 01 and a 07. i need to be able to send some info to an MQTT server this would be a lux level from GY-30 BH1750FVI and a standard motion detector. the aim is that i can send the light level back to the node red server via MQTT and then have a number of functions carried out in node-red.
Timer and motion sensing but both will only work if light level is low enough. so it will always be triggered between 4pm and 10pm if its dark but then rest of the time come on if it senses movement again if dark. this will then power a lamp in the hall.
esp01 has no analogue pin 07 has 1 from what i can tell. so i'm thinking that i would need the esp07 set up in the normal way with bounce etc to detect the load from the motion sensor but what about the lux sensor. only way i can think of is use the arduino to run the sensor and get the value then report this back to the esp to then broadcast back to the mqtt server.
Is this the best way or can i use the arduino to run everything and just connect with the ESP to send the info in which case i could use the esp01 for everything??!??!?
SDA and SCL imply I2c rather than analog so you dont need the analog pin for that sensor..
From ESP8266 Thing Hookup Guide - SparkFun Learn
Wire – The ESP8266 should work with any I2C sensor you can throw at it – just use the same Wire API calls you’re used to. There are a few differences:
Pin definition: The ESP2866 doesn’t actually have any hardware I2C pins – those labeled on the Thing are the default, but you can actually use any two pins as SDA and SCL. Calling Wire.begin() will assume pins 2 and 14 are SDA and SCL, but you can manually set them to any other pin by calling Wire.begin([SDA], [SCL]).