TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Raspberry Pi WLAN setup

167 pointsby DoubleMaltover 6 years ago

20 comments

blumomoover 6 years ago
In a previous company we built a Bluetooth Low Energy server app into the embedded Raspberry Pi-like system.<p>Long story short:<p>1. RPi broadcasts via BLE the wifi networks it can see<p>2. A ReactNative App lets the user choose the wifi network to connect to, pre-selected is the wifi network which the mobile is connected to<p>3. User enters wifi password<p>4. App sends it to RPI, still via BLE<p>5. RPi responds with IP address when successfully connected or with an error, all via BLE.<p>6. App can now talk to Pi via IP<p>7. BLE server on Pi shuts down. Done.<p>Advantage: user never needs to mess with changing to any ad-hoc wifi. Awesome UX.
评论 #18523413 未加载
yjftsjthsd-hover 6 years ago
So GUI and displaying the IP at the end is nice. But. I do wonder: If you already have to write a special image, why not just write the network config directly to wpa_supplicant.conf?
评论 #18522705 未加载
评论 #18525095 未加载
matthewmacleodover 6 years ago
That’s cool, and the UI is nice!<p>I wrote exactly the same thing as a library, to allow user setup of the WiFi network from within an app as part of a hardware prototype - main difference being it was just a Go daemon running on the Pi. Didn’t end up using it or open-sourcing it but I will re-visit that, since it looks like there are a couple of use-cases.
评论 #18522607 未加载
nojaover 6 years ago
or create &#x2F;boot&#x2F;wpa_supplicant.conf and touch &#x2F;boot&#x2F;ssh and it will do the right thing on boot.
评论 #18522488 未加载
评论 #18523193 未加载
评论 #18524488 未加载
blensorover 6 years ago
That is something that seems really useful. You can get your Raspberry Pi online without a minitor but it&#x27;s always a bit like stumbling in the dark.<p>I&#x27;ll definitely give this a try.
crankysirenover 6 years ago
<a href="https:&#x2F;&#x2F;github.com&#x2F;jasbur&#x2F;RaspiWiFi" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jasbur&#x2F;RaspiWiFi</a> fairly stable light weight system that does the same thing, also comes as an etchable .img one advantage here is that if the Pi goes offline for extended period it will flip on its AP broadcast mode allowing wifi to be setup again.<p>Code is highly modular and maintainable.
评论 #18523126 未加载
codybover 6 years ago
This seems like it would be super useful prior to Raspbian Stretch for developers using Apple products.<p>Prior to stretch the wpa_supplicant.conf file needed to be modified in the main Raspbian partition which is inaccessible on the unix machine without setting up a virtual linux box and creating a vb disk image linked to the sd card. It was a bit of a pain.<p>With Stretch you can just add a wpa_supplicant.conf file and an empty ssh file to the boot partition which is accessible and you should be ready to go.<p>This still solves the pain point of there being lots of outdated headless instructions out there telling you to modify wpa_supplicant.conf in &#x2F;etc&#x2F;wpa_supplicant on the main partition. Would have saved me a ton of time that&#x27;s for sure!<p>Looks nice and clean as well, design wise.
bertiover 6 years ago
Even if you couldn&#x27;t mount the boot partition on any common desktop OS and setup ssh + wpa_supplicant (it&#x27;s FAT32), I would greatly prefer the simplicity of a local console session with a $2 USB-serial adapter (am I the only weirdo with dozens of these lying around?).<p>Typically I actually just mount the partitions and chroot with qemu-arm, upgrade packages, and do all of the setup before the SD card is ever inserted in a real Pi. proot[0] makes all this a walk in the park.<p><pre><code> mount &#x2F;dev&#x2F;sdX2 &#x2F;mnt mount &#x2F;dev&#x2F;sdX1 &#x2F;mnt&#x2F;boot proot -q qemu-arm -S &#x2F;mnt </code></pre> [0] <a href="https:&#x2F;&#x2F;proot-me.github.io" rel="nofollow">https:&#x2F;&#x2F;proot-me.github.io</a>
josteinkover 6 years ago
&gt; ETCH THE IMAGE<p>&gt; Download the BerryLan flavoured Raspbian image and flash the SD Card. We recommend Etcher to do that.<p>I’m curious. Why would anyone recommend people download and run a multi-100mb electron app instead of just using dd?<p>Especially for projects like this aimed at medium technical people.
fpgaminerover 6 years ago
I&#x27;m building a gift for someone else that uses a RasPi internally, and thus needed a user friendly way for them to configure its WiFi connection. It&#x27;s been ... quite the adventure (mostly because I&#x27;m dumb).<p>My first idea was to put an OLED and a rotary encoder on the box. That way they can do a special dance on the button to enter setup mode, scroll through a list of wifi networks, and then tediously scroll through letters to enter the wifi password. I found a 1&quot; OLED for cheap, and already needed a button for other things, so this was a cheap, effective solution.<p>But having to tediously type out a password with a knob sounded very user unfriendly.<p>Then I realized I could bring out a USB port, and they could plug in a USB keyboard! So I worked on that for bit. It&#x27;s a lot easier to use. And the whole keyboard + tiny OLED idea was kinda fun.<p>But then I remembered the idea of doing a WiFi AP dance. That&#x27;s where the device broadcasts as an AP, you connect with your phone, browse to a webpage to tell the device your Wifi network&#x27;s info, and done! It&#x27;s a solution that doesn&#x27;t require an OLED or for me to bring out a USB connection. Cheaper and less mechanical engineering.<p>To that end I found Mozilla&#x27;s IoT project which, conveniently, has RasPi compatible code for doing just that dance: <a href="https:&#x2F;&#x2F;github.com&#x2F;mozilla-iot&#x2F;gateway-wifi-setup" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mozilla-iot&#x2F;gateway-wifi-setup</a> (By the way, Mozilla&#x27;s IoT project is neat and worth checking out).<p>That setup is quite similar to OP, except it doesn&#x27;t require a separate app. Its downside is requiring the user to mess with the wifi settings on their phone. Not a huge deal (for my target audience) but can be annoying. (Hence why OP&#x27;s project uses the Bluetooth connection; Smart!)<p>I&#x27;ve been tinkering with this on and off for about two weeks. While I wasn&#x27;t thrilled with the solution, it was at least usable, cheap, and easy. ... then I realized I was dumb.<p>I have a camera on the device. I could just have them go to a website, punch in their wifi info, encode that as a QR code, and have them show it to the camera... (It&#x27;d be a secure website I set up, so no security hygiene problems). Same benefits of being cheap and easy, while being easier to use. Using `pyzbar` to do real-time QR detection I had something working within an hour. Just hold your phone in front of the camera and it&#x27;ll automatically detect, decode, and setup the wifi settings.<p>The only downside to this approach is that I can&#x27;t conveniently display a list of nearby wifi networks; so they have to type their SSID manually.<p>Figured I&#x27;d share my comedy of errors in case someone is looking for ideas for wifi setup solutions. Obviously if you&#x27;re just setting up a RasPi yourself it&#x27;s easier to just pop a wpa_supplicant.conf on the SD card. (Though I wish Raspbian also had a way to configure hostname, authorized_keys, and disable ssh password authentication through boot files. Only way to do that today is by mounting the root filesystem which isn&#x27;t convenient on, e.g., a Mac)
评论 #18522908 未加载
评论 #18523186 未加载
lisperover 6 years ago
This looks very cool but you should think twice before you use it. If a hacker wanted to infiltrate your LAN, there would be no better way to do it than to provide a tool like this.
评论 #18523316 未加载
swinglockover 6 years ago
That looks useful. Does it delete itself and the extra repo configuration after setup? If not, while convenient I&#x27;m not convinced the increased attack surface is worth it.
评论 #18522522 未加载
rgoodwintxover 6 years ago
Funny enough, I&#x27;ve been about to embark on something similar, for a project I contribute to that makes a Raspi Zero W into a &quot;smart USB drive&quot; for the built-in Tesla dashcam:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;cimryan&#x2F;teslausb" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cimryan&#x2F;teslausb</a><p>(Props to Cim and Ray who are doing a ton of work making the project go, also!)<p>The goals&#x2F;advantages, vs just using a USB thumb drive:<p>- will connect to your wifi network (when detected) and copy off your saved dashcam files (over CIFS, SSH, others) - fixes any FAT filesystem errors on the virtual USB drive (presented to the host using g_mass_storage) automatically; some Tesla software versions had&#x2F;have a bug that left the filesystem dirty on shutdown, rendering some thumb drives unreadable until formatted again<p>- (in process testing) uses BTRFS to keep the drive online while taking snapshots to do the file copies (and other neat things I have planned, like extending the 1-hour rolling buffer that Tesla uses by copying off files older than 1 hr into a secondary backing store on disk to be copied off later)<p>- automated (headless) setup by putting a configuration file in &#x2F;boot (including wifi setup)<p>- quite a few more ideas to come; love to hear more brainstorms too. Maybe with a little more work it&#x27;s worth its own Show HN? :)<p>I&#x27;ve learned a lot about how little I remembered about bash, how Raspbian images are built, setting up Jenkins for automated builds, even controlling the LED on the Pi to show progress of headless setup. (Sometimes it&#x27;s the little things...)<p>On the to-do list was something exactly like this post: provide a way to get to the files if you are away from your home network, and&#x2F;or don&#x27;t have a computer with a USB or SD reader handy. Say, if you had just gotten in an accident and wanted to get to the files pronto. So, a way to trigger the Pi popping into AP mode was my next area of exploration; timely! I was actually exploring having your phone make a BT connection that would cause the host to switch configs (either automatically, or using BT PAN. (And a web UI to grab files, make settings changes, etc.) Good thoughts on security in some of the comments, and glad to see others have thought through this.<p>Thanks to OP and others; I think there&#x27;s a solution one way or another in several of these project ideas! And, as customary, PR&#x27;s welcome :)
tdewittover 6 years ago
I have half a dozen Pis to reimage right now, so this is timely. Can&#x27;t wait to give it a shot today.
评论 #18522744 未加载
syntaxingover 6 years ago
Super cool! That being said, Raspbian latest update have been killing my wifi cards...for some reason none of my old realtek usb wifi dongle works anymore. I had to flash one of the older images (June). Anyone else have this problem?
epynonymousover 6 years ago
403 for me, i’m in shanghai. but reading the comments, i think i know where you’re going with this. one question i have is, if you have a lot of devices in the same area, how do you make certain the ip address space doesnt collide?
aquraiover 6 years ago
This is awesome! Is the OP the author?<p>Just started using rpi with my underwater robots. Obviously the wifi cuts off when they dive, but doesn&#x27;t reconnect always when they come back. Will definitely try this out.
basdpover 6 years ago
you can just put a wpa_supplicant.conf file on the USB stick partition and it will automatically connect to your wifi[1]. This seems like an overengineered approach that is far more complicated...<p>[1] <a href="https:&#x2F;&#x2F;www.raspberrypi.org&#x2F;documentation&#x2F;configuration&#x2F;wireless&#x2F;wireless-cli.md" rel="nofollow">https:&#x2F;&#x2F;www.raspberrypi.org&#x2F;documentation&#x2F;configuration&#x2F;wire...</a>
johnklosover 6 years ago
The overlap of people who might want to ssh and people who don&#x27;t know how to configure their own wireless doesn&#x27;t seem all that large.<p>On the other hand, I could see this being useful as an additional software package that gets run when the Pi can&#x27;t find or join its usual network.
评论 #18522857 未加载
orblivionover 6 years ago
I&#x27;m confused by the Bluetooth logo.
评论 #18522514 未加载