Giter Site home page Giter Site logo

mobile-rr's Introduction

ESP8266 Mobile Rick Roll Captive Portal

This project was featured on the Hack-a-Day blog! Check it out!

The purpose of this project was to help me get familiar with programming for the ESP8266 and have a bit of fun.

ESP8266 Mobile-RR

  • User connects to the device broadcasting an SSID of "FREE Highspeed WiFi" (this is configurable of course)
  • The captive portal helper on their phone/tablet/computer kicks in and presents them with a page showing "Terms of Service" and a button labeled "I Accept"
  • When they click the button a full screen animated GIF of Rick Astley dancing appears and an audio clip of "Never Gonna Give You Up" starts playing on loop along with a message in the bottom right letting them know they got rock rolled (Incase they don't understand what's going on)

On bootup, the buzzer plays a little bit of "Never Gonna Give You Up". To access the console, connect to the ESP8266 Access Point and browse to "http://10.10.10.1/console". From here you can monitor all connections and see when someone gets Rick Roll'd by the device. The console also allows you to enter commands to get more info about the status of the device, change the SSID, get the Rick Roll count and even beep the buzzer.

The "debug" setting is on by default and shows you all DNS and HTTP requests made to the device. It's kind of cool to see all the sites that the apps on your phone are trying to access. Check out the screenshots of the console for a glimpse of what it looks like. Some apps are very noisy. You can toggle the "debug" off to not see that stuff.

Parts List

Wiring

Connect the '+' lead of the piezo to GPIO 4 (D2 on WeMos D1 Mini) and '-' lead to Ground. I chose GPIO 4 because I installed the long leads with the headers on the WeMos D1 Mini. The spacing from ground was perfect to just plug the buzzer in direct between G & D2.

Build Firmware

I use PlatformIO to build this. http://platformio.org/

  • Install PlatformIO and let it update itself on first startup
  • Once updated and restarted, clone the "mobile-rr" project to a folder and open the project in PlatformIO
  • Next build the firmware by clicking the checkmark icon on the toolbar
Atom Visual Studio Code
Build Firmware Build Firmware

Upload Firmware and SPIFFS data

After your firmware build is successful you can upload it by clicking the arrow under the checkmark in the PlatformIO toolbar.

Atom Visual Studio Code
Upload Firmware Upload Firmware

You can add/edit the files in the "www" folder to your liking. (Files in the "www" folder will be cloned and gzipped to the "data" folder when building.) Then follow the instructions below to build and upload the SPIFFS file system image to your ESP8266.

Atom Visual Studio Code
Upload SPIFFS 1 Upload SPIFFS 1
Upload SPIFFS 2 Upload SPIFFS 2

Note: Anytime you make changes to the firmware or the data you can rebuild and upload either without the need to install the other again. They reside in different areas of the flash memory.

References

I learned everything I needed to create this from these projects

mobile-rr's People

Contributors

boneskull avatar idolpx avatar ivankravets avatar marfjeh avatar noki avatar sdamian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mobile-rr's Issues

Redirect loop error on Android/Chrome

On Android with Chrome, the index.htm page does not load, and gives the error message:

freewifi.cow redirected you too many times.

ERR_TOO_MANY_REDIRECTS

The 10,10,10,1 console page just shows a blank page.

Ideas for Improvements

I just started playing around with this and I have some ideas for improvements:

  • Autodetect crowded channels and use the best channel
  • Improve channel detection with multiple scans to find more stations
  • Allow to set the Rick-Roll message via console to send a special greeting
  • Convert l.png to svg to reduce size and have a version that works on large monitors as well
  • Improve responsive CSS for a better looking captive portal on large screens
  • Have a minified version and or gzipped version of html/css/javascript/svg in addition to a human readable version and write instructions and maybe a shell script to update the files
  • Have PlatformIO gzip the appropriate data files when building the SPIFFS image
  • Add an explanation of Rick Rolling to the index.htm and add a link or button so it can be accessed

Android Captive Portal Helper isn't triggered.

When connecting on an iOS or OSX device the captive portal is detected and a browser window pops up like it should to be able to accept the agreement and then get rick roll'd. It doesn't launch the browser window on Android though.

Can't log in to console

Hi

I set a new username and password for the console. I set the username as test and the password as test. For some reason, I can't login to the console with these credentials. I double checked I typed them correctly and have checked capitals, spelling, etc.

I have also attempted to reflash the firmware on the device - both parts. The SSID stays the same and I still can't log in.

Any advice on how to reflash it properly?

Thanks

Error Compiling

Using VS and PIO, was able to compile using a PIO sample project, but not the mobile-rr. I get a lot of errors in the compile, probably something simple but I'm just a hardware guy and not a SW hacker. Here is a bit of the error message;
Compiling .pio\build\d1_mini_pro\src\mobile-rr.ino.cpp.o
In file included from .pio\libdeps\d1_mini_pro\ArduinoJson\src/ArduinoJson.hpp:42,
from .pio\libdeps\d1_mini_pro\ArduinoJson\src/ArduinoJson.h:9,
from C:/Users/rODNEY/Documents/RickRoll project/mobile-rr-master/mobile-rr-master/src/mobile-rr.ino:36:
.pio\libdeps\d1_mini_pro\ArduinoJson\src/ArduinoJson/Variant/ConverterImpl.hpp:84:19: error: template argument 1 is invalid

Can we still make this work?

As a noob I saw this project in a recent edition of Make Magazine (April 1st pranks) and through it looked well documented and straightforward.

Unfortunately I can't get this to work according to the instructions, is this still functional? If not, is there a way to do this via Arduino IDE rather than platformio?

Broadcast SSID remains unchanged after changing variable

Summary: Changing the SSID variable in the @@@ section has no effect on the actual SSID used when the code is running.

Details: In the section marked // Global data section I changed the default value to:
char ssid[] = "Free Hi-Speed WiFi";

However, the default SSID continues to broadcast. It doesn't matter what new value I use, the original value is broadcast.

More info: I assume that the original default SSID is hardcoded somewhere but I simply cannot find it. I've wiped and reloaded SPIFFS storage as well as searching both the storage files and source code, but I can't find where this is happening. I'm happy to help fix if anyone can point me in the right direction!

Browser Error

Hi, I tried the code on a Nodemcu (ESP-12e)
Compiling and flashing works (After some attempts)
But I always get an error Message on my Phone (Android 7):
"Error to many redirects" or
"The page isn't redirecting properly - Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

multiple definition of `ax_port_write'

When trying to compile this project following HOWTO, I have multiple errors:

WiFiClientSecure.cpp:(.text.ax_port_write+0x1c): multiple definition of `ax_port_write'
.pioenvs/d1_mini/libESPAsyncTCP_ID305.a(lwipr_compat.o):lwipr_compat.c:(.text.ax_port_write+0xc): first defined here
.pioenvs/d1_mini/libESP8266WiFi.a(WiFiClientSecure.o): In function `ax_get_file':
WiFiClientSecure.cpp:(.text.ax_get_file+0x0): multiple definition of `ax_get_file'
.pioenvs/d1_mini/libESPAsyncTCP_ID305.a(lwipr_compat.o):lwipr_compat.c:(.text.ax_get_file+0x0): first defined here
.pioenvs/d1_mini/libESP8266WiFi.a(WiFiClientSecure.o): In function `ax_wdt_feed':
.pioenvs/d1_mini/libESP8266WiFi.a(WiFiClientSecure.o): In function `ax_wdt_feed':
WiFiClientSecure.cpp:(.text.ax_wdt_feed+0x8): multiple definition of `ax_wdt_feed'
.pioenvs/d1_mini/libESPAsyncTCP_ID305.a(lwipr_compat.o):lwipr_compat.c:(.text.ax_wdt_feed+0x0): first defined here
collect2: error: ld returned 1 exit status
scons: *** [.pioenvs/d1_mini/firmware.elf] Error 1

I have latest Platform IDE installed, running IDE v1.4.0, and CLI 2.11.2
Platform espressif is installed via CLI.

Any idea?? :)

The embed_media function in the www_proc.py script is causing issues.

If embed_media is used to further combine the data files, the captive portal helpers in iOS/OSX don't automatically display the TOS page when connecting to the access point.

Windows Mobile seems to be fine and the Android captive portal helper has always been an issue for me on my Samsung Galaxy S5.

error: '_ws_client' was not declared in this scope

Error compiling using PlatformIO, is there something missing from the libraries?

error: '_ws_client' was not declared in this scope
Compiling .pioenvs\d1_mini\FrameworkArduino\debug.o
Compiling .pioenvs\d1_mini\FrameworkArduino\heap.o
*** [.pioenvs\d1_mini\src\mobile-rr.ino.o] Error 1

Can't build mobile-rr in Atom or VSCode with Platformio

Hi

Even after downgrading ArduinoJson, the project still refuses to built. These are the errors I have:

> Executing task: C:\Users\User\.platformio\penv\Scripts\platformio.exe run <

Processing d1_mini (framework: arduino; platform: espressif8266; board: d1_mini)
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1_mini.html
PLATFORM: Espressif 8266 2.2.3 > WeMos D1 R2 and mini
HARDWARE: ESP8266 160MHz, 80KB RAM, 4MB Flash
PACKAGES: toolchain-xtensa 2.40802.190218 (4.8.2), tool-esptool 1.413.0 (4.13), tool-esptoolpy 1.20600.0 (2.6.0), framework-arduinoespressif8266 2.20502.0 (2.5.2)
Converting mobile-rr.ino
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 32 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ArduinoJson> 5.13.4
|-- <ESPAsyncTCP> 1.2.2
|   |-- <ESP8266WiFi> 1.0
|-- <ESP Async WebServer> 1.2.3
|   |-- <ESPAsyncTCP> 1.2.2
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <Hash> 1.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <ArduinoJson> 5.13.4
|-- <Hash> 1.0
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS> 1.2
|   |-- <ESP8266WiFi> 1.0
|-- <DNSServer>
|   |-- <ESP8266WiFi> 1.0
|-- <EEPROM> 1.0
|-- <Ticker> 1.0
|-- <ArduinoOTA> 1.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <ESP8266mDNS> 1.2
|   |   |-- <ESP8266WiFi> 1.0
TypeError: a2b_base64() argument 1 must be string or buffer, not None:
  File "C:\Users\User\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 156:
    env.SConscript(item, exports="env")
  File "C:\Users\User\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 541:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\User\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 250:
    exec _file_ in call_stack[-1].globals
  File "C:\Users\User\Desktop\mobile-rr-master\www_proc.py", line 193:
    options = base64.b64decode(ARGUMENTS.get("CUSTOM_OPTION"))
  File "C:\Users\User\.platformio\python27\Lib\base64.py", line 75:
    return binascii.a2b_base64(s)
=============================================================== [FAILED] Took 4.61 seconds ===============================================================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

I have tried these both in Atom and VSCode but it does not work in both. Is anyone able to help me here?

Many thanks

SSID changes not processed

When changing the SSID, the change is not applied.
It seems line 477 causes this behaviour:
if ( config.channel != chan_selected ) // || config.ssid != ssid) )

If I change this to if (1==1) then the code after that is applied and the access point is spawned with the new SSID,

If I uncomment the OR clause then I receive an error:

comparison between distinct pointer types 'uint8* {aka unsigned char*}' and 'char*' lacks a cast [-fpermissive]

I do not have a lot of knowledge about changing this type, but will dive into this. Any help of course is appreciated.

Curiosity

I'm just wondering how you got the mp3s so small. I was looking to see if I could condense the files down to get them to fit better on an esp-01 with a 1m chip but trying to reduce the bitrate on the mp3 files produces a bigger file. Thus I'm wondering what was used to get them so small.

Error when compiling: invalid cast from type 'IPAddress' to type 'u8_t* {aka unsigned char*}'

When trying to compile the project in PlatformIO (IDE 1.2.0 and CLI 2.11.2) - installed fresh on a Windows 10 Pro 64bit machine because of this project - and project downloaded from github today (after several failed attempts to compile and upload it using Arduino IDE) i receive errors while compiling:

In file included from C:\Users\morfo.platformio\packages\framework-arduinoespressif\tools\sdk\include/user_interface.h:11:0,

from C:/Users\morfo\Documents/platformio/mobile-rr-master/src/mobile-rr.ino:42:
C:/Users\morfo\Documents/platformio/mobile-rr-master/src/mobile-rr.ino: In function 'void setup()':
C:\Users\morfo.platformio\packages\framework-arduinoespressif\tools\sdk\lwip\include/lwip/ip_addr.h:220:43: error: invalid cast from type 'IPAddress' to type 'u8_t* {aka unsigned char*}'

define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])

^
C:\Users\morfo.platformio\packages\framework-arduinoespressif\tools\sdk\lwip\include/lwip/ip_addr.h:226:38: note: in expansion of macro 'ip4_addr1'

define ip4_addr1_16(ipaddr) ((u16_t)ip4_addr1(ipaddr))

^
C:\Users\morfo.platformio\packages\framework-arduinoespressif\tools\sdk\lwip\include/lwip/ip_addr.h:240:24: note: in expansion of macro 'ip4_addr1_16'

define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \

^
C:/Users\morfo\Documents/platformio/mobile-rr-master/src/mobile-rr.ino:329:3: note: in expansion of macro 'IP2STR'
) ;
^
C:\Users\morfo.platformio\packages\framework-arduinoespressif\tools\sdk\lwip\include/lwip/ip_addr.h:221:43: error: invalid cast from type 'IPAddress' to type 'u8_t* {aka unsigned char*}'

define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])

^
C:\Users\morfo.platformio\packages\framework-arduinoespressif\tools\sdk\lwip\include/lwip/ip_addr.h:227:38: note: in expansion of macro 'ip4_addr2'

define ip4_addr2_16(ipaddr) ((u16_t)ip4_addr2(ipaddr))

^
C:\Users\morfo.platformio\packages\framework-arduinoespressif\tools\sdk\lwip\include/lwip/ip_addr.h:241:5: note: in expansion of macro 'ip4_addr2_16'
ip4_addr2_16(ipaddr),
^
C:/Users\morfo\Documents/platformio/mobile-rr-master/src/mobile-rr.ino:329:3: note: in expansion of macro 'IP2STR'
) ;
^
C:\Users\morfo.platformio\packages\framework-arduinoespressif\tools\sdk\lwip\include/lwip/ip_addr.h:222:43: error: invalid cast from type 'IPAddress' to type 'u8_t* {aka unsigned char*}'

define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2])

^
C:\Users\morfo.platformio\packages\framework-arduinoespressif\tools\sdk\lwip\include/lwip/ip_addr.h:228:38: note: in expansion of macro 'ip4_addr3'

define ip4_addr3_16(ipaddr) ((u16_t)ip4_addr3(ipaddr))

^
C:\Users\morfo.platformio\packages\framework-arduinoespressif\tools\sdk\lwip\include/lwip/ip_addr.h:242:5: note: in expansion of macro 'ip4_addr3_16'
ip4_addr3_16(ipaddr),
^
C:/Users\morfo\Documents/platformio/mobile-rr-master/src/mobile-rr.ino:329:3: note: in expansion of macro 'IP2STR'
) ;
^
...(several more repetitions of the above)
This is incidentally exactly the same error i gut stuck at in the Arduino IDE and the reason i decided to give PlatformIO a try.

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.