schollz/raspberry-pi-turnkey is a Python project with 859 stars. How to make a Raspberry Pi image that can be deployed anywhere and assigned to a WiFi network without SSH :ok_hand:
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Have you ever wanted to setup a Raspberry Pi without having to SSH or attach a keyboard to add your WiFi credentials? This is particularly useful when you are making a Raspberry Pi that needs to be deployed somewhere where supplying the credentials via SSH or attaching a keyboard isn't an option. Or it could be useful if you take your Pi to a friend's house and they don't have ethernet cables or extra keyboards+monitors to put your friend's WiFi credentials onto the Pi. With this image base you don't ever need to modify a wpa_supplicant with SSH/terminal/PiBakery again!
You can follow the instructions below to create a turnkey image, or you can just download my latest one at raspberry-pi-turnkey.schollz.com/2018-06-25-turnkey-1.3.zip (v1.3.0, 982MB) and follow the typical flashing instructions.
Usage
Once you boot the Pi with this image, wait about 10 minutes for the Pi to reformat the drive and start up the web server. Then you will see a WiFi AP named "ConnectToConnect" (password same). Connect to it and your browser should automatically redirect you to a sign-in page. If not, navigate to 192.168.4.1 where you'll see a login form.
When the WiFi credentials are entered onto the login form, the Pi will modify its internal wpa_supplicant to conform to them so that it will be connected to the net. The Pi will then reboot itself using those WiFi credentials. If the credentials are not correct, then the Pi will reboot back into the AP mode to allow you to re-enter them again.
Once connected, you can recieve a message with the LAN IP for your Pi at https://snaptext.live (the specific URL will be given to you when you enter in the credentials to the form).
Note: The Raspberry Pi is not a fast computer. When you see the AP and connect to it, it may take up to a minute for the page at 192.168.4.1 to appear. Also, if you enter the wrong WiFi credentials, it will have to reboot twice to reset the Pi to allow you to enter the credentials again. So try to enter them right the first time!
How does it work?
When the Pi starts up it runs a Python script, startup.py. This script first checks if the Pi is online (by looking for an SSID in iwconfig wlan0). If the Pi is online, the script sets the status as "connected" (saved to disk in status.json).
If the Pi is not online, it will check the status. The initial status is "disconnected". When "disconnected" the Pi will uncomment the configuration files for hostapd and dnsmasq. The access point configuration is nearly identical to as outlined in this tutorial. Then the Pi sets the status as "hostapd" and reboots itself.
When the status is "hostapd" then the script will bind to port 80 and serve a web form at 192.168.4.1. Once you connect to the AP this web form will be available and it will recieve input. Once the server recieves input, it sets the credentials in wpa_supplicant.conf and comments out the configuration file for hostapd and dnsmasq so that the AP doesn't interfere, and then reboots. When it reboots it will see if it gets online and set the status as "connected" or "disconnected". Then it repeats the steps above (i.e. doing nothing if connected, or restarting the AP if disconnected).
Instructions to create image
The following are the step-by-step instructions for how I create the turnkey image. If you don't want to download the image I created above (I don't blame you), then follow these to make one exactly the same.
These instructions assume you are using Ubuntu. You can use Windows/OS X for most of these steps, except step #4 which requires resizing.
1. Flash Raspbian Stretch Lite
Starting from version Raspbian Stretch Lite version 2017-11-29.
Add pi to the sudoers, so that you can run sudo commands without having to be root (so that all the paths to your programs are unchanged).
$ sudo visudo
Then add this line:
pi ALL=(ALL:ALL) ALL
(Sidenote: I save an image intermediate.img at this point so its easy to go back)
Startup server on boot
Open up the rc.local
$ sudo nano /etc/rc.local
And add the following line before exit 0:
su pi -c '/usr/bin/sudo /usr/bin/python3 /home/pi/raspberry-pi-turnkey/startup.py &'
Shutdown the pi
Shutdown the Raspberry Pi and do not start it up until after you write the image. Otherwise the unique ID that is generated will be the same for all the images.
$ sudo shutdown now
3. Resize Raspberry Pi SD image
If you don't want to resize the image, you can just write the entire image file to your computer and use that from here on. If you do want to resize (especially useful if you are installing on a 16GB card and want to flash onto a smaller card), follow these instructions.
Put the newly made image into Ubuntu and do
$ xhost +local:
$ sudo gparted-pkexec
Right click on the SD card image and do "Unmount". Then right click on the image and do "Resize/Move" and change the size to 2400.
Then you can copy the image to your computer using the following command
How active is development on schollz/raspberry-pi-turnkey?
The most recent commit recorded on schollz/raspberry-pi-turnkey was 3.6 years ago, based on the GitHub push timestamp. The repository has 89 forks — one of the better signals of community interest.
How many stars does schollz/raspberry-pi-turnkey have?
schollz/raspberry-pi-turnkey has 859 GitHub stars — refresh the page for the live number, or check github.com/schollz/raspberry-pi-turnkey. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What language is schollz/raspberry-pi-turnkey written in?
schollz/raspberry-pi-turnkey is written primarily in Python. GitHub's language field is based on the largest share of bytes in the default branch.
What topics is schollz/raspberry-pi-turnkey associated with?
GitHub's repository topics for schollz/raspberry-pi-turnkey: "instructions", "raspberry-pi", "raspbian", "wifi-hotspot". TopGit's editorial category is open-source.
Where do I read more about schollz/raspberry-pi-turnkey?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/schollz/raspberry-pi-turnkey is the definitive source.
Read full README in the tab above.
Still deciding about raspberry-pi-turnkey?
One click hands the question to an AI along with this page — see what it says about raspberry-pi-turnkey.