How to connect to a Raspberry Pi Zero W using nothing but a single micro USB cable.

General support for the Pi-Star System
Post Reply
KE7FNS
Posts: 445
Joined: Wed Apr 17, 2019 11:11 pm

How to connect to a Raspberry Pi Zero W using nothing but a single micro USB cable.

Post by KE7FNS » Fri Aug 16, 2019 4:52 am

So, while I was playing around with a new RPi Zero W I ran into some difficulty getting it to connect to my N network. I've noticed my other RPi 3 B+'s are also experiencing the same issue with connecting to the N network too, so I'll need to figure out what that issue is at a later date. I normally use wired connections it isn't very important right this second.

I ran into the issue where the only OTG cable I had has a 90 degree bend to the right that conflicted with the power input. So I had no way of connecting a keyboard and monitor to the RPi so I could access the command line.

I tried the whole auto access point and used my phone to configure it with my network settings but it refused to connect after entering the correct network details, so I was stuck with no way access this RPi and figure out what was going on.

This is the solution I came up with.

I loaded the SD card in a windows machine and edited the following two files.

open config.txt and add the following line at the end of the file

Code: Select all

dtoverlay=dwc2
What this does is selects the dwc2 USB controller driver


open cmdline.txt and add "modules-load=dwc2,g_ether" after rootwait

Code: Select all

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_ether quiet noswap ro
You must keep the exact order and formatting separating the parameters with a single space and make sure it is all on one line.

After that you simply take the RPi Zero W and insert the SD card with the changes you just made. Then plug in a normal usb Micro to A cable to the USB port on the RPi Zero W, DO NOT CONNECT ANYTHING TO THE POWER micro usb port, and then connect the other end of that USB cable into a USB port on a computer.

The computer will power up the RPi Zero W and it will begin booting. After a minute or two your computer should detect a new network device. Mine labeled it as "USB Ethernet/RNDIS Gadget"
Then all you do is open a web browser and type in "http://pi-star/" and then configure your RPi Zero as normal.

to return everything back to normal you can either insert the SD card into a computer or ssh in and edit the files back. (if you ssh in make sure you run rpi-rw)

simply insert a # in front of dtoverlay=dwc2 or remove that line and save.

and remove modules-load=dwc2,g_ether and save.

I hope someone finds this useful and interesting, I know I sure did.
All views, comments, posts and opinions shared are entirely my own.

User avatar
YT5HOK
Posts: 12
Joined: Fri Aug 16, 2019 9:20 pm
Location: KN04fr

Re: How to connect to a Raspberry Pi Zero W using nothing but a single micro USB cable.

Post by YT5HOK » Tue Aug 20, 2019 6:33 pm

That is very useful workaround... Although I failed to do it.
I would be thankful if you take a look at my config and cmdline files... Maybe there's something different...

Code: Select all

# For more options and information see
# http://rpf.io/configtxtreadme
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
#dtparam=i2s=on
dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
#dtparam=audio=on

# Free up some RAM
gpu_mem=16

# Enable UART
enable_uart=1

# Dissable Pi3 Bluetooth (so that UART works)
dtoverlay=pi3-miniuart-bt

#Undeclock Pi3 / Overclock Pi1
#arm_freq=900
temp_limit=75

# Increase USB Current
max_usb_current=1

# Buster Support
dtoverlay=vc4-fkms-v3d

# D2RG UART over SPI
dtoverlay=sc16is752-spi0-ce0
dtoverlay=dwc2 

Code: Select all

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_ether quiet noswap ro
Using Pi-Star V4.1.0-RC2 and modem FW Pi-Star_RPi_V4.1.0-RC2_08-Jul-2019

73 de YT5HOK

KE7FNS
Posts: 445
Joined: Wed Apr 17, 2019 11:11 pm

Re: How to connect to a Raspberry Pi Zero W using nothing but a single micro USB cable.

Post by KE7FNS » Tue Aug 20, 2019 8:40 pm

It looks correct to me, and I double checked my post to make sure it didn't have any typos.

When you connected the micro USB cable, you used the port labeled USB on the Rpi Zero W, correct? The power micro connector was left unconnected.

Then when you plugged the other end of the USB cable it into your computer, you waited a minute or two (for the pi to boot) and the OS detected a new device? It takes at least a minute or two for things to complete.

You didn't mention what OS you are running, so I'm just going to assume Windows 10. Windows 7 or 8.1 would be similar but slightly different like no SSH from the command line for example.

Once the OS detects a new device you should be able to access it as you would through the network with the same programs like ping, ssh or a web browser.

try this.

Code: Select all

winkey+r
type in cmd in the run prompt, hit enter
A command prompt window appears

at the command prompt type

Code: Select all

ping pi-star
(this assumes its a fresh pi-star image using the default hostname, if you've changed the hostname to something else then use it instead)


that should work, but if it doesn't try

Code: Select all

ping pi-star.local
it should respond to pings, you could also try

Code: Select all

ssh pi-star
or in my case I use putty, so where I normally type in the IP address and port, I just type in the default hostname "pi-star" and hit open

Give it another try, I think you'll be able to get it working.
All views, comments, posts and opinions shared are entirely my own.

User avatar
YT5HOK
Posts: 12
Joined: Fri Aug 16, 2019 9:20 pm
Location: KN04fr

Re: How to connect to a Raspberry Pi Zero W using nothing but a single micro USB cable.

Post by YT5HOK » Tue Aug 20, 2019 10:36 pm

Thanks for quick reply!

Yes, USB connected to USB port, PWR port not used. RPi booted, but there is no new hardware found. I even did "scan for hardware changes" in device manager (windows 10, as you correctly assumed).

Changed USB port, but nothing. Changed USB cable and voila! It's working!

I take care of my stuff in general and this is first broken USB cable ever, not counting those destroyed by water (rain), for which I knew they are, before arriving at destination (on my motorcycle :D ).

I deliberately left whole this post, cause I was writing while doing stuff one by one, so people who read this be aware of simple things that cause problems.

Sorry to bother you... :oops:

73 de YT5HOK

KE7FNS
Posts: 445
Joined: Wed Apr 17, 2019 11:11 pm

Re: How to connect to a Raspberry Pi Zero W using nothing but a single micro USB cable.

Post by KE7FNS » Tue Aug 20, 2019 11:20 pm

Nah, its not a bother at all.

I'm just glad someone else found the information useful and decided to give it a try too.

I've had 2 USB mini cables die on me in the last week too. One was a 5 inch one that I loved to use to connect to my multiple flash memory adapter.
All views, comments, posts and opinions shared are entirely my own.

User avatar
YT5HOK
Posts: 12
Joined: Fri Aug 16, 2019 9:20 pm
Location: KN04fr

Re: How to connect to a Raspberry Pi Zero W using nothing but a single micro USB cable.

Post by YT5HOK » Wed Aug 21, 2019 7:35 am

Yes, of course it's useful. Better then bother with temp AP when RPi doesn't connect/find familiar Wi-Fi.

3rd party cables are no good these days, that's why I try to keep OEM cables (received with some devices) in good condition.

Thanks again for good info!

73 de YT5HOK

AF6VN
Posts: 280
Joined: Fri Jul 20, 2018 1:15 am

Re: How to connect to a Raspberry Pi Zero W using nothing but a single micro USB cable.

Post by AF6VN » Wed Aug 21, 2019 2:51 pm

YT5HOK wrote:
Tue Aug 20, 2019 10:36 pm
Changed USB port, but nothing. Changed USB cable and voila! It's working!
Any chance that was a /charge-only/ cable. Some devices come with cables that don't have data-lines, just the voltage lines.

--
AF6VN
Dennis L Bieber

User avatar
YT5HOK
Posts: 12
Joined: Fri Aug 16, 2019 9:20 pm
Location: KN04fr

Re: How to connect to a Raspberry Pi Zero W using nothing but a single micro USB cable.

Post by YT5HOK » Wed Aug 21, 2019 3:59 pm

Could have been... But I don't think so. No way to tell now, it's gone. :D

Let me ask you guys one more thing... Cause this tweak is a keeper, is there any negative effect of leaving it "as is", except maybe a small impact on memory and CPU cycles?

KE7FNS
Posts: 445
Joined: Wed Apr 17, 2019 11:11 pm

Re: How to connect to a Raspberry Pi Zero W using nothing but a single micro USB cable.

Post by KE7FNS » Wed Aug 21, 2019 9:12 pm

YT5HOK wrote:
Wed Aug 21, 2019 3:59 pm
Let me ask you guys one more thing... Cause this tweak is a keeper, is there any negative effect of leaving it "as is", except maybe a small impact on memory and CPU cycles?
As far as I can tell it would only make a difference if you regularly plugged devices into that micro USB port, because it replaced the default OTG driver, so that port no longer functions like that anymore and since pi-star is meant to be headless I don't think it would affect anything at all.
All views, comments, posts and opinions shared are entirely my own.

User avatar
YT5HOK
Posts: 12
Joined: Fri Aug 16, 2019 9:20 pm
Location: KN04fr

Re: How to connect to a Raspberry Pi Zero W using nothing but a single micro USB cable.

Post by YT5HOK » Thu Aug 22, 2019 8:31 am

Understood.

Thanks again!

73 de YT5HOK

Post Reply