After seeing an awesome Hack-a-Day “RickRolling” Free Wi-Fi access point based on a node MCU I wanted to see if I could do something similar on my tiny 51KB ESP-01 module. While annoying as all heck this “hack” is pretty clever and involves social engineering to rick-roll people. The users is lured in by free wifi that does not exist and then a message of the designers choice is displayed on their screen. The original can be found at Hack-a-day: ESP8266 Mobile Rick Roll Captive Portal – and like mine was based on the work of others. This was designed for a NodeMCU ESP with 4MB of flash – not the 512KB not found on the paltry ESP-01 – although the original “Captive Portal” did run on an ESP-01 it was much more limited in support. This project also gave me an excuse to try out the new PlatformIO IDE and dust-off my unused ESP-01 modules.
Materials:
1 – 512KB ESP-01 – The blue board one (Although the 1MB version I linked will also work)
1 – SparkFun (or compatible) 3.3V USB->FTDI Adapter
ConnectinG:
I wired the ESP-01 to the FTDI adapter with the jumpers. These jumpers I use are “almost stackable” which allows them to be wired together by jamming the pin from one into the wire-end of the connector of the other. I followed the diagram on found here on Haxter IO to wire the two together. It’s important that the CH_PD be pulled up (Chip Enable) and GPIO 0 Be pulled down for programming the flash. Failure to do this will result in the inability to flash your ESP.
Software:
Before I began I needed to download PlatformIO and install it. This process was a breeze as is most other software installs on a Mac. Following the guidelines on the Hack-A-Day website I installed the additional libraries. This is where PlatformIO shines. There was no reconfiguring or manually dragging around different components. It just worked. When I selected the ESP-01 it downloaded the proper toolchain and it just worked. Do you see the theme here? If you don’t it’s it just worked. My only complaint is that the library install referenced some “number” not a package name. I’m not sure if there is a “map” somewhere to tell which package numbers go with what libraries. I’m sure there is but I will find that out when I build my next full project in this environment.
I started with the awesome work from the RickRolling source by setting it up in PlatformIO. The libraries ESPAsyncTCP & ESPAsyncWebServer were added to the project by opening a terminal and entering “pio lib install 306”. The original code did fit but left very little to no room left in the flash for the redirect page and data. Even with he extra space the RickRoll animated GIF and MP3 wouldn’t fit. If I had the 1MB version above I would have been good. After modifying the source I gutted the HTML root directory and added my own index.htm (Important – it needs to be index.htm – not index.html) or a gzip compressed version named index.htm.gz. Here’s where you can customize and some Flair. Add a payload that does something more malicious or more fun…or to simply “advertise” something nearby that’s local. Yes it’s annoying. Yes it pollutes the air-waves but damn it’s fun.
iMac:mobile-rr-master root$ pio lib search ESPAsync* Found 3 libraries: [ ID ] Name Compatibility "Authors": Description ---------------------------------------------------------------------------------------------------------------------------------------------------- [ 305 ] ESPAsyncTCP arduino, espressif "Hristo Gochkov": Asynchronous TCP Library for ESP8266 and ESP32 [ 306 ] ESPAsyncWebServer arduino, espressif "Hristo Gochkov": Asynchronous HTTP and WebSocket Server Library for ESP8266 and ESP32 [ 359 ] ESPAsyncUDP arduino, espressif "Hristo Gochkov": Asynchronous UDP Library for ESP8266 iMac:mobile-rr-master root$ pio lib install 306
Upload:
Follow the directions for the original…including the second upload of the spiffs filesystem. I did note I needed to disconnect and re-connect my ESP-01 after uploading the initial image and before uploading the SPIFFS file system. After it’s complete remove the jumper to the GPIO 0 and let her rip.
Using it in the field:
I wired my usb cable right to a spare LiPo battery pack I had kicking around. This should give it quite a bit of runtime to have fun in crowded areas
About the Atom IDE:
I think I found a new IDE for doing Arduino (as well as many other types of development). Everything is nicely packaged up and works pretty seamlessly along with the addition of a keenly integrated shell. You can download the IDE here: PlatformIO. I was able to create and upload a simple blink with serial debug program to the ESP-01 in just a couple minutes. It was that easy and up until now these ESP-01 have just been sitting on the shelf. After I did this I started doing more research on how to find the library packages. PlatformIO has good documentation on their website on how to grab and install the packages. This information can be found on the Library Manager documentation page.
CODE:
You can find my source files here: <SOON>