Send data with Arduino uno + ESP8266 over MQTT

Hello, i have a project that uses sensors connected to an arduino uno, but i need to send the data to a server through mqtt. I have an ESP8266, and my question is if it is possible to use the esp connected to the arduino uno to send the sensor data using the esp wifi and mqtt.
I have searched and tried some examples online but none of them worked.

Show the most believable try You made. Then we have something to start from.
Unfortunately forum will not dump a complete solution in You knee

So do I. I wonder if it is the same one? :thinking:

Because you see, there are many variations of the ESP8266 (and I actually have quite a few each of three or four different ones).

If you need to use WiFi, the best advice is to connect all the sensors to the ESP8266 instead of the clumsy UNO. When you have that working, it will be relatively easy to add the necessary WiFi code. :+1:

It's definitely not! Your unit can't be in OPs hands at the same time! Joking! Maybe the same kind.....
No evil thoughts. Just recovered after a frequently happening Windows Outlook crash and built up steam that has to be let out....

What requires you to use Windoze? :thinking:

Possible? Yes. But probably the worst way to do it. Or as Marvin says:

"This will all end in tears. I just know it."

Just use an ESP board like the Wemos D1 Mini or NodeMCU instead of the Uno.

"This will all end in tears. I just know it."

If that's so it's only because people here with nothing better to do will find more than enough time to obstruct and sidetrack you.

If you have sent data to mqtt via esp wifi then the rest is academic. If you haven't then this probably isn't the place to start.

You might find this useful

Sidetrack? No, we're offering "project guidance" (the title of the forum).

Your 'project guidance' is nothing more than "Dumping".
But, Hey, Good Job, you succeeded in your Crusade, Marvin.

Yes.

Why not just get a ESP8266 with enough GPIO pins to do the sensors and send the data?

Otherwise hook the Uno to the ESP8266 with the proper level shifting thingies and use software serial as a data exchange thingy.

The words "send data uno to esp8266" generate a good result set.

next words like "esp8266 mqtt code" might get you results like,

GitHub - Doug-Wyman/ESP8266_MQTT_light: Micropython code for controlling an RGB and White light using an ESP8266 controller board of my design.

Even an ESP-01(S) has enough GPIO pins to service dozens of digital sensors. Using pin expanders is going to be far easier than programming communication with a UNO.

And there are I²C ADCs if you need them.

Thank you all for your suggestions, it seems the way to go is to simply discard the arduino uno and use the esp8266 alone.

Which board? I personally recommend the Wemos D1 Mini.

Correct.
It is just a sign of the times. The ESP family are all cheaper, faster, and have more memory than the Uno and those of that ilk. I understand that, even if you are short of pins compared with a Mega, you are better off with some port expander on an ESP than wasting its resources by hooking it up to an Arduino and covering yourself with grief.

What "grief"?
Honestly, what the heck are you talking about?
What is impossible, or so darned hard, or 'grief covering', or whatever it is, about a serial link between a UNO and an ESP-01 (which is an "esp8266")?

ESP - You there UNO?
UNO - Here's some data (per plan).
ESP - Catch you later, gonna knock this up to Telegram

No one ever said it was impossible- only that using the ESP alone is most often the easier solution.

Keep it up, Marvin.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.