• 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

UART handling on an ESPNOW project

Q&A Forum › Category: ESP32 › UART handling on an ESPNOW project
0 Vote Up Vote Down
Jose M. Escrich asked 5 years ago

Dear all, I’m writing you with some doubts about a part of my current project, I love the radio controlled boats and I’m projecting to make some changes on the way I take information from my small boat,  until now, I was using BLE, through an HM-10 board, attached to my Atmega 328 based onboard system, to get in my iOS phone some telemetry information, as battery voltage, temperatures, value of some signals and so, then, I put this information on the BLE card via UART, defining a port with a defined baud rate and so, and the result was as in the attached pictures, I can use this link only at few meters away from my boat, my intention now, it’s to use the same UART output to send the most of this information to an ESP32, inside the boat, collecting on this same ESP32 some more information, more temperatures, levels and so, then once done I want to use ESPNOW to send the information, more than 100 meters away, to a second ESP32 near me, this one will be attached to an screen, I have several kinds of screens and I think this will be not a problem, but in one of the cases, because I could use an screen with UART interface, I think I can solve the most of the problems, but my main concern now it’s how to handle something as simple as some UART inputs and outputs on the ESP32, could you, please, give me some help on it?

Question Tags: atmega328, communication, telemetry, UART
8 Answers
0 Vote Up Vote Down
Steph answered 5 years ago

Hi Jose,

I have not yet experimented with inter-board communication with UART link. However, I am wondering why you absolutely want to transfer data from your ATmega328 to the ESP32, when the ESP32 could also fulfil the functions of your ATmega328? You are adding complexity and an extra module that will consume power.

Well, obviously, I don’t know your circuit, so I guess you probably need to spread the load over 2 microcontrollers (maybe because of the number of pins?). I’m just wondering 🙂

Anyway, you can read the following article which details each pin of the ESP32:

ESP32 Pinout Reference: Which GPIO pins should you use?

You will see that the ESP32 has 3 UART interfaces. While browsing through the comments I saw that Sara advised to go and watch this video to know more about it:

Additional ESP32 Serial Channels in Arduino IDE (Quickie)

However, I unfortunately did not find any specific article on the issue on the RNT website.
(but maybe there are some … maybe I didn’t look hard enough?)

I hope this will help you see things more clearly.

0 Vote Up Vote Down
Jose M. Escrich answered 5 years ago

Dear Stéphane, first of all thanks a lot for your fast answer, I was working in UART communications between systems since 1985, long time ago, and I feel confident doing that, it’s a good way to exchange information, if you have not lots of info to transfer, referring to change the Atmega, there are different applications for different chips, I think the Atmega it’s good enough to do the job, and have some advantages over any other system in this specific situation, by a lot of different reasons, yesterday night, after write this comment I found the video from Andreas Spiess, the one you’re recommending me, but anyway I still have a doubt, GPIO and GPIO3, both are part of UART0, then the question is are USB and UART0 the same connection?, are them sharing same signals?

0 Vote Up Vote Down
Jose M. Escrich answered 5 years ago

As far as i know this will be a way to use the three UART outputs:
/* ESP32 3 UARTs */
HardwareSerial Serial1(1);
HardwareSerial Serial2(2); // Choose two free pins
#define SERIAL1_RXPIN 12
#define SERIAL1_TXPIN 13
void setup()
{
Serial.begin(115200); // This is serial 0
Serial1.begin(9600, SERIAL_8N1, SERIAL1_RXPIN, SERIAL1_TXPIN); // This is serial 1, definning pins as we need
Serial2.begin(4800); // pin 16=RX, pin 17=TX, and this is Serial 2 with default pins
}
void loop()
{
// Do something wonderful, preferably using UARTs once defined
}

0 Vote Up Vote Down
Steph answered 5 years ago

Dear Jose,

Okay, I bow 🙂

Maybe the simplest way to find out is to plug an LED on these pins and see if it lights up during an upload, don’t you think?

I’m sorry… I’m still a beginner in the fields that you probably know better than me, but here’s an idea that comes to mind…

Assuming you wish to use the DoIt ESP32 DevKit v1 board, you can also take a look at this documentation. It seems to indicate that the USB port is linked to Serial0:

0 Vote Up Vote Down
Steph answered 5 years ago

Our answers have crossed!
But thanks for this piece of code, I take note of it 🙂

0 Vote Up Vote Down
Jose M. Escrich answered 5 years ago

Good tip to use leds to know if we have flow on USB, I think you’re not a beginner, you really have a deep knowledge, but it’s not possible to deeply know absolutelly everything, thanks again for the whole of your help

1 Vote Up Vote Down
Steph answered 5 years ago

Ha ha,

That’s very kind of you to say that, but I assure you I’m a real novice in this field!

Anyway, it was my pleasure to give you a (good) tip 🙂

0 Vote Up Vote Down
Jose M. Escrich answered 5 years ago

Many thanks for your words, I hope to disturb you again in a near future

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

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 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.