Showing posts with label Raspberry Pi. Show all posts
Showing posts with label Raspberry Pi. Show all posts

Tuesday, July 28, 2015

Raspberry Pi troubles solved

After updating the software (using apt-get) on the Raspberry Pi I use to run OctoPrint to control my 3D printer, it would not recognize my TPLink USB WiFi dongle.

Turned out that the firmware needed for it has been removed from the Raspberry Pi kernel, so the fix as presented here was to do:

sudo wget https://github.com/lwfinger/rtl8188eu/raw/c83976d1dfb4793893158461430261562b3a5bf0/rtl8188eufw.bin  -O /lib/firmware/rtlwifi/rtl8188eufw.bin
I had some other problems too, apparently I must have powered down the RPi messily. I had to use the Mac's Disk Utilities to repair the boot partition (Windows FAT format), then load a Linux virtual machine and copy the start.elf file from another copy of the distribution to my boot partition.



Sunday, May 25, 2014

Installing OctoPrint for an original PrintrBot Plus with a TP-Link TL-WN725N Wifi adapter

I'm trying to make my Printrbot Plus accessible over WiFi so that I can move it outdoors when printing, to reduce exposure to dangerous fumes and nanoparticles.

I formatted the SD-card on my MacBook Pro using the SD Formatter program downloaded from here (following instructions here).

I used the 2014-01-07 Wheezy Octopi 0.8.0 image from here.

I then unzipped the OctoPi image and copied it to the SD card using:

sudo dd if=2014-01-07-wheezy-octopi-0.8.0.img of=/dev/rdisk3 bs=1m

I connected my Pi to the wired ethernet network and booted it. After boot I could ssh to octopi.local with username pi and password raspberry.

I ran sudo raspi-config on first boot to enlarge the initial partition to fill the card, and set my time zone, and rebooted.

The OctoPi interface is now available at http://octopi.local/

Next step was to set up my TP-Link TL-WN725N Wifi adapter.

I used uname -a to determine my OS version (was 3.10.25+ #622). Using this list, I determined i had to download this file:

https://dl.dropboxusercontent.com/u/80256631/8188eu-20131219.tar.gz

I downloaded:


wget https://dl.dropboxusercontent.com/u/80256631/8188eu-20131219.tar.gz

unpacked:

tar -xf 8188eu-20131219.tar.gz

installed:
sudo install -p -m 644 8188eu.ko /lib/modules/$(uname -r)/kernel/drivers/net/wireless
sudo insmod /lib/modules/$(uname -r)/kernel/drivers/net/wireless/8188eu.ko
sudo depmod -a

Checked that the dongle was installed with iwconfig

Installed my favorit editor 'emacs' (took a while): sudo apt-get install emacs

I edited the wpa_supplicant.conf file to add my WiFi password:

sudo emacs /etc/wpa_supplicant/wpa_supplicant.conf

I added:

network={
ssid=""
psk=""
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
auth_alg=OPEN

}

I took down and and up the interface (not sure if it was neccessary), and could see with ifconfig that wlan0 had an IP address on my wifi network. Note that this was not obvious from the iwconfig results.

I have not tried a print yet, but it's looking good.

Wednesday, August 14, 2013

Making a Raspberry Pi 3G Bridge / Hotspot

This post documents making a 3G Internet bridge / hotspot from a Raspberry Pi, a 3G modem, and a separate WiFi access point.

The purpose was to create an Internet connected WiFi-network at my parents' summer cottage.

I want to cover a fairly large area of the property and house. I might want several WiFi access points and control their placement and the placement of the 3G modem, therefore I did not want an integrated WiFi hub such as a Dovado 3/4G router (SEK 799 / €92 at Kjell & Co.

I'm using:
  • a Raspberry Pi model B (SEK 298 / €34 at Webhallen)
  • the Adafruit Occidentalis v 0.2 distribution (since I'd used it before)
  • an unlocked Huawei HiLink E353, originally tied to Swedish operator Tre, I think (SEK 179 / €21 at Swedish auction site Tradera)
  • Connected a WiFi access point I had earlier to the Raspberry Pi.
  • My plan is to use Telenor Bredband Kontant (SEK 400 / €46 for 6 months and 10 GB data). I did my tests by borrowing the SIM card from my iPad.
  • I think I also need a powered USB hub for the 3G modem, will experiment later to see if a more powerful supply for the Raspberry Pi might remove the need for this.
  • Normally, I used ssh over a network connection to the Raspberry Pi, but when setting up the network bridge, I used a regular monitor (with an HDMI - DVI cable) and a USB keyboard, because the network interfaces must be shut down to set up the bridge.
Installed Occidentalis on the SD card.

Connected RasPi to MacBook with Ethernet cable. Internet sharing from WiFi to Ethernet on MacBook, to give RasPi Internet access. Logged in with ssh on Raspberry Pi.

Booted the RasPi.
Did:
sudo apt-get update
sudo apt-get upgrade
(takes a long time)

usb_modeswitch is required to get 3G modem to work:
apt-get install usb-modeswitch
Install UPnP client, will be needed to open ports in the modem:
apt-get install miniupnpc
Remove and re-insert dongle?

Reboot:
sudo shutdown -r now
On startup, stick should be available as eth1, check with ifconfig. If it doesn't it might be that the modem needs to be in a powered USB hub.

edit /etc/network/interfaces

Add:
iface eth1 inet dhcp 
check with:
sudo ifup eth1
Great. Try to ssh into RasPi over public internet. How to get public IP?
wget http://ipecho.net/plain -O - -q ; echo
Got 90.129.85.242

Can't ssh to it (connection refused). After some research found out that in order to open port forwarding on the 3G modem, one must use UPnP.

Open port 22 to allow ssh connections from the Internet to the Raspberry Pi.
// to receive ssh
upnpc -r 22 TCP
Set up bridge (for more information, see documentation). This entails shutting down both network interfaces, so you will need to be connected to the Pi with keyboard & monitor, or with a third network connection:

I think I shut down eth0 and eth1 first:
ifdown eth0
ifdown eth1 
Then set up the bridge:
brctl addbr br0
brctl addif eth0
brctl addif eth1
dhclient br0
It works! Can access Internet via Dongle from WiFi. 

Modified my WiFi access point to have IP 192.168.1.2

Now set configuration in /etc/network/intefaces:
auto lo br0
iface lo inet loopback 

# Ethernet
iface eth0 inet manual

# Huawei 3G dongle
iface eth1 inet manual

allow-hotplug eth1

# Bridge
iface br0 inet dhcp
  bridge_ports eth0 eth1
  bridge_fd 0 # no forwarding delay

Configured DynDNS for my DNS provider Loopia according to these instructions. 

Works very nicely!

Did you find this useful? Please Flattr me!