I have been infatuated with this tiny computer for quite some time but have just gotten around to playing with it over the last few weeks.
Since they are only $10, I have collected three of them so far, I hope to use them for turnout control and signals on my outdoor model railroad.
One of the best things about the Raspberry Pi series is that it runs Linux. Debian 9 (Stretch) to be exact. Very cool. Linux is used on many large gigantic web servers that you visit and log into on the web. The Pi doesn’t have the raw power the big boys do but it can run a remarkable set of standard web and network packages and is quite capable for it’s small size.
To that end, I have put together a disk image for the RPiZW that turns this little board into a wifi access point and web server that you can connect to with any phone, tablet or computer. All programmable with Python
It serves up custom web pages based on a Python framework on the back end and simple (or complex if you wish) html on the front end.
This means that you can read and write to things like relays, sensors, USB devices, Serial ports, Xbee interfaces- almost anything that is connected to the Pi, and display and control it with python using a web page. It’s very open ended.
While this is meant as a ‘Hello World’ sort of thing to get a python framework installed, I’ve also put on some more ‘heavy lifting’ packages for later use. I’ll get into those later but for now, this image gives you a fully functional, standalone Linux Web Server with DNS and DHCP serving up web pages- all based on my favorite language, Python. And all on a board the size of two postage stamps!
The file is a bit large, it’s meant for a 16Gb micro SD card, compressed it comes to about 2Gb. You can download it at the following link:
Download Rpi Zero W Disk Image
The following instructions assume you have a Windows Machine to work with. I am sure a Mac would probably work but I don’t have easy access to one so I’ll stick to windows here. Also be aware this ONLY works with the Raspberry Pi Zero W, no other flavor of Raspberry Pi will work with this image.
Once downloaded, unzip it and use a SD burner program like DiskImage32 to program it onto a 16GB micro SD. It must be 16Gb, as the image was created from one. Once the image has been burned and verified, plug it into your RPiZW.
Use a standard micro USB cable to apply power to the board. It will flash it’s little green LED quite a bit as it comes up and comes online. Once it’s sat there for several minutes and stabilizes you can connect to it.
To get to the Pi, you will need to connect to it’s wireless network. When it asks you for the password or passphrase, it’s ‘mypassphrase’.
Use a browser on your computer or phone to access the web page- simply put http://rpinet into the browser url bar:
In order to edit the python pages and make it do cool things, you will need to access the main console via a terminal interface.
If you have a version of Windows 10 that contains the Bash Shell, you can use that to connect to the Pi and ssh pi@rpinet. If you have no idea what that means, don’t worry, you can use a program called ‘putty’ to connect to your RpiZW. You can get putty Here.
By installing this image onto a 16GB card and plugging it into the RpiZW, you can use the Rpi as a data sensor/controller for almost anything you can connect to it- and get a custom display of that information in a web page. You can collect touches or clicks off that page, send them back to the Pi for processing and have it return whatever you want. All using Python, one of the easiest to learn computer languages out there.
While you can take a vanilla Rpi installation and add all the components yourself, this is quite time consuming, not to mention frustrating at times. It took me several passes to get all the packages and configurations correct. With this method, using a disk image, you can simply download the file, burn it onto an SD card and insert that into the RPI. It gives you an easy way to get a current system up and running.
Things you will need
The Raspberry Pi Zero W is very small but it has all the connections you need for a stand alone computer – USB, DVI (video) and power. To get the maximum out of this little board, it’s best to have a couple of additional parts. A generic micro USB to USB/Ethernet adapter, a keyboard, a mouse and a monitor. (This image includes the Raspberry Pi GUI desktop)
NOTE: For this image, you don’t really need anything but power for your RaspberryPiZeroW. When it comes up, you can attach to it via wifi and log in that way. The following stuff is only needed if you want to do anything directly on the Raspberry Pi instead of logging into it remotely.
The first thing is the USB/Ethernet adapter, I get it from Adafruit. This plugs into the micro USB port on the Raspberry Pi W and allows you to hook a standard keyboard, mouse and ethernet connection to it.
You can get it here
To hook a monitor to the Pi, you will also need some sort of adapter to go from the mini hdmi video port to either a regular sized HDMI or a VGA port on your monitor.
This is a mini HDMI to regular HDMI adpater. You can get it here
Here is a mini HDMI to VGA adapter:
You can also get this at Adafruit
Now, if you use the image I created, you may not need to use any of these, depending on if you have another computer, say a windows machine. A mac would perhaps work as well, although I have not been as successful with that.
What you do is ‘ssh’ into it. ssh stands for secure shell and allows you to log into the main console of the Raspberry Pi. This will let connect to the pi from your main computer and edit the python programs.
Change the Network and Hostname
The name of the network and the name of the pi itself in this image is ‘rpinet’
If you want to change it to something else, follow these steps:
You will have to edit a couple of files and reboot your Pi.
find the following lines:
# Add local-only domains here, queries in these domains are answered # from /etc/hosts or DHCP only. #local=/localnet/ local=/rpinet/
Change ‘rpinet’ to whatever you want your computer to be called
interface=uap0 driver=nl80211 ssid=RPiNetwork hw_mode=g channel=7 wmm_enabled=0 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=mypassphrase wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP
Change the ssid to change the wifi access point name. You can also change the pass phrase but be careful, if it’s too short it won’t work.
You must also change the host name of the raspberry pi, do it with
hostnamectl set-hostname newhostname
You will also have to edit
127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters 127.0.1.1 rpinet 192.168.4.1 rpinet
Replace the two rpinet entries with the same thing you set with hostnamectl. They need to match.