If you only do projects for yourself, you are spoiled. After all, you know your environment better than anyone. You know what power you’ll have, the temperature range, and how your network is configured. This last part is especially problematic if you are trying to deploy something that connects to a wireless LAN. How can you configure, say, a Raspberry Pi so that it can connect to an unknown user’s WiFi network? Fixing that problem is the goal of [schollz’s] Raspberry Pi Turnkey project.
The idea is simple. A Raspberry Pi image boots up for the first time and offers a WiFi hotspot itself called ConnectToConnect. The WiFi password is also ConnectToConnect. Once connected, you get configuration options that allow you to tailor the system to your network. Sure, you could have people log in and reconfigure via a serial terminal, wired ethernet (which isn’t always set up right, either), or a USB keyboard But that’s not a great out-of-the-box experience for most customers.
When the WiFi credentials are entered into the login form at address 192.168.4.1, the Pi will modify its configuration and then reboot itself. The startup script makes sure the connection was successful. If the credentials are not correct, then the Pi will reboot back into the AP mode to allow you to re-enter them again.
This isn’t a fast process, so you should probably try to get it right the first time. You can build your image from the instructions, or you can just download a ready-to-go image that you can then customize.
We couldn’t help but think about the same kind of system we’ve seen for the ESP8266. We also wondered if the simultaneous AP and client code we’ve seen for the Pi Zero could help [schollz] reduce the rebooting required, but we aren’t sure about that.
Images: Gareth Halfacree [CC BY-SA 2.0] and [CC BY-SA 2.0].
35 thoughts on “Deploying A Turnkey Raspberry Pi System”
I actually had a similar idea for my TinyPi project. You could host a simple webpage that allowed the connection to the wifi, but also the pairing of Bluetooth devices, which is tricky on tiny screens
i guess that’s why they invented “WPS”
I have literally never been able to get WPS to work, on any device. I gave up trying years ago.
i like to use it sometimes. especially for connecting repeaters to a router. with everything else that has a display and keyboard, i prefer to enter the password.
i guess the problem in most cases is, that there are different kinds of WPS and every device has it’s own way of starting the process. i also noticed that with some devices the order of activation does matter.
There is WPS-PUSH and WPS-PIN. PIN is unsafe, because it can be brute forced.
if a device does have WPS, it has to support PIN and PUSH. (NFC and UFD are optional)
depending on the device, you have to push the button for a certain amount of time.
after that you press the button on the device for the specified amount of time.
they have to be close, and then they should connect.
in my experience, you have to push the the router first, and then the device, or it won’t work.
some devices allow the button to be “pressed” in software, like over the interface of a router.
i guess the biggest problem is, that the button is usually multi purpose, and the function depends only on the time you press it, and that there is no status light that specifically tells you that WPS is active. it’s usually some other LEDs that start flashing in a specific way.
Try again. I haven’t had a problem in years.
WPS has such poor security that most people now disable it by default
Why not using the wpa_supplicant.conf file which is exactly for this purpose?
Please enlighten us.
Should be applicable to all Raspis.
It Is (0w, 3, and any with a recognized wifi donge).
Can your grandma setup the wpa_supplicant.conf file on a device she just bought? This article is to make a device easier for non-technical people to setup.
“Why not using the wpa_supplicant.conf file which is exactly for this purpose?”
That is exactly what this setup system is using. The web interface it provides in AP mode in the end writes the info into wpa_supplicant.conf to be used by the OS per normal after the reboot part at the end.
So basically this is a tool for really simple people which don’t have a clue of how to is this config file in the first place. Ok, it’s a start.
You are missing the use case. If you want to sell a RPI-based product or even send it to your mom or whatever, this allows normal people to set up for their network without teaching them how to use nano.
You’re right! It’s geared to people, who just want to use the finished product and not develop anything with the device. In that case it”s a neat solution.
So basically, you’re an elitist who doesn’t have a clue about the difference between a hobby project and any of the steps needed to make a finished product. Ok, you’re a tool.
Call me simple-minded, but if I want to use something and I don’t know how, I try to teach it to myself so that I can. But nowadays most of the people expect from every device they are using, that they just need to turn it on and it magically does the exact thing what it’s supposed to do. This is in fact a really nice idea, but it fails most of the time. As the developer of a device you can make it as easy as possible, but you won’t be able to make the process that simple that everyone will be able to use it. You will find some people which simply can’t…
Well that’s certainly easier than installing and configuring wicd for the wireless network at the far end. (Which didn’t work in the end because the customer plugged the ethernet in, which overrode the wifi config, and placed it on the wrong network).
have you seen http://github.com/treehouses/clip it does even wifi bridge …
https://github.com/treehouses/cli is probably the URI you were thinking of ;-)
“When the WiFi credentials are entered into the login form at address 192.168.4.1, the Pi will modify its configuration and then reboot itself. The startup script makes sure the connection was successful. If the credentials are not correct, then the Pi will reboot back into the AP mode to allow you to re-enter them again.
This isn’t a fast process, so you should probably try to get it right the first time.” — Um, why does it reboot itself every time you change the configuration? You can just start, stop or restart any relevant services and POOF, the whole process will be a lot faster..
I tried a little bit but gave up because it was more complicated. Basically you are right, you just have to stop/start dnsmasq, hostapd, dhcpcd in the right order before restarting the WiFi. The nice thing about the power-cycle is that it _just works_ without thinking about that stuff :)
Please make a pull request if you want to try!
The one thing the system needs, is a button to initiate the process, not just a first time use case.
Pi Bakery does a very similar thing
If I sent my mum a raspberry pi she’d expect to need a fork not a web browser. Maybe I should just send her an iPad.
See, im disappointing. This was a perfect opportunity to make the initial IP address 192.168.3.14… 3.14… Pi…
disappointed NOT disappointing…
Im sure some people find me disappointing…
Haha I love that. Please make a pull request and I’d be happy to merge that in :)
Is the RPI doing DHCP on the connecttoconenct network ?
And offering it’s IP as the gateway. Then capturing any address in the web brwoser and routing to itself.
I got the impresion that IP was manual, so that’s just as hard for people to setup as it is wifi AP names.
Thanks for the best laugh I’ve had all day.
22.214.171.124 more Pi… also a valid IP address.
Gave it a shot as I am trying to setup a turnkey raspberry pi sensor station for use in schools. I ran through the instructions and skipped the two optional sections (I know they are installing two languages, but I have no idea what they are used for)
rebooted the Pi and no longer had an internet connection. So as far as I can tell, actually reading the lines I typed, one of the first steps is to set a static IP. Removed that and had internet.
Connected it to a monitor and disconnected from wifi. and rebooted. The network settings showed a new interface, but when I scanned with other devices, they could not see the ConnectTo Connect AP.
Has anyone here actually followed these instructions and gotten a working system?
Also what are the two programming languages included for if they are optional?
I’m having a hard time making it work too. Installed (even the optional ones) on a clean Pi3 and Zero (waiting 10 minutes to make sure boot has completed) with no luck. Running it on a Pi3 with Ethernet cable and running the command
/usr/bin/sudo /usr/bin/python3 /home/pi/raspberry-pi-turnkey/startup.py
got a write permission error on status.json which I 777’ed for pi:pi and passed that error but does not always work.
I got it once to complete and even show the snaptext url (which is an ultra cool feature!!!) but now once I enter the WiFi details and hit Sign in WiFi AP is gone straight away and 192.168.4.1/singin times out.
And then I realised it is for Stretch and not Jessie that my installation is on :)
Any hints towards which direction to move to make it work?
The configuration files seem fine for dhcpcd, dnsmasq and hostapd for Jessie.
Any help would be appreciated!
Please be kind and respectful to help make the comments section excellent. (Comment Policy)