and it is super hard to reach the back of the console after you stuck it to the TV cabinet XD.
OK, let's look this at EBGames and Ebay, WHAT! AU$48 for a second hand one! I bought my second Xbox 360 for AU$75 only. There must be a cheaper way.
Internet tells me that the easiest alternative is to use a wireless router as wireless repeater to provide ethernet connection to Xbox. But the cheapest wireless router support repeater mode is about AU$50 already and don't even think about the additional power supply and bulky router box. I remember that I used to share my wireless connection to ethernet from my Mac Mini to Xbox, so if I can do the same with a super cheap computer, then I can build my own wireless adapter.
Talking about super cheap computer, who can beat our old friend Raspberry Pi Zero! Order one from Core-electronics directly for AU$10.48 incl. shipping. Now I need an Ethernet module and PC USB wireless dongle. According to Raspi.TV, ENC28J60 chip is supported by Raspbian out of the box, so search the key word in Ebay and find the cheapest one. I bought my one for about AU$4.00. According to my reading, EDUP wireless adapter is well supported by Raspberry Pi and it is super cheap as AU$2.99 on Ebay. Adding other pieces the total cost is:
Raspberry Pi Zero: $10.48
ENC28J60 Ethernet Module: $4.00
EDUP wireless adapter: $2.99
USB OTG cable: $1.00
USB charging cable: $1.00
0.5M Cat5 Ethernet cable: $1.00
Male to Female jump leads: $1.00
2GB Micro SD card: $4.00
Total: $25.47
Hooray! Just half of the official second hand adapter price!
Now let's do it!
Step 1: Download the Raspbian image from https://www.raspberrypi.org/downloads/raspbian/, since we only need the wireless bridge feature, just download the smallest RASPBIAN STRETCH LITE image (The image size is 1.8GB and after burning, there is still 700MB free space on my 2GB SD card). Then burn it to the Micro SD card. I am using the official Mac guide https://www.raspberrypi.org/documentation/installation/installing-images/mac.md and you can find all the guides from https://www.raspberrypi.org/documentation/installation/installing-images/README.md.
Step 2: Change the keyboard layout to US, otherwise, you won't be able to type double quotation from your US layout keyboard.
Log in to the console via default username and password:
raspberrypi login: pi
Password: raspberry
pi@raspberrypi:~$ sudo vi /etc/default/keyboard
Change the line
XKBLAYOUT="gb"
To
XKBLAYOUT="us"
Save the file and reboot your Pi.
Step 3: Connect the Edup wireless dongle to Raspberry Pi Zero and enable it. I use the static IP address just for easy debug and safety.
pi@raspberrypi:~$ sudo vi /etc/network/interfaces
allow-hotplug wlan0
auto wlan0
iface wlan0 inet static
wpa-ssid "<My SSID>"
wpa-psk "<My Password>"
address 192.168.1.254
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
Save and reboot your Pi, your wireless adapter should work by now.
Step 4: Prepare the SPI configuration for ENC28J60 module
pi@raspberrypi:~$ sudo vi /boot/config.txt
Uncomment the line by removing the start # symbol
dtparam=spi=on
Add following line
dtoverlay=enc28j60
Shutdown your Pi and let's getting to the hardware part.
Step 5: Connect the cables between Pi and ENC28J60. According to Raspi.TV (the photo on their website actually misconnect the 3.3v lead :D), we only need connect 7 leads:
ENC28J60 Pi
INT/LNT Pin 22 (BCM 25)
SO Pin 21 (BCM 9/MISO)
SCK Pin 23 (BCM 11/SCLK)
Q3/3.3 Pin 17 (3.3v)
GND Pin 20 (GND)
CS Pin 24 (BCM 8/CE0)
ST Pin 19 (BCM 10/MOSI)
Step 6: Set up the bridge between the wireless adapter and ENC28J60 ethernet module according to pathead's instruction. I add the installing dnsmasq package and auto open iptables steps.
pi@raspberrypi:~$ sudo apt-get install dnsmasq
pi@raspberrypi:~$ sudo vi /etc/network/interfaces
allow-hotplug eth0 iface eth0 inet static address 172.24.1.1 netmask 255.255.255.0 network 172.24.1.0 broadcast 172.24.1.255
pi@raspberrypi:~$ sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
pi@raspberrypi:~$ sudo vi /etc/dnsmasq.conf
interface=eth0 # Use interface eth0
listen-address=172.24.1.1 # Explicitly specify the address to listen on
bind-interfaces # Bind to the interface to make sure we aren't sending things elsewhere
server=8.8.8.8 # Forward DNS requests to Google DNS
domain-needed # Don't forward short names
bogus-priv # Never forward addresses in the non-routed address spaces.
dhcp-range=172.24.1.50,172.24.1.150,12h # Assign IP addresses between 172.24.1.50 and 172.24.1.150 with a 12 hour lease time
pi@raspberrypi:~$ sudo vi /etc/sysctl.conf
Uncomment the following line
net.ipv4.ip_forward=1
pi@raspberrypi:~$ sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
pi@raspberrypi:~$ sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
pi@raspberrypi:~$ sudo vi /lib/dhcpd/dhcpd-hooks/70-ipv4-nat
iptables-restore < /etc/iptables.ipv4.nat
pi@raspberrypi:~$ sudo vi /etc/rc.local
Add following line before "exit 0"
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
exit 0
Shutdown your Pi and ready to use it!
Before I plug in my home-made adapter, there is no Available Networks
Plug in the ethernet and USB cable
Pi Zero starts working...
Yes! We have an available Wired Network
Run the network connection test, looks good
Check the IP address which is allocated by our Pi Zero dnsmsq
My ATX-box power supply
And external chassis cooling fan
SIZEOFINFINITY[∞]
References:
Ethernet On Pi Zero - How To Put An Ethernet Port On Your Pi - Raspi.TV
https://raspi.tv/2015/ethernet-on-pi-zero-how-to-put-an-ethernet-port-on-your-pi
How To: Wifi to Ethernet Bridge(Updated for RPi 3) - Raspberry Pi Forums
https://www.raspberrypi.org/forums/viewtopic.php?t=132674
No comments:
Post a Comment