• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Can I use esp32 instead of esp8266 for mqtt outputs in home automation?

Q&A Forum › Category: Home Automation › Can I use esp32 instead of esp8266 for mqtt outputs in home automation?
0 Vote Up Vote Down
Robert Johns asked 5 years ago

Hi, I have the home automation course and was wondering if an esp32 could be used instead of an esp8266 for outputs using mqtt?
I have the code for the esp8266 that was provided here:
https://github.com/RuiSantosdotme/Home-Automation-Course/blob/master/code/mqtt_esp8266_leds.ino
What would need to be changed in that code to make an esp32 work?
 
Thanks,
 
Bob

2 Answers
0 Vote Up Vote Down
Robert Johns answered 5 years ago

Looks like I can answer my own question. 😉  In case anyone else needs to know, everything is exactly the same as in that file except you don’t use #include <ESP8266WiFi.h>, remove that and put this in it’s place: #include <WiFi.h> which allows the esp32 to connect to wifi.
Using the esp32 gives you more output pins but in my case, I have version 4 that has the external antenna setup so I can now connect to the wifi from my garage where the esp8266’s were not connecting.
If your having connection issues, you might want to go with the esp32’s like I did.
 
Bob

0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Ho Bob.
I’m glad you found the answer for your own question.
I’ll mark this issue as resolved. If you need further help you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.