Arduino and ESP01

Hello, I originally posted this as a reply within a project but I think it needs its own section.

After a lot of searching Iā€™m looking for some help specifically with the arduino uno/nano and the esp01

My questions are:
Can the esp01 be used to control all the outputs on the uno/nano or is it limited to just two outputs?

Does the esp01 need to be coded separately to the uno/nano or can the uno/nano take control and just use the esp01

I was thinking that if the esp01 could output using pwm the uno/nano could read the variable and use this to control the other uno/nano pins?

The project Iā€™m looking to build is a door opener to my chicken coop. I already have the system working with a light sensor and forward/backward motion through a h-bridge. Now I would also really like to control remotely via thinger.io. I want to use the arduino as I plan to add more sensors soon.

Thanks for reading. Iā€™ve been having real trouble with my research.

Thanks and Happy Christmas. Liam

Hi Liam,

While iā€™m not well versed enough to answer all of your questions pertaining to the ESP-01, I do know that its IO pins are very limited. Adding an arduino might only further complicate things for you considering the arduino UNO and Nano run on 5v and the ESP runs on 3V. This is why I have chosen to use the ESP-12E based on the NodeMCU Dev board which makes programming a breeze (thanks to its built in ch340 usb to serial) and has plenty of IO available.

One of the perks is that they can be programmed using Arduino IDE and there are tons of examples out in the wild. I hope this helps!

Liam, as far as I know and tried:

The ESP01 can easily be used with uno/nano as a ā€œslaveā€ device and you can communicate with it via serial. The communication is held using AT protocol, in my ESP01 there was always the AT firmware preloaded so no action on ESP side is required. I am using this library on uno/nano: https://github.com/bportaluri/WiFiEsp.
I recommend you to update the ESP firmware to the newest version, especially if you want to use https protocol.
Donā€™t use fast speeds on the software serial port on uno/nano, they are unreliable. I am using the old but good 9600 bps.
Donā€™t forget to convert signals and power from 5V (arduino) to 3.3V (esp) or you could burn the ESP.

In general I donā€™t see a problem using ESP01 as master and the uno/nano as a slave communicating each other via serial. But it requires custom programming on both sides. I havenā€™t tried this.

The single microcontroller solution is the one recommended by Javier - use ESP12 with more i/o pins. I have no knowledge about ESP programming, unfortunately.

Jiri

Hello Javier and Jiri,

Thanks you for your replies.

It seems like the idea to use the Esp01 with Uno is quite old and pre dates the development of Esp boards with more I/O pins.

I looks like of I download the Esp8266 update to the arduino ide I will be able to code an esp12e as if it is my Uno but already with WiFi access so I will try using this for my project.

Thanks again for your replies and I will post an update with how I get on.

Happy new year!

Update for you - my Esp12e arrived today and I already have it up and running with blink.

Thanks for your help!

Now to integrate with my existing project!

Hello JiriBilek.

I think you can give me a big help, see my post here please
https://community.thinger.io/t/esp8266-uno-with-https-github-com-bportaluri-wifiesp/293

really thanks

Hi, I have updated the Arduino library in Github for supporting the WifiESP library (it should be available for direct download within some hours). However I have not tested it, as I have no an ESP8266 connected to an Arduino. Use the ESP8266AT example for testing!

Hi @lmcde3 and others,
I did some testing in the last few days (see The Internet of Thinger ESP8266 + UNO with https://github.com/bportaluri/WiFiEsp) and I must say that your idea to use ESP as a controller and Arduino as an sensor interface sounds to me better than the reverse setup (my idea :confused:).
You have to connect the devices, it should be quite simple using serial communication. Of source you have to develop some kind of protocol between the both.
Jiri