User avatar
emanuel.kent
Posts: 20
Joined: Fri Mar 13, 2020 10:33 pm
Location: Germany

Use micro USB as UART on PI Zero for external wifi module

Sat Mar 28, 2020 3:49 pm

The Wifi range achievable with the Pi Zero W is not enough for my application. For that reason, I would like to use a standard Pi Zero and connect it to an external Wifi Module with external Antenna. The antenna properly placed will give me a better range. A USB dongle could work but they are normally too big and heavy for my application.

What I have bought is the D1 MINI PRO, which is based on the ESP-8266EX chip.

The main problem is: D1 MINI PRO requires a UART and in my understanding, the pi Zero has only one (pin 14 and 15). Unfortunately this is already BUSY with another device that is fundamental for the project.

My question is: considering that the UART of the Pi ZERO is already busy, is it possible to connect the D1 MINI PRO to the PI using the Micro USB?

Both D1 MINI PRO and Pi Zero have a micro USB, so I was thinking to wire myself a USB-to-USB cable to link the two. Basically I would like the Pi to see the D1 MINI PRO as the Wifi hardware of the board.

Do you think that is feasible and could you eventually suggest from where I could start?

Thanks! Emanuel

User avatar
hansotten
Posts: 360
Joined: Fri Jul 13, 2012 6:01 am
Contact: Website

Re: Use micro USB as UART on PI Zero for external wifi module

Sat Mar 28, 2020 4:14 pm

Using a USB serial adapter is required here and those works fine on the RPi. Nearly all types (FTDI, CH340, PL2303) are autodetected and deliver a ttyUSB0 device.

Check the voltages of the D1 Mini UART and choose your USB serial adapter if it needs 3.3V or 5V. And do not be confused what is called RX and TX on both sides,often messed up in the docs, it is easily to connect it the wrong way around and not seeing any traffic.

You will need an USB to micro USB adapter cable for the zero. . An USB hub may be handy to also attach keyboard/mouse for development.

Now having a serial connection means you will also have to design a protocol and implement it on the Pi and D1 Mini Pro to have data flowing.

You might be better of by improving the Wifi range with a Wifi extender between your Pi and the Widi access point, that will be transparant instead of the mess of wires and software you get into with the D1 Mini and USB serial adapter ....
http://duinorasp.hansotten.com for Raspberry Pi and Arduino and ESP8266
http://retro.hansotten.nl for retrocomputing with the 6502 cpu

User avatar
Rukbat
Posts: 27
Joined: Fri Nov 11, 2011 3:59 pm

Re: Use micro USB as UART on PI Zero for external wifi module

Sun Mar 29, 2020 10:19 pm

If what you're really looking for is a "plug it in and forget it" WiFi dongle with external antenna, the Adafruit module (https://www.adafruit.com/product/1030) may be a lot easier for you. It's $20, but you just plug it in like any WiFi dongle and you're done - no programming, no figuring out how to interface it.

User avatar
emanuel.kent
Posts: 20
Joined: Fri Mar 13, 2020 10:33 pm
Location: Germany

Re: Use micro USB as UART on PI Zero for external wifi module

Fri Apr 03, 2020 9:13 am

Thank you for your suggestions!

@Rukbat: considering that using D1 mini is so complicated, I ordered a Wifi dongle. The main reason I didn't like it is because of the size which is normally quite bulky, but seem like I have no alternatives. I couldn't find the adafruit with quick delivery in this period in my area, so I bought the "Wireless-N USB adapter" from here

I built on my own an adapter from micro-USB to a female standard USB (simply wiring + with +, - with -, D+ with D+ and D- with D-).

I'm specifying that because normally on UART we are used to connect RX with TX and viceversa. I thought this is not the case for USB .. correct?

Now I found some instructions in order to disable BT and Wifi of the RPZeroW, by inserting in the /boot/config.txt file the following lines:

Code: Select all

dtoverlay=disable-bt
dtoverlay=disable-wifi
These lines actually work because after reboot, PZero doesn't connect to my Wifi anymore

What should be the next step? I understood that I need to modify something on the /etc/network/interfaces file, but how do I tell to use the Wifi connected over USB? this is what I have for the moment, that doesn't work:

Code: Select all

source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

User avatar
hansotten
Posts: 360
Joined: Fri Jul 13, 2012 6:01 am
Contact: Website

Re: Use micro USB as UART on PI Zero for external wifi module

Fri Apr 03, 2020 1:13 pm

Sure the USB wireless adapter works after your rewiring the USB and disabling wifi?

Just plugging in a wireless adapter will give you a second wifi channel that works on a Pi, if you ave set the country right. Once that works try to disable the onbaord wifi.

what does lsusb tell you?
http://duinorasp.hansotten.com for Raspberry Pi and Arduino and ESP8266
http://retro.hansotten.nl for retrocomputing with the 6502 cpu

Return to “Advanced users”