What can you do with one button?  Pretty much anything.

This one button (of course along with the microcontroller, a display and WiFi) provides:

  • A weather station with awesomely cool icons
  • Clock with date and time
  • Flappy bird (of course)
  • A secret mode ... (shh, don't tell: only courageous souls can unlock the mysteries)


What else can you think of to do with one button, a display and WiFi?

Bill of Materials

  • Half-sized protoboard
  • ESP8266 board (Adafruit Feather Huzzah)
  • OLED display (SSD1306, 128x64 pixels)
  • Of course, a button

Electrical Connections:

  • OLED Display GND -> Feather GND (ground)
  • OLED Display VCC -> Feather 3V
  • OLED Display SCL -> Feather SCL
  • OLED Display SDA -> Feather SDA
  • Switch, first connection -> Feather GND (ground)
  • Switch, second connection -> Feather Pin 14 (can be adjusted but change the code for "BUTTON_PIN"

That's it for the connections.  

All of this will fit onto a single small breadboard if you space it like shown in the photo.  The display hangs off the right edge so that you lavea some room for the button.  If you were a super-creative sort, you could hang the feather further off the end and have room for a second button, but then it wouldn't be a one-button box, would it?

Software

I grabbed a few different libraries and made this into a grab-bag of modes.

For the weather station, I utilize the openweathermap.org API.  You will need to signup and add your API key to the settings.h page (OPEN_WEATHER_MAP_APP_ID).  Also, you will want to update the location for your weather.  Look up the ID on the openweathermap web page and then plug in the ID and description on the settings.h page.

The first time you load the software onto the board, change the settings.h file with `firstTimeThrough=true`.  This will reset the secret mode click counter to 0.  

Then, change the software to ``firstTimeThrough=false` and upload the code to the board again.

Startup

The first time you startup the board, you will need to setup the WiFi credentials.  If a WiFi network cannot be accessed, the board will go into access point mode.  Go to your phone or computer and connect to the WiFi network called "One Button Box" WiFi and set the WiFi credentials for your network.  

Your network name must be public for this to find it.  If not, you will have to either hardcode it into the Arduino program, or just temporarily open your WiFi network name as public so the OneButtonBox can find it, then close it back.  

Operation

If everything was setup right, you will see the weather icon, the current temperature and the daily min/max.  

Click once and the time and date will show up.

Click again and you have to complete a game of Flappy Bird.

Click again and you're back to the beginning.

Super SECRET MODE: I wouldn't recommend telling you this, but if you read this far then you have proven worthy of the secrets contained within the OneButtonBox.  To access this Super SECRET MODE, hold the OneButton down and state several incantations of your choosing, preferably from the lore of your ancestors, traced back to prehistory, imbued into your chromosomes and only now emanating forth from your lips.  After sufficient duration of said proper and robust incantations, you will enter the sacred realm of the holy-of-holies (so to speak) where few have the nobility and courage to trod.  Or more aptly described as the ButtonMashingRealmOfNonVolatility.  In this mode, any forces applied to the button will incur the counter to rise.  Debouncing is practically nonexistent so you may enjoy a multiplication of your effort for each action upon the noble button.  The total sum calculation representing the vigor, frequency and fortitude that you place upon this button will ever be stored within the sacred non-volatile tomes ferreted deep within the microcontroller, only to be indicated to those who have the knowledge,...

Read more »