Go Go Gadget Raspberry Pi Zero W

 

                    Happy Birthday from Raspberry Pi Foundation!!!

     March 7 was Raspberry Pi’s fifth birthday: it has been five years since we launched the original Raspberry Pi, selling a hundred thousand units in the first day, and setting us on the road to a lifetime total (so far) of over twelve million units. To celebrate, we’re announcing a new product: meet Raspberry Pi Zero W, a new variant of Raspberry Pi Zero with wireless LAN and Bluetooth, priced at only $10.

 

From: https://www.raspberrypi.org/blog/raspberry-pi-zero-w-joins-family/

20170314_115745 Pi Zero W.jpg

 

     With this announcement, I was excited to see this as an important upgrade. Finally a way to use the Zero W with WiFi from Cypress using the CYW43438 wireless chip just like the older brother the Raspberry Pi 3. The only problem was how to get one when they sell like hotcakes.Then I got my chance when on Saturday Micro Center announced stock of Zero W as 923029. So bright and early Sunday morning I went down there to get me one. Talking to the sales rep, I found they dropped shipped 200 to this store which was not their normal shipment. And yes they were going fast. BTW, the second one cost 14.99 which is still not bad.

     In addition today is Pi day! Not Raspberry Pi but that other famous Pi 3.14 etc. What more reason to read this little(ish) tutorial. I am sorry for the many steps, but I wanted a complete setup for noobs and experienced users alike. So lets get on with it.

 

                                        457746_925313_01_front_thumbnail.jpg?1488940459712                457746_925313_02_front_thumbnail.jpg

    The Dilemma

 

So I get home and start looking at the new small board and ponder how to setup this wonder without a keyboard, mouse, and HDMI monitor. Yes, I could use them and be done, but that is not the way most people would try it. Even though wireless should work, how was the configuration of wireless to get started without keyboard and monitor.

After Googling the net, I came up with an idea! The good folks at Adafruit had this article https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/ethernet-tweaks?view=all. This seemed the way to go thinking of the choices. But it was not without trials and tribulations. The serial USB seems to be the simplest until I found no logon till the TTY was setup first. A chicken and an egg problem to be sure. So without further ado, here we go.

 

     Ready Set ...

 

  1. Find the latest Jessie Rasbian Lite at https://www.raspberrypi.org/downloads/raspbian/ and download it. I chose this because it can work on a small SD card of 4 GB and does not have a graphical interface to run. This means I load only what I need. For reference I used 3/2/2017 version

  2. Next I mounted the micro SD card on a USB interface on Windows computer. I chose a  need tool called Etcher at https://etcher.io/, It is smart and simple to use. Also you can flash more than one card at a time. It will verify the image as well.

  3. Even though the tool does an "Eject" on the card for you, remove and reinsert the same card since we have a few hings to do.

  4. Look for boot (E:) on Windows. For Linux or Mac, this would be the first partition FAT32. Later it is mounted at /boot in the tree. Edit config(.txt) file with either Notepad or Wordpad. If you use Wordpad, you must be careful to save as TXT and not anything else. Firstly, save a backup copy as config2.txt to be safe. Now add the following line as the last line in file:

    dtoverlay=dwc2
    

     

    Now we can do a save as config.txt and reply Yes to overlay it.

  5. Next we edit cmdline.txt same as above. Again save a backup as cmdline2.txt. Now add the following after "rootwait" with just a space before and after. Do not hit the enter key since this file is very particular.

     

    modules-load=dwc2,g_ether
    
  6. One last edit, edit config.txt in Notepad. Do a save as and in the bottom the name is "ssh." include the period but not the quotes. Make sure all files are selected not just plain text. Then hit the save button. You should see this as a file not a text file. This will allow ssh the first time.

  7. Now properly Eject the card to use in the new Pi Zero W.

  8. Put micro SD card into Pi Zero W. Plug a micro USB into the inside called USB not PWR. I plugged this other end into a Pi 3. Why not Windows? Because of missing RDNIS driver for Windows 10 and Bonjour for Windows 10. For Windows, go to Directory: /static/beaglebone/latest/Drivers/. Select the correct version for Windows checking for 64 bit or not. Follow install procedures. Next go to https://support.apple.com/downloads/Bonjour_for_Windows, and select "Download Bonjour Print Services for Windows Vx.x.x'. Again follow install and now Windows can handle name resolution as well as RNDIS USB driver.

  9. On the Pi 3 they have both included in a full Jessie Rasbian desktop. Later I will locate and add when I find the drivers.

  10. Under the Pi 3, I opened a terminal window. Here I entered:

     

    lsusb
    

    Look for                    ID 0525:a4a2 Netchip Technology. Inc Linux-USB Ethernet/RNDIS Gadget

  11. Now we can SSH into the Zero W with: See note 1 below for more information.

     

    ssh pi@raspberrypi.local
    
  12. Reply Yes to next message to add ECDSA key and next the default password of "raspberry" (no quotes of course)

  13. Enter config file to change password and optionally host name. Also turn on SSH for future use.

     

    sudo raspi-config
    Interfacing Options
    P2 SSH
    <YES>
    <OK>
    <FINISHED>  
    <NO> to reboot now option
    
  14. Now to setup wireless settings with your SSID and PSK after any lines already there, paste and change the correct values:

     

    sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
    
    network={
      ssid="testing"
      psk="testingPassword"
    }
    
    
    
    cntl-o
    Enter
    cntl-x
    
  15. Edit the interfaces file to fix up a static USB0 so logins can be done by IP address: Skip this as it did not work as intended/

     

    sudo nano /etc/network/interfaces
    
    allow-hotplug usb0
    iface usb0 inet static
      address 192.168.5.2
      netmask 255.255.255.0
      network 192.168.5.0
      broadcast 192.168.5.255
      gateway 192.168.5.1
    
    
    cntl-o
    enter
    cntl-x
    
  16. Now reboot the Zero W with:

     

    sudo reboot
    
  17. Wait a while and try to re-login. Note any changes to the host name will affect the xxx.local name or just use the static IP of 192.168.5.2

     

     

  18. Try a ping test like:

     

    ping 8.8.8.8
    
  19. After all this bask in the sunlight and enjoy a cup of Java. Oh that is another topic. Adios amigos.