samdevolder
Posts: 9
Joined: Thu Nov 03, 2016 2:21 pm

Raspberry pi zero connect via USB

Fri Nov 18, 2016 11:13 am

Hello guys

I am trying to connect my pi zero to my PC with windows 10 through a usb cable.

I have followed many guides but it just won't work.
My usb drivers don't recognize the pi zero and I can't find software for it...

Anyone know where to get this or how to connect ?

Thanks


User avatar
DougieLawson
Posts: 40247
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Raspberry pi zero connect via USB

Fri Nov 18, 2016 11:53 am

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

aBUGSworstnightmare
Posts: 2330
Joined: Tue Jun 30, 2015 1:35 pm

Re: Raspberry pi zero connect via USB

Fri Nov 18, 2016 12:00 pm

Simple steps:
1.) add new line to 'config.txt' with

Code: Select all

dtoverlay=dwc2
2.) in 'cmdline.txt' you need to add below modules after the 'rootwait' statement

Code: Select all

modules-load=dwc2,g_ether g_ether.host_addr=00:22:82:ff:ff:20 g_ether.dev_addr=00:22:82:ff:ff:22
g_ether.dev_addr will assign the MAC address to the network interface on the Pi Zero and g_ether.host_addr lets you assign the MAC address visible to the host PC. Doing this allows you to distinguish between different Pi Zeros (connected to the same host) quite easy. Numbers above are examples only; changed the last two digits i.e.
3.) be sure you have Bonjour sevice running on your Win10 host (installs with iTunes i.e.). You can also use the IP address when you want to connect via SSH. VNC and SSH connection can be used simultaniously.

Alreday discussed here viewtopic.php?p=1000628#p1000628 (i.e.)

samdevolder
Posts: 9
Joined: Thu Nov 03, 2016 2:21 pm

Re: Raspberry pi zero connect via USB

Fri Nov 18, 2016 1:18 pm

Thank you for the fast answers.

I know all the codes and read those site a thousand times :D

But I have found a mistake and now my pi zero can cannect to my pc but I can't find it with putty...

I type "raspberrypi.local" but I always get the message that the host doesn't exist..

fruitoftheloom
Posts: 24587
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Raspberry pi zero connect via USB

Fri Nov 18, 2016 1:24 pm

samdevolder wrote:Thank you for the fast answers.

I know all the codes and read those site a thousand times :D

But I have found a mistake and now my pi zero can cannect to my pc but I can't find it with putty...

I type "raspberrypi.local" but I always get the message that the host doesn't exist..
Did you install BonJour on your Windows PC ? (it is either a standalone download or included with iTunes)
Thinking outside the box is better than burying your head in the sand...

samdevolder
Posts: 9
Joined: Thu Nov 03, 2016 2:21 pm

Re: Raspberry pi zero connect via USB

Fri Nov 18, 2016 1:46 pm

fruitoftheloom wrote:
samdevolder wrote:Thank you for the fast answers.

I know all the codes and read those site a thousand times :D

But I have found a mistake and now my pi zero can cannect to my pc but I can't find it with putty...

I type "raspberrypi.local" but I always get the message that the host doesn't exist..
Did you install BonJour on your Windows PC ? (it is either a standalone download or included with iTunes)
Yes I have I think. If I go to task manager, by services there is Bonjour running. Or how do you open it ?

I just think my PC doesn't recognise the Pi Zero as an usb ethernet device...
How can I change that ?

aBUGSworstnightmare
Posts: 2330
Joined: Tue Jun 30, 2015 1:35 pm

Re: Raspberry pi zero connect via USB

Fri Nov 18, 2016 2:00 pm

- Check your device manager for a RNDIS device - if there is no such device your Zero was not recognized at all --> check if configuration is right
- Install iTunes since it has the latest Bonjour service
- use the IP address to SSH (instead of raspberrypi.local)

If everything fails -> get a MAC :lol: :shock: :? (and rid of Windows)

samdevolder
Posts: 9
Joined: Thu Nov 03, 2016 2:21 pm

Re: Raspberry pi zero connect via USB

Fri Nov 18, 2016 2:10 pm

aBUGSworstnightmare wrote:- Check your device manager for a RNDIS device - if there is no such device your Zero was not recognized at all --> check if configuration is right
- Install iTunes since it has the latest Bonjour service
- use the IP address to SSH (instead of raspberrypi.local)

If everything fails -> get a MAC :lol: :shock: :? (and rid of Windows)
There is no RNDIS device that is the problem.. But how do I fix this ?
Where can I change the configuration of the pi ?

And I did download the latest Itunes :)

samdevolder
Posts: 9
Joined: Thu Nov 03, 2016 2:21 pm

Re: Raspberry pi zero connect via USB

Fri Nov 18, 2016 3:14 pm

It's just that my PC doesn't recognize my pi zero as an RNDIS ethernet gadget because I don't have that driver...


Anyone knows where I can find this driver ?
Or how I can fix this ?

DenJS
Posts: 4
Joined: Fri Nov 25, 2016 6:06 am

Re: Raspberry pi zero connect via USB

Fri Nov 25, 2016 6:12 am

Hi everyone,
I just downloaded Jessie Lite image, unpacked did all required changes to get that usb/ethernet connectivity and it worked like a charm. Then I've decided that I have to do these usual things: apt-get update and then upgrade
After upgrade and reboot I've lost that usb/ethernet thing... my mac & pc do not see anything and windows cannot recognise my Pi Zero, it says "Unknown USB device".
Any help would be much appreciated... I can rollback of course but just curious what happens as I don't have kb/mouse anywhere around my only connection was through g_ether module...
Thanks!

dubsdj
Posts: 10
Joined: Fri Mar 10, 2017 10:08 pm

Re: Raspberry pi zero connect via USB

Sat Mar 11, 2017 11:45 pm

So I have managed to get in. The device was showing up as a USB device and I needed to manually install the driver for windows 10. I found the driver on reddit

https://www.reddit.com/r/raspberry_pi/c ... indows_10/

direct link: http://domotique.caron.ws/wp-content/up ... %20OTG.zip

updated USB driver to this RNDIS driver and then rebooted the Pi.. I am now at the terminal

wow that was an effort!

dubsdj
Posts: 10
Joined: Fri Mar 10, 2017 10:08 pm

Re: Raspberry pi zero connect via USB

Sun Mar 12, 2017 2:25 am

Is there a way to get the usb0 to connect to the internet? I've tried adding static addresses to /etc/network/interfaces and dhcpcd.conf but nothing works. Ifconfig shows the static address but cannot ping it or ping 8.8.8.8 from the terminal.

Ernst
Posts: 1353
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Raspberry pi zero connect via USB

Sun Mar 12, 2017 7:16 am

dubsdj wrote:Is there a way to get the usb0 to connect to the internet? I've tried adding static addresses to /etc/network/interfaces and dhcpcd.conf but nothing works. Ifconfig shows the static address but cannot ping it or ping 8.8.8.8 from the terminal.
Yes you can, but first you have to go back to the original network configuration and then you have to use google to find how to activate "internet connection sharing" on your Windows computer.
The road to insanity is paved with static ip addresses

dubsdj
Posts: 10
Joined: Fri Mar 10, 2017 10:08 pm

Re: Raspberry pi zero connect via USB

Sun Mar 12, 2017 2:20 pm

So I finally figured it out after been led down many wrong paths in google.
Solution was from a post here: http://blog.gbaman.info/?p=791

Someone called Jarez posted this and it worked!

Ok after following this tutorial, I am now operating my Pi completely headlessly and with internet access (Windows):
1. Follow the instructions in the tutorial
2. Once the Pi Zero appears as an ethernet device in device manager make sure the drivers are completely up to date (Right click and search online for drivers) luckily windows found them and pulled through for me.
3. Open up putty and SSH using default port 22 and the address rapberrypi.local
4. If all you want it terminal access stop here, if you want graphical access continue.
5. You may want to configure the Pi Zero to have a static IP address on your home network, therefore you will need to edit the network interfaces file, type in “sudo nano /etc/network/interfaces” on your putty terminal.
6. Comment out everything but the line “source-directory /etc/network/interfaces.d” and add all the information corresponding to your network setup as such:
(information can be obtained by using cmd on your windows computer and typing “ipconfig” recording all important addresses such as gateway, broadcast etc if you dont already know them)
*************************************
auto lo
iface lo inet loopback
allow-hotplug usb0
iface usb0 inet static
address 192.168.0.XXX # whatever IP address you want the pi zero to occupy however it must not clash with the IP’s currently on the network or the ones which the DHCP assigns.
netmask 255.255.255.0
network 192.168.0.0 # the base IP of your network
broadcast 192.168.0.255 # whatever your broadcast #address is
gateway 192.168.0.1 # gateway IP for your network
nameserver 8.8.8.8 # google nameserver
dns-nameserver 8.8.8.8 8.8.8.4 # google dns servers
***************************************
7. Hop back over to your windows computer and go into “change adapter settings” in the networks and sharing center.
8. Click on properties on Pi Zero ethernet adapter, and then click on ipv4 properties, set the IP address acquisition to manual and enter the static IP address you want assigned to the Pi Zero, along with the broadcast address, leave the gateway blank.
9. Save these settings, and then highlight your Wi-Fi / Ethernet device and also your Pi Zero eth adapter and then click on “add to bridge” – this will bridge these two adapters and allow internet access to be shared.
10. Restart your Pi Zero with the changes you made in step 6.
11. Restart your computer also if necessary.
12. When your computer starts up head over to putty log in to your Pi and type ifconfig in the terminal, you should see the ip address you assigned appear as the IP address of the device.
13. Double check connections by pinging the IP address of the host device and then ping http://www.google.com , if this does not work try pinging 8.8.8.8 which is a google nameserver, if it can get a response your DNS configuration may be an issue. Please check your route table and ensure that it has added the route to your host computer and to the router.
14. If you can ping google you are in good shape, type in “sudo apt-get install xrdp” , then reboot
15. Windows should already have installed remote desktop connection, type in the IP address you have assigned to the Pi Zero and you should be able to set up a remote connections, complete with visual control over the single USB cable!
16. If you have any issues, post and I may be able to help.

dubsdj
Posts: 10
Joined: Fri Mar 10, 2017 10:08 pm

Re: Raspberry pi zero connect via USB

Sun Mar 12, 2017 4:07 pm

I've now got a desktop via VNC and performance is OK however are there any tweaks to increase the performance of a VNC session? thanks.

Ernst
Posts: 1353
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Raspberry pi zero connect via USB

Sun Mar 12, 2017 5:45 pm

dubsdj wrote:So I finally figured it out after been led down many wrong paths in google.
Solution was from a post here: http://blog.gbaman.info/?p=791

Someone called Jarez posted this and it worked!

Ok after following this tutorial, I am now operating my Pi completely headlessly and with internet access (Windows):
1. Follow the instructions in the tutorial
2. Once the Pi Zero appears as an ethernet device in device manager make sure the drivers are completely up to date (Right click and search online for drivers) luckily windows found them and pulled through for me.
3. Open up putty and SSH using default port 22 and the address rapberrypi.local
4. If all you want it terminal access stop here, if you want graphical access continue.
5. You may want to configure the Pi Zero to have a static IP address on your home network, therefore you will need to edit the network interfaces file, type in “sudo nano /etc/network/interfaces” on your putty terminal.
6. Comment out everything but the line “source-directory /etc/network/interfaces.d” and add all the information corresponding to your network setup as such:
(information can be obtained by using cmd on your windows computer and typing “ipconfig” recording all important addresses such as gateway, broadcast etc if you dont already know them)
*************************************
auto lo
iface lo inet loopback
allow-hotplug usb0
iface usb0 inet static
address 192.168.0.XXX # whatever IP address you want the pi zero to occupy however it must not clash with the IP’s currently on the network or the ones which the DHCP assigns.
netmask 255.255.255.0
network 192.168.0.0 # the base IP of your network
broadcast 192.168.0.255 # whatever your broadcast #address is
gateway 192.168.0.1 # gateway IP for your network
nameserver 8.8.8.8 # google nameserver
dns-nameserver 8.8.8.8 8.8.8.4 # google dns servers
***************************************
7. Hop back over to your windows computer and go into “change adapter settings” in the networks and sharing center.
8. Click on properties on Pi Zero ethernet adapter, and then click on ipv4 properties, set the IP address acquisition to manual and enter the static IP address you want assigned to the Pi Zero, along with the broadcast address, leave the gateway blank.
9. Save these settings, and then highlight your Wi-Fi / Ethernet device and also your Pi Zero eth adapter and then click on “add to bridge” – this will bridge these two adapters and allow internet access to be shared.
10. Restart your Pi Zero with the changes you made in step 6.
11. Restart your computer also if necessary.
12. When your computer starts up head over to putty log in to your Pi and type ifconfig in the terminal, you should see the ip address you assigned appear as the IP address of the device.
13. Double check connections by pinging the IP address of the host device and then ping http://www.google.com , if this does not work try pinging 8.8.8.8 which is a google nameserver, if it can get a response your DNS configuration may be an issue. Please check your route table and ensure that it has added the route to your host computer and to the router.
14. If you can ping google you are in good shape, type in “sudo apt-get install xrdp” , then reboot
15. Windows should already have installed remote desktop connection, type in the IP address you have assigned to the Pi Zero and you should be able to set up a remote connections, complete with visual control over the single USB cable!
16. If you have any issues, post and I may be able to help.
WARNING: This method is NOT recommended. The recommended method is to use "Internet Connection Sharing". The reason is that with ICS the Pi is not directly connected to the network, with bridging you are joining the Pi to the network which may not be permitted if it is not your own private network. Interfering with a shared network, such as in a dorm/school/company, will not be appreciated by the official network administrators. If you use bridging and static addresses you must know very well what you are doing, duplicate IP addresses on network can bring down the infrastructure and can get you into big trouble.
The road to insanity is paved with static ip addresses

dubsdj
Posts: 10
Joined: Fri Mar 10, 2017 10:08 pm

Re: Raspberry pi zero connect via USB

Sun Mar 12, 2017 9:33 pm

its my home network so no biggy but thanks for the info.

Galbi3000
Posts: 2
Joined: Thu Jan 21, 2016 7:03 pm

Re: Raspberry pi zero connect via USB

Sun Nov 11, 2018 2:52 am

I am having problems connecting the Raspberry Pi to Windows 10 over USB, I had the Bonjour service installed on my computer even before I started this, I followed the instructions on modifying config.txt, cmdline.txt and added ssh in the boot directory on Raspbian. I used nano to edit the files on a larger Raspberry Pi (using a card reader in a USB port, not switching out the main OS card!).

The problem I have is that the system does not recognise the USB device. In device manager it says "Unknown USB Device (Device Descriptor Request Failed)".

The only information I have found on this all point to the same driver from a French web site that no longer exists, namely "RPI Driver OTG.zip".

Will that driver fix the issue or is it a deeper problem? If it will fix it, does anyone have a copy that can be posted seeing as the original site is gone?

Thank you in advance :)

sarathkumar341
Posts: 9
Joined: Tue Jan 23, 2018 10:36 am

Re: Raspberry pi zero connect via USB

Sun Nov 11, 2018 3:01 am

You need to install RNDIS Driver. It happens on windows 10 mostly. Here is the link for the tutorial & driver link u needed - https://www.factoryforward.com/pi-zero- ... -resolved/

User avatar
HawaiianPi
Posts: 6006
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Raspberry pi zero connect via USB

Sun Nov 11, 2018 7:22 am

You could try the Raspbian Lite image I have pre-configured for USB Gadget mode.
2018-10-09-raspbian-stretch-lite-Pi0USB.zip
SHA-256: f17b68a8aa645176cfac97641569fdaac0a296748ef7dfc8c39c7b36ec81f3fd

It's the default Raspbian Stretch Lite image with Pi0(W) USB Ethernet Gadget mode pre-configured (config/cmdline .txt files modified and "ssh" file added with no other changes). Just write it you your SD card with Etcher and DO NOT modify anything.
  • Put the card in your Pi0 or Pi0W
  • Connect a normal micro USB data cable to the USB data port of the Pi0 (the one closest to the center)
  • Do not connect anything to the power port (the one closest to the outer edge)
  • Connect the other end of the micro USB cable to your main PC and the Pi0 should start to boot
  • Note that the first boot can take awhile, so give it a couple of minutes before you try to SSH in
It should boot up in USB Ethernet Gadget mode.

If it doesn't work, check Device Manager to see what driver (if any) was installed.

If you don't see this USB Ethernet/RNDIS Gadget driver,
Image
then something is wrong with your Windows system (it's installing the wrong driver), and you can try this driver (all the details match the driver installed in my Win10 system). Other hardware - Acer USB Ethernet/RNDIS Gadget

If you DO see that driver but it has a problem, right click on it and uninstall it, then click on scan for hardware changes in the Action menu. If that doesn't fix it you can try the driver linked above.

If the driver appears to be working, but you can't SSH into pi@rapsberrypi.local then Zeroconf/mDNS is not working on your system.

This image was tested and confirmed working on my Windows 10 notebook with my Pi0W.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Return to “Troubleshooting”