ESP8266, ESP32 and Arduino when you use each one of them?

Dear Community,

I would like to ask your help to guide me for some hardware usage:

For some function in home automation it becomes important to use micro-controller board such as Arduino, ESP8266, ESP32.

I want to ask what is the difference between them, I read technical documentations and articles about them, now I know the difference in hardware specifications. However as per your practical experiments, when you use each one of them ?

Also for ESP8266, there are lot of brands (Adafruit, Sparkfun, NodeMCU, Wimos, Wio link, …), so which one you recommend ?

And about the connection between openHAB and ESP8266, you use MQTT: is there other way to make the connection and do I need internet for MQTT-based connection ?

Hello Ahmad,

There are many different Arduino boards but the most used one, Arduino Uno has no WiFi connectivity while ESP obviusly, have WiFi. So from connectiviy point of view, Arduino has some limitations.

Ragarding communication, yes MQTT is one the methods used. Beyond that, amongst other you can use direct sockets or REST for example.

Thank you

1 Like

@a.tibi For my home automation I use Esp2866 and Esp32 for most everything. I like the Arduino, but as mentioned, it has limits when communication is needed. One big difference you should consider, the Esp is a 3.3v device (12mA) and most relays for switching power are 5v. If you don’t mind soldering and making circuits, to accommodate, this won’t be an issue. There are other options for 3.3v and power switching such as using opto-isolators relays premade such as these. [](
I have several and so far they work well. The Sonoff switches use the Esp8266 chip, they’re very popular with tasmota firmware installed, and you have an extra GPIO pin to work with.

When I consider brands it’s normally because of reliability and/or device location but I honestly couldn’t tell you the difference. I’ve never lost an Esp device and I have bought several brands and ordered from AliExpress (generic). If going the generic cheaper route, be aware documentation may be harder to find, but with a little testing it’s not hard to match pin number with GPIO. I also recommend starting with a development board over a single Esp chip.

For communication with OH, I use MQTT on all my Esp’s. There are lots of firmware options to choose from, I use Esp Easy and Tasmota, but I recommend reading up on all the popular firmware, and selecting what works best for you. If starting out new with mqtt I would pick just one, like Esp Easy, until you get the feel for how it works.

Here are a few of my OH items, both Sonoff and Esp, using mqtt.

Sonoff controlling living room light

Switch LivingRoom_Light "Living Room Light" <light> ["Lighting"] 
	{ mqtt=">[pibroker:cmnd/sonoff11/POWER:command:*:default],
	<[pibroker:stat/sonoff11-3C0826/POWER:state:default]" }

Same Sonoff using gpio 14 with temp and humidity sensor.

Number LivingRoom_Light_Temp "Living Room Temp [%.1f °F]" <temperature> ["CurrentTemperature"]
	{ mqtt="<[pibroker:tele/sonoff11/SENSOR:state:JSONPATH($.SI7021.Temperature)]" }

Number LivingRoom_Light_Humidity "Living Room Humidity [%.1f %%]" <humidity>
	{ mqtt="<[pibroker:tele/sonoff11/SENSOR:state:JSONPATH($.SI7021.Humidity)]" }

Esp8266 used for both motion and light detection with a door switch to indicate when the if open.

Number Esp_Garage_Lightlevel "Garage Light Level [%d]" <light>
	{ mqtt="<[pibroker:/Esp/Garage/LightLevel:state:default"}

Switch ESP_Easy_Door "Garage Door" <contact>
	{ mqtt="<[pibroker:/Esp/Door/State:state:MAP(]" }

Switch Esp_Easy_Motion "Garage Motion" <contact>
	{ mqtt="<[pibroker:/Esp/Motion/State:state:MAP(]" }

Here’s a snap shot of what the above looks like on BasicUI.

The question “when to use what device” is kinda up to you. I would write down everything you want to have in your home automation and from there. Like the example above, one Sonoff basic switch that controls my light and provides temp/humidity and one Esp8266 taking care of my garage (still have a few more things to add in the garage).

Best of Luck