Giter Site home page Giter Site logo

resin-wifi-connect's Introduction

resin-wifi-connect

A tool to allow WiFi configuration to be set via a captive portal. It checks whether WiFi is connected, tries to join the favorite network, and if this fails, it opens an Access Point to which you can connect using a laptop or mobile phone and input new WiFi credentials.

How to use this

This is a resin.io application. Check out our Getting Started guide if it's your first time using Resin.

This project is meant to be integrated as part of a larger application (that is, your application). An example on how to use this on a Python project can be found here.

If you need to add dependencies, add the corresponding statements in the Dockerfile template. You can add the commands that run your app in the start script. This app only exits after a successful connection, so if you add your app after line 3 you ensure that everything happens after wifi is correctly configured.

This is a node.js application, but your app can be any language/framework you want as long as you install it properly - if you need help, check out our Dockerfile guide. This project uses a Resin feature called "Dockerfile template": the base image is chosen depending on the architecture, specified by the %%RESIN_ARCH%% variable (see line 1 in the template).

Supported boards / dongles

For the Intel Edison version of this software, check the edison branch in this repository.

This software has been successfully tested on Raspberry Pi's A+ and 2B using the following WiFi dongles:

Dongle Chip
TP-LINK TL-WN722N Atheros AR9271
ModMyPi Ralink RT3070
ThePiHut Ralink RT5370

The software has also been successfully tested on RaspberryPi 3 with its onboard wifi.

Given these results, it is probable that most dongles with Atheros or Ralink chipsets will work.

The following dongles are known not to work (as the driver is not friendly with AP mode and Connman):

  • Official Raspberry Pi dongle (BCM43143 chip)
  • Addon NWU276 (Mediatek MT7601 chip)
  • Edimax (Realtek RTL8188CUS chip) Dongles with similar chipsets will probably not work.

The software is expected to work with other Resin supported boards as long as you use the correct dongles. Please contact us or raise an issue if you hit any trouble.

How it works

This app interacts with the Connman connection manager in Resin's base OS. It checks whether the wifi has been previously provisioned, and if it hasn't, it opens an Access Point to which you can connect using a laptop or mobile phone.

The access point's name (SSID) is, by default, "ResinAP". You can change this by setting the PORTAL_SSID environment variable. By default, the network is unprotected, but you can add a WPA2 passphrase by setting the PORTAL_PASSPHRASE environment variable.

When you connect to the access point, any web page you open will be redirected to our captive portal page, where you can select the SSID and passphrase of the WiFi network to connect to. After this, the app will disable the AP and try to connect. If it fails, it will enable the AP for you to try again. If it succeeds, the network will be remembered by Connman as a favorite.

An important detail is that by default, the project will not attempt to enter AP mode if a successful configuration has happened in the past. This means that if you go through the process and then move the device to a different network, it will be trying to connect forever. It is left to the user application to decide which is the appropriate condition to re-enter AP mode. This can be "been offline for more than 1 day" or "user pushed the reset button" or something else. To re-enter AP mode, simply re-run node src/app.js as done in the provided start script.

resin-wifi-connect's People

Contributors

andrewn avatar curcuz avatar james2710 avatar nghiant2710 avatar page- avatar pcarranzav avatar petrosagg avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.