ESP32 Nano with Data Streamer

I'm trying to stream data to Excel using the Data Streamer add in. I can get it to work fine with an Arduino Uno, but it seems that Excel does not recognise the ESP32 Nano board. No data comes back into Excel from the ESP32 (but it does from the Uno).

Has anyone else encountered this problem? And have a solution?

I can't help as I don't use Excel and I don't have a a Nano ESP32. Do you see the expected data when you're using Serial Monitor (or another terminal program)?

The difference from a Serial perspective is that the Nano ESP32 uses the USB provided by the processor while the Uno uses an additional chip (serial-to-ttl converter) which provides that functionality. That might have something to do with the issue.

Hi sterretje, thanks for your reply :slight_smile:

To answer your question directly, I do see the expected data using the Serial Monitor.

I was completely unaware of the issue you highlight about how the USB connection is made - thanks for that. I'm afraid I do not know how to use the information you've given, but it's still interesting to know, thank you.

For boards with native USB where you don't want to miss the initial data, the approach is to use while(!Serial); in setup(). After a reset, the board will hang there till a communication channel is opened (read: till e.g. Data Streamer opens the connection with the board).

This is not always desired behaviour as your board will stop dead in its tracks after reset when that is implemented.

Do you have a while(!Serial); in setup? If not, add it and check if it does the trick; if yes, remove it and check if it does the trick.

Does Data Streamer expect a certain format? I assume that it wants some form of indication that whatever is talking to it knows what it's doing.

Interesting to learn about some of the reason for the difference, thank you!

I added while(!Serial); to setup(). It made no difference I could see - I did not receive the data into my Excel spreadsheet.

I couldn't find out much about the format Data Streamer expects. I know it is comma separated, but I suspect there is more to know. The Microsoft page is not very helpful, I found.

I was able to find a little more from Microsoft, but that is still not enough to get me unstuck, unfortunately.

1 Like

I will see if I can find something. The solution I have mentioned using Rx/Tx and Serial1 should work. Unless Data Streamer wants to see a real Uno and not a clone. Is your Uno an original or a clone?

Hi @chis. Those who have previous encountered problems getting serial data from the native USB boards like Nano ESP32 in external applications reported they found it was caused by a difference in how the application manages the serial control signals (e.g., DTR) compared to the working Serial Monitor. For example:

The solution was more simple for them because they could adjust the code of their application to assert the signal correctly, but since this is a closed source application that won't be possible.

I can suggest an experiment that might serve to test my hypothesis:

  1. Close all Excel windows.
  2. Select the port of your Nano ESP32 from Arduino IDE's Tools > Port menu.
  3. If it is not already open, select Tools > Serial Monitor to open Serial Monitor.
  4. Close Serial Monitor by clicking the X icon on its tab:
  5. Start Excel

Now check to see if you see the data being received in the Excel spreadsheet.

The idea is that maybe opening Serial Monitor is sufficient to persistently initialize the serial port of the Nano ESP32, and that after Serial Monitor has performed that initialization, the port will work as expected when it is reopened by Excel.

I don't have Excel installed on my computer so I can't check to see if this works, but it is worth a try at least.

Thanks so much @sterretje. I'm afraid I am unable to follow your solution for lack of technical chops!

I was able to get data out of an original Arduino Uno. My goal is to get data out of an original Arduino ESP32 Nano.

Hi @ptillisch, thanks for your reply!

I followed the steps you suggested. I had to add a few steps at the end - once Excel was open, clicking on Data Streamer in Excel, selecting the device and starting data. Unfortunately, I still see no data coming across.

In case it helps, when I have my Arduino Uno connected, Excel recognises the Uno. When I have the Nano connected, it recognises that there is a USB Serial Device on port 15, but does not 'know' that it is an Arduino.

The screenshot shows the dropdown menu when BOTH devices are connected to illustrate the difference. (When I have been trying to transmit data, there has been only one Arduino connected)

I don't have an Arduino Nano ESP32, but I decided to see which of my Arduinos would work with Microsoft Data Streamer for Excel.

I already new that Uno R3 worked.
I found out that the following worked:
Mega2560 and MKR 1010.

Uno R4 Wifi and Uno R4 Minima did not work.


The models that work have their name displayed in full on the dropdown menu.
The ones that don't work are just described as a USB Serial Device.

This agrees with chis's findings.

What happens when you choose the other USB Mode under the tools menu in the IDE. It's currently probably set to TinyUSB, the alternative is Hardware CDC.

I'm absolutely not familiar with your board so you do this at your own risk; it would be something that I would try. The board might then be recognised by Windows device manager as a Nano ESP32 (and hence Data Streamer will follow suite).

I think that you need to re-upload.

Hi @sterretje , thanks again!

I had a lot of excitement trying your proposed fix. But no resolution, sadly.

The com port moved from 15 to 16 and the device was recognised by the IDE as a "DFRobot Firebeetle 2 ESP32-S3". The code compiled fine, but then I got:

"No DFU capable USB device available
Failed uploading: uploading error: exit status 74"

After a few goes double-pressing reset, I was able to get back to 'normal' on COM port 15.

Hi @JohnLincoln , thanks for going to the trouble of trying all that stuff out. Great to have confirmation that you're seeing the same kind of thing that I'm seeing!

Below shows the option to use the Uno as a serial-to-usb converter. Note that I'm not much of an electronic engineer :warning:

The output of the serial-to-usb converter on the Uno (Rx pin) is connected to the Rx of the nano ESP32. So the Nano ESP32 can receive from the serial-to-usb converter of the Uno and hence receive data from the PC. Similar applies for the Tx of the Nano ESP32 so it can transmit to the PC through the serial-to-usb converter of the Uno.

It's important to keep the Uno in reset; the wire for that is drawn.

Because the Rx on the Uno is a 5V signal I have added a voltage divider (R1/R2). You might have to make R1 a 1k resistor because an official Uno already has a 1k resistor between the serial-to-usb converter and the Rx pin.

I've also added R3 to make sure that current will be limited; not sure if it's necessary.

In your code, use Serial1 instead of Serial for communication with the Data Streamer.

:warning:
Unless somebody will verify the schematic, you will be using the setup at your own risk
:warning:

Hey @sterretje , thanks so much for going to the trouble of sketching that out - much appreciated!

I have a level shifter, so presumably I'll be safer and the circuit is likely to be more reliable if I insert my level shifter to deal with the 3V3 <> 5V issue? If using resistors has an advantage over a level shifter, please mention it.

The only thing is that the Arduino ESP32 Nano is inserted into a custom PCB I made for my application. I do not currently bring out the D0 & D1 pins and make them available on the PCB, so I'll have to do some bodge soldering to get them out. Oh well, that's on me and I can do another spin of the board if it seems worth it :slight_smile:

Thanks again, I won't get to try it today, but should have time tomorrow.

Hi @sterretje , I just tried your suggestion. I was unable to make it work :frowning:

I wired up the circuit as you had suggested, minus all of the resistors. I inserted my level shifter between the:
RX of the Uno and the RX of the Nano; and the
TX of the Uno and the TX of the Nano.

I was careful to provide a common ground and to ground the reset pin of the Uno.

The Nano was programmed to Serial.print() ascending integers as a test. Excel recognised the Uno, but no data came across.

I put the TX pin of the Nano on my oscilloscope to see if anything was being transmitted. Nothing was there. This is true whether the serial monitor in the Arduino IDE is open or closed.

So it seems that the data is not getting to the TX pin of the Nano.

Thanks again for taking the trouble to think about this in so much detail! Any further suggestions very welcome.

You'll have to use Serial1 instead of Serial. So Serial1.begin() instead of Serial.begin(), Serial1.print() instead of Serial.print() and so on.

You did say about Serial1, and I missed it. Thanks for pointing it out again. Sadly, still the same result - nothing comes out to the TX pin on the Nano with the suggested set up.

I did a bit of Googling and found a discussion on a similar topic.

'Inspired' by sample code from that link, I put the following sketch on my Nano:

#include <HardwareSerial.h>
HardwareSerial SerialPort(2); // use UART2
int count = 0;
void setup()  
{
  SerialPort.begin(15200, SERIAL_8N1, 16, 17); 
} 
void loop()  
{ 
  SerialPort.print(count);
  delay(250);
  count++;
}

I don't claim to know fully what this does, but one thing it did was send a BCD representation of count to pin A0. The yellow trace is the output of A0 and the cyan trace is on the same signal path, after it has been level shifted up to 5V (NB yellow: 1V/div, cyan: 2V/div).

The cyan trace goes to pin TX on the Uno. When I connected the Uno to a laptop, I was able to Connect a Device in Excel as before, but still, when I click Start Data, even though Excel acknowledges the Start Data command by greying out the button, I get no data.

It should be a binary representation, not a BCD representation :wink:

That sets up a HardwareSerial called SerialPort. Below from HardwareSerial.cpp

#if ARDUINO_USB_CDC_ON_BOOT //Serial used for USB CDC
HardwareSerial Serial0(0);
#else
HardwareSerial Serial(0);
#endif
#if SOC_UART_NUM > 1
HardwareSerial Serial1(1);
#endif
#if SOC_UART_NUM > 2
HardwareSerial Serial2(2);
#endif

This creates 3 HardwareSerial objects with the names Serial, Serial1 and Serial2.

You can test if Serial2 instead of SerialPort in post #19 will also output data on A0.

You can print out SOC_UART_NUM in a test sketch with a simple Serial.println(SOC_UART_NUM) in setup(). Check the value that you get and let me know.