Post topics, source code that relate to the Arduino Platform

User avatar
By trackerj
#49898 If you have also another MCU for runnig the main code and reading the sensor/s and ESP8266 is used just for data transmission then the easiest way to do it is to just switch ON/Off the ESP8266 power under ATmega control.

Why do you need there also an Atmega...this is another story and something that I really don't understand exactly. I must admit that I find this kind of setups quite funny, where the Application MCU is about 50-100 times slower/less resources than the peripheral/communicaton one :)
User avatar
By Joe Job
#49899 The ESP8266-01 is used for wifi connectivity to the MQTT broker, this device has analog sensors which as of yet I have not been able to get working on an ESP8266-01, haven't spent much time on it. Also before I began using ESP8266 at all my projects were ATMEGA based so I am simply aimed using the ESP for connectivity for existing projects, many of the projects have more sensors than pins available on the 01. Also other issues I have seen with the ESP is after sleep issues getting wifi to connect again successfully let alone reconnecting to an MQTT broker. In the next version I will drop the analog sensors and work on just having the motion sensor with ESP and MQTT. For now I want to complete the projects I started. Good idea about turning wifi off via the MCU hadn't thought of that.
User avatar
By trackerj
#49903 If you have a separate "Main Application MCU" (the Atmega in your case) then just use one digital I/O pin of it to do the power ON/Off for the ESP8266.
On the Atmega Software side you just need to add your new "Transmitter ON" or "Transmitter OFF" functions (aka PIN High/Low or Low/High, depending on the MOSFET type you want to use for ESP8266 Power switching) and that's it. I will suggest you a P-MOSFET and high side switching but it's your choice, you know better your setup.
User avatar
By Joe Job
#49904 Thanks will definitely look at that mate. I have got devices only using ESP8266 as well as the ultimate goal is to get all my devices down to the lowest amount of hardware/power etc. Is there a way for ESP8266-01 to read analog, haven't begun looking at it fully so just asking in advance, what I had looked for hadn't found anything. Re the ESP8266, I am thinking light sleep is the best method and modem sleep, then have that wake up on pin change, in this case motion sensor, I think that is the best route ?