Introduction: Setup Weaved and the Raspberry Pi
If you’ve ever tried to setup your Raspberry Pi as an Internet of Things device, you’ll know that unless you jump through some massive hoops, you’re stuck serving web pages and data on your local network. Getting information from your Pi on your phone, or while you’re at work or school . . . it’s nearly impossible.
There are a lot of ways to work your way out to the internet. They’re often painful . . . ISP’s block ports, you need to setup port forwarding, you might violate your terms of sevice with your ISP, and you might need to customize your router.
Weaved solves all of these problems.
The easiest way we’ve seen to open up your Raspberry Pi as an Internet of Things device is to use the service Weaved. Weaved provides an IoT (Internet of Things) Kit for the Raspberry Pi. The kit provides really simple tools for connecting your Pi to the cloud, receiving notifications, and turning your Pi into an Internet of Things Kit.
They offer a few services that let you connect from a distance:
- SSH - You can login to your Pi from anywhere over SSH.
- Web (http) on port 80 - You can view a web page your Raspberry Pi serves up from anywhere.
- WebIOPI - Control your Raspberry Pi GPIO pins using their custom software.
- iOS and Android App - They have a beautiful app you can use with your iPhone or your Android (soon!). Receive push notifications!
Connecting your Raspberry Pi to the internet is super-easy with Weaved!
Step 1: Get a Free Account.
You can get a free account at Weaved on their website. At the time of our writing, the service is in Beta and everything is free. Just setup a developer account, it takes about 30 seconds.
Step 2: Fire Up Your Raspberry Pi and Connect to the Internet.
Fire up your Raspberry Pi!
You will need to connect your Pi to the internet. We assume you've already figured out how to do this.
Step 3: Download the Weaved Software to Your Pi.
In the command line on your Raspbery PI, type the following command:
Step 4: Make the Weaved Software Executable.
We will make the installation file downloaded in Step 3 executable:
Again, in the command line:
chmod +x weaved-nixinstaller_1.2.8.bin
Step 5: Launch the Installer.
In the command line, type:
The software will run a few tests, and boom: first question . . . .
Step 6: Choose a Service.
When you first start, you’ll be asked to install one of the Weaved services: SSH on port 22, Web (http) on port 80, WebIOPi on port 8000, VNC on port 5091 (tested with tightvncserver), or A custom TCP service on your port of choice.
In this example, we'll choose the second option, http on port 80.
Step 7: Enter Your Weaved Login Information.
Enter in the information we setup in Step 1
Be sure: not your Raspberry Pi login information, but the information for your weaved account (which you setup in Step 1!).
You’ll be prompted for a device name. Name your pi wisely . . .
For this experiment, we chose “weaved_tutorial_4_pi” . . . and success!
Step 8: Test It: Install a Webserver.
Everything for weaved should be setup properly at this point. We'll test it out by setting up a server on the Raspberry Pi to serve up web pages.
We won’t go into depth on how to do this. The Raspberry Pi foundation has a great tutorial for installing an Apache server on your Pi.
You can install Apache in two quick command line commands:
sudo apt-get update
sudo apt-get install apache2 -y
Step 9: Now, Let’s Check That the New Device Is Online.
Go to the Weaved developer console here. You may be required to login.
We can see that the device we just setup is usable and can be connected to!
Step 10: Check Out Your Website.
In the weaved developer console, click “Connect” and a new window will be opened up.
It works! If we type in the address you see after https:// in the browser below, you can see it in your mobile phone, or from anywhere on the internet!
Step 11: Bonus! Modify Your Web Page
Did you know you can rewrite the web page? If you know html, simply type into the command line:
sudo nano index.html
Simply edit the text in the html file, save it, and you’re on your way to serving up web pages on the Pi!