Hello,
I am trying to establish communication between an ESP32 S3 and an arduino nano. For the implementation, I need to use only the usb connection (there's power for both boards). Using simple Serial.print() doesn't work, I guess because both boards are devices and not hosts. The esp is on paper capable of being usb host, but I didn't find a way to do it.
Any recommendations?
Thanks,
Eyal
Hello @eyalp and welcome to the Forums.
I'm not sure there is already an implementation for this; it may be more complicated than it looks, unfortunately.
If you are willing you can start from this library which should enable USB Host on the ESP32-S3, but only for keyboard and mouse it seems. I haven't tested it, so have no more info than that website.
Note that once the USB port switches to host mode, even uploading new sketches will be tricky: you will have to disconnect your hardware, connect to the PC and reboot into the bootloader every time.
Hey thanks for your response!
Starting from the end, The esp module has a bootloader button on the back, so connecting to a pc while clicking it lets you program it.
About the library, there's this fork which seems to implement a Serial use case (and a serial ftdi which may be better). With that, After playing with it for a while it isn't very clear how to use it even when looking at the examples.
Thanks again for your response,
Eyal
I moved your topic to a more appropriate forum category @eyalp.
The Nano ESP32 category you chose is only used for discussions directly related to the Arduino Nano ESP32 board.
In the future, please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.
Thanks in advance for your cooperation.
any particular reason to use two microcontrollers? it complicates a system by an order of magnitude (programming two micros plus the communications protocol)
why not just use the ESP32 ?
if you do need to communicate consider alternatives, e.g. TTL seral, I2C, SPI, etc
remember the nano uses 5V logic the ESP32 3.3V logic - use potential dividers or level converters when interfacing the devices
The nano is used as an external controller to an already existing machine, where the only available output is the esp32's usb
I asssume the nano USB you wish to connect to the ESP32 is the standard Nano USB programming port/serial monitor connection? or do you have a USB shield connected to the nano?
if it is the nano programming port it runs a serial device protocol which you could connect to the ESP32-S3 USB OTG interface and run a serial host protocol to communicate. I am assuming the S3 has two USB connectors USB (OTG) and COM (programming)
I have implemented a USB serial host on a PIC24FJ1024GB610 but not on the ESP32-32 - i would assume there is a suitable library
a simpler approach may be to connect the ESP32 Serial1 hardware port to the nano using a FTDI USB to TTL-3V3 cable
you then read/write bytes from/to the Serial1 device etc etc
Firstly, thanks for the detailed answer!
The nano is a standard mega328, with no shield, with a ch340 chip for serial to usb.
What is the serial device protocol? is it documented somewhere?
The esp has only one usb port, that can function either as a CDC or OTG device.
Is your library on github? I'd love to take a look.
Thanks again
it is the USB CDC class
the ESP32-S3-DevKitC-1 v1.1 I have has two USB connectors COM and USB
if you only have one USB which would connect to the nano what woud you use for programming/serial monitor output
still think a FTDI USB to TTL 3V3 serial lead (you can get cheaper ones on Ebay) is the simplest approach - connect the Nano USB serial IO to the ESP32 Serial1 hardware port
In general the application also has a TFT display and external power so the serial monitor and programming should not be used regularly. I'll try to use an FTDI, but the usb cable is preferred for a neater implementation. Do you think I could communicate with the nano using a CDC library? If so that would solve the problem
thinking again the FTDI may not work - the nano needs a host CDC device to communicate with
do you need to use an ESP32-S3 ? what is it going to do?
I have connected Arduino USB ports direct to Raspberry Pi USB inputs - the Arduino appears as a serial port (similat to a Windows COM port) which can be read/written from/to using languages such as C++, Java Python, etc
see the example code in Espressif USB CDC - it may do what you require
thanks,
If I understand my problem correctly, I need to figure out how to use the esp32 s3 as a cdc host. This library on paper does that, but I can't figure out how to use it as it is not documented.
should be possible using the example code
converter is required to be able to connect the ESP32-S3 to the nano mini USB B, e.g.
USB 2.0 A Female to Mini USB B converter
then should be able to connect the ESP32-S3 to the USB A female
Hardware is figured out, I have a converter (which is tested to have data wires). For some reason on all settings and with different libraries, even when transferring data the nano's RX TX leds don't light up, and no data is received.
how do you power the nano? can the ESP32-S3 supply sufficient power?
Nano has a lipo with the appropriate circuitry, esp is connected to the wall using a power supply.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.