top of page
Blog: Blog2
Search
Kevin Shumaker

Raspberry Pi WiFi Gadget

This is a setup for a RPiZeroW (wireless) to enable you to connect via a USB cable or Wifi.

This can be handy if you do not have a Console Cable. This gives you a fully functional,

wifi enabled setup that allows you to diagnose issues if you don't have an OTG USB cable / hub and Mini-HDMI cable.


After imaging, you need to modify and add some files to the /boot directory prior to first start up.


Add 'modules-load=dwc2,g_ether' after rootwait in cmdline.txt


console=serial0,115200 console=tty1 root=PARTUUID=56cd6262-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_ether


add 'dtoverlay=dwc2' at the bottom of config.txt


add empty file 'ssh' [open notepad, do "file", "save as", <boot drive>/ssh]


add file wpa_supplicant.conf:

=====

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

update_config=1

country=US


network={

ssid="<your SSID>"

psk="<your password>"

key_mgmt=WPA-PSK

}

=====

Safely eject, install in PiZW, connect micro-usb cable to the usb port towards the middle, and to the PC


On your PC, if connected to wifi or ethernet to same network as the PiZW you set up in wpa_supplicant.conf, you should be able to connect to the PiZW using PuTTY or some other SSH Client using address/name 'raspberrypi'.


If successful, then we need to make a couple more changes on the PiZW side:


edit /etc/dhcpcd.conf to add at the bottom:

=====

interface usb0

static ip_address=192.168.7.10/24

static routers=192.168.2.1

static domain_name_servers=192.168.2.1 8.8.8.8

=====


My default network is on 192.168.2.x, change as appropriate for yours for router and DNS.

(PC connection will be on the 192.168.7.x network) (No, DON'T try to make them the same)


Do not reboot yet, need to make a change on the Windows side.


Windows Device Manager should show a new Networking Device:

Network Adapters, USB Ethernet/RNDIS Gadget

If it does, then we need to set a static IP for it to communicate with the PiZW on USB


Win10:

Right click the Start, click on Network Connections, Change Adapter options

Right click the RNDIS connection

Change name (I use PiZW)

Right click on PiZW

Left click Properties

Scrll down to Internet Protocol Version 4 (TCP/IPV4) and left click it.

Left click Properties at the bottom of the box

Left click the radio dot for Use the following IP address

Add address 192.168.7.1

Add Subnet mask 255.255.255.0

Leave default gateway blank

Left click OK at the bottom

Left click Close at the bottom.

Close the window for the connections.


In the SSH window type in 'sudo reboot'<enter>


Wait until the device reconnects (device chirping noise)

Start new ssh session to 192.168.7.10

run command 'ifconfig | grep inet

You should see 3 inet addresses: 127.0.0.1, 192.168.7.10, and an address on the wifi.

Success!


If you have issues, just reply and I'm happy to help you through.









64 views0 comments

Recent Posts

See All

MotionEyeOS Stand-alone Setup

MotionEye has the ability to act as a stand-alone WiFi IP camera, even in a non-networked environment. To do so, you need a Raspberry Pi,...

Comments


bottom of page