Programming your Pi Zero over USB
Here’s a really neat solution from the inestimable Dan “PiGlove, mind where you put the capitals” Aldred. If you’re not able to get to another screen or monitor, or if you’re on the move, this is a very tidy way to get set up.
This is a really comprehensive guide, taking you all the way from flashing an SD card, accessing your Pi Zero via Putty, installing VNC and setting up a graphical user interface, to running Minecraft. Dan’s a teacher, and this video is perfect for beginners; if you find it helpful, please let us know in the comments!
40 comments
Dan
#piglove!
Vizulize
David Cameron?
Yves
Anyone know What the host is for Kali Linux {BackTrack}
Brandon F.
Has anyone had any luck getting this to work on an Ubuntu host? I’ve tried many times without success. All the tutorials seem to cover only Windows and the Apple OS.
AndrewS
There’s lots more info (and helpful comments?) at http://blog.gbaman.info/?p=791
Belese
You need to go to manage network, select the correct interface, go to ipv4 ans select something like ‘share with another computer’. Sometimes i need to do a disconnet reconnect from host. Pi even have internet connections this way.
fearnleyp
Some tips if you are trying this from Ubuntu or other Linux distros:
1) When you connect the Pi Zero, it should create a new wired connection in network manager. You need to open this (network manager (right-click network icon in toolbar) – Edit connections…) and go to the ‘IPv4 settings’ tab. Change the method to ‘Link-local only’ and click Save and OK.
2) Try different USB cables – I had a problem where I couldn’t connect, turned out the USB cable I was using didn’t have all 4 pins connected. If it doesn’t make a new network connection, chances are the USB lead isn’t right!
Dougal
Many thanks for that. Its something I had forgotten.
Sidney Bryson
I have not read and already find it useful, having had to do everything from dragging an HDMI cable to cross dev on rpi3 when i had rpi0 networking problems. Can’t wait!
Tim
added dtoverlay=dwc2 to config.txt
added modules-load=dwc2,g_ether after rootwait in cmdline.txt
from PuTTY I enter in raspberrypi.local (port 22)
And I get this PuTTY error
“Unable to open connection to raspberrypi.local
Host does not exist”
I am not sure what I missed. I tried this from a Windows 7 machine and from a Mac OS 10.11.15
This is a really great idea and I would love to get it to work. I am doing this on a Pi Zero with latest Raspbian from NOOBS 1.9.2
michael
looks like … bonjour service lacking and/or your zero is not up. See video (min 0:29) for the link.
Tim
Thanks for this advice, it was good to check, however…
I have installed the Bonjour for Windows, both for print services and then the full iTunes 12.1.3 64 bit install. The Bonjour service is running however I still get the PuTTY error “Unable to open connection to raspberrypi.local
Host does not exist”
Dan
Hi, trying turning off Networkin / WiFi. I used Windows 10 and this was causing the same issue. Once it had found the Pi I could turn WiFi back on.
Dan
I used Jessie OS so not tried it with n00bs. Try the host name ‘raspberrypi’
AndrewS
Did you actually install Raspbian using NOOBS plugged into a monitor before trying this? Are you sure you edited the config.txt and cmdline.txt on Raspbian’s boot partition, rather than on NOOBS’ recovery partition?
Tim
Long story short is I imaged a new SD card using a fresh NOOBS 1.9.2 version and I was able to get this to work finally. I assume there was something on my card that was preventing me from getting this to work initially. So I appreciate everyone’s advice and it was great to finally get this working. It’s a very neat way to access the PI. I had no issues and it was very straight forward once I used a fresh card and image.
mic_s
It looks like … bonjour service lacking and/or your zero is not up. See video (min 0:29) for the link
Alec Clews
I do the same thing with a model B, but with an ethernet cable so I don’t need to load the special module.
Neil
Now we’re talking. Much better!
Ryan
Is there a way to share an internet connection with the pi zero through this method?
Syed Anwaarullah
I’d also like to do that. I’d like to improve on this method of Sharing WiFi through a LAN Cable: https://anwaarullah.wordpress.com/2013/08/12/sharing-wifi-internet-connection-with-raspberry-pi-through-lanethernet-headless-mode/ and use the USB instead.
AndrewS
This is covered at http://blog.gbaman.info/?p=791
Make sure you read all the comments too, as they contain lots of useful info.
Syed Anwaarullah
Thank you. Found the info here: http://blog.gbaman.info/?p=791#comment-136336
Bsimmo
Might just give this a go, but surely a true PiAddict would run it from their Pi3 ?
(It actually took me a while to realise pigpio was not PigPio)
Liz Upton
That letter G is troublesome.
AndrewS
As troublesome as the P in raspberry? ;-)
Albert
Did a write up a while back. Not using the simple method but the original.
http://www.winkleink.com/2016/05/minecraft-on-raspberry-pi-zero-using.html
Not USB, but you can use an Ethernet cable to achieve the same thing on other Pi. Yes you will have to provide power separately.
http://www.winkleink.com/2016/05/using-only-ethernet-cable-to-connect.html
I used this with X forwarding over SSH for a fair while.
Works great except for Minecraft.
Şerif
lol, no programming here. our software is much better and also raspberry pi, so performance is trying to IOT’s other
Tom
I live in the sticks and have slow internet. I already have a zero ssd with a few hundred other apps installed and configured. Is it possible to just add repositories and do this or do I have to start again from scratch?
AndrewS
If you’re already using an up-to-date Jessie installation ( https://www.raspberrypi.org/documentation/raspbian/updating.md ), you should be fine to start from there.
There’s no repositories to add, you only need to edit two text files on the /boot partition :)
Andrew Hart
I suggest that for user on the Windows platform a better alternative to putty is kitty. This can be got from http://www.fosshub.com/KiTTY.html
Clive
I’m a big fan of SmarTTY. I’ve used PuTTY for years, but SmarTTY was an eye-opener when I downloaded it recently.
Doruk Eker
Hello All,
I am on a OS X El Capitan and having some problems.
Any help?
I followed the steps:
– Flash the latest Rasbian Jessie image
– Edit the config.txt and cmdline.txt as instructed
– Place the microsd to the Pi
– Connect the Pi to the computer via a USB-to-microUSB cable from the USB port of the Pi
– I wait couple of minutes to make sure the boot is finished
– I start the Terminal
– and ‘$ ssh pi@raspberrypi.local‘
– It gives me ‘Could not resolve hostname raspberrypi.local: nodename nor servname provided, or not known’
Any help is much appreciated
Doruk Eker
Addition: nothing is added in the list System Preferences > Network
Not sure if this is important though
Doruk Eker
It was just a cable issue :(
I replaced the cable and all works fine.
Great tutorial!
Sid
hello
i just got Pi Zero and trying headless.
i could not able find my PI device as ETHERNET in device manager/ control panel – network sharing. could anybody suggest what may be gone wrong.
(am using WIN-10. followed all the above pre-request mentioned.)
really appreciate the help
Srinivas
It doesn’t seem to be working. I have tried with latest Jessi lite version and little old version. Mine was pi zero version 1.3. tried with windows 8.1. Also, followed some instructions in assigning ip address, but no luck. Please post if any one had similar issues and solved. Thanks. But this is what I was looking for instead of using Ethernet cable approach
Vedant
I have connected to the Raspberry Pi zero using a USB and PuTTy (SSH). I want to establish a connection from my PC to the RPi zero – SSH using a Xbee Transceiver pair(http://www.digikey.com/product-detail/en/digi-international/XB24CZ7WIT-004/602-1560-ND/5322374). I intend to connect the Xbee to the serial pins, and a sensor to the RPi USB.
Question: I want to be able to connect to the RPi using a Visual C++ script through Xbee and initiate a python code on the SD card to start polling the sensors and send back the read values, and maybe also hae the capability to edit the code through SSH. What is a good way to do this task?
Relatively new to RPi, please help! Thanks!
Yaron Blinder
First off – kudos on this, really great.
My issue – after getting all this set up on my win10 laptop (including shared internet) I’m now installing several packages (everything required for openCV as described by pyimagesearch), but my Windows keeps crashing (BSOD) whenever there’s a big file download. I’m wondering if perhaps the raspi is having trouble handling the data transfer over usb0 which is averaging ~2MB/s?
Would love a solution to this. Thanks!
Yaron Blinder
Update:
Was able to overcome said problem by directly downloading the necessary files to my laptop then transferring to raspi via pscp. Still would like to investigate the reason for the BSOD – doesn’t happen every time, and seems to occur more during longer downloads.