Introduction: The WunderThing: a Battery-Powered, Magnetic, ESP8266 Weather Forecasting IoThing!

About: I'm a maker, an engineer, and mercurial. Fair warning.

Hello there,

For my first ever instructable let me tell you about A Wunderful Thing. This was a fairly recent project where my goal was to build a weather forecasting refrigerator magnet!

The controller of choice for this project was Sparkfun's Thing, an ESP8266 bundled with all kinds of goodies. When the Thing is turned ON by the user a data request is sent from the Thing to the Wunderground (via WiFi) using an API key and some location info. The requested forecast data is sent back to the Thing, which then picks out the pieces it wants and stores them. The user can explore this data by pressing directional buttons and viewing the display. The user is also able to access a settings menu to change their Wifi ID, password, zip code, and API key.

Anywho, this project was a lot of fun and incorporated some unique elements. I hope you build one yourself or something like it using what you learn from this Instructable.

Enjoy :)

Step 1: Wiring the WunderThing

So here's how you wire up this Thing. This was my first time using Fritzing as well, pretty cool.

The 3.7V LiPo battery shown can be of any size, but I would recommend at least 500mAh (ESP8266 is power hungry). The on-board charger works very well, just plug in any old micro USB. NOTE: To upload code, you MUST power the Thing separate from the FTDI (via a battery or USB).

Shown wired to the Thing is an FTDI-USB adapter (any 3.3V FTDI will do), an OLED display, and 4 push buttons. You will need to solder BOTH jumpers closed on the back of the OLED. The buttons are shown with external pull up resistors (I don't trust internal pull ups, but in theory there's nothing wrong with just using those).

IF YOU WANT TO DO SERIAL DEBUGGING: Find the two .1" holes above the FTDI holes on the Thing. Cut the trace between these holes on the back of the Thing. Add a header to those two holes however is easiest for you to change the open/closed state of that circuit. To upload code, short the circuit. To allow serial debugging, open the circuit. Sparkfun lays this out for you in the Thing tutorial. Cuz Sparkfun is awesome, so is Adafruit.

Step 2: Programming the WunderThing

The code to make the WunderThing work... is nasty.

I will lay out instructions to make it work like my demo, but if you want to add/customize/etc it's not gonna be an easy road. I did go through and comment it out, so hopefully that helps, but I never did get around to really cleaning up structure (which ended up quite stitched together with some copy pasta pieces and other shameful quick fixes).

Here are the (kinda) Wunderful instructions:

1. Add the Thing to Arduino's Board Manager. Don't forget to Blink test it.

2. Get the following libraries from Github: Adafruit_GFX, Adafruit_SSD1306, ArduinoJson (might be included already)

3. Make yourself a Wunderground API key by creating an account here, follow links to get key (FREE for what you will need)

3. Change arduino programming settings to: Sparkfun Thing, 115200, ArduinoTinyISP, Port #, etc, etc. CHANGE THE CODE (line 139) for your wifi and zip info.

4. Turn the Thing ON (don't forget to plug in a battery or usb first), compile and upload the code via FTDI. Leave the Thing ON.

5. CHANGE THE CODE AGAIN (line 165), Compile and upload again.

6. If it pings your Wifi twice for data, and displays it, you can then hoot and holler in celebration.

7. If things did not go as intended, try turning it off and then back on again. If that doesn't work, throw it all away in anger and go back to simpler projects, otherwise you'll probably have to bang your head against a wall wundering what I did in my code that doesn't agree with what you desire to do with it.... but I'm sure it'll all be fine :)

Step 3: Using the WunderThing

So... the way I laid this out isn't exactly intuitive, but it should only take a few minutes to figure out how to navigate this Thing.

Think of it like an excel sheet where the current cell is shown on the display. Use the picture above as a reference. The only odd ball is the Settings menu, which isn't fully described by the picture. The settings menu should be self explanatory though. If you choose to 'Change Zip Code' or any other setting, just use the left/right buttons to switch between characters in the string (current position shown with a period indicator), and the up/down buttons to scroll through characters. The Thing will auto-save your entry once you back all the way out to the settings menu (using internal EEPROM).

Step 4: Building the WunderThing

Only after you have successfully bread-boarded this Thing, then you might consider making it a finished product-ish.

My clocks were all mounted on super simple 3D printed mounts. I'll include the solidworks part file in case you want to give that a try.

To keep everything in place, I just glued a little piece of broken protoboard in the corner of the button pad, and that seemed to work quite well and allows for 'easy' removal if ever needed. In hindsight I definitely should have just used the drill holes available from the Thing and the OLED when I designed the mount... oh well. The LiPo fit super nice though. I used the Tenergy one shown, which was great except THE CONNECTOR WAS WRONG. No big deal though, just bought some connectors (JST-PH) from adafruit and replaced the ones on the batteries.

You will notice a little drawing on my clocks of mountain scenery. That was just me using up some free space. Maybe you can find a better use for it. You will also notice all the clocks were colorful, just some layers of acrylic paint.

To make it a fridge magnet, just buy some magnet tape, and put a couple strips on. Works well.

Step 5: Going Further With the WunderThing

Huge potential to improve/modify/make your own.

I really wanted to include weather icons, but ran out of memory. Something tells me it SHOULD have been possible to trim down the memory, but that JSON business is quite hairy and I'm inexperienced with using it (allocating memory for buffers and storage, etc).

Check out this instructable where someone made an ESP8266 weather forecaster as well.

You might also consider USING THE ON-BOARD TEMPERATURE/HUMIDITY SENSOR SLOT!!! I did not, it was just a little out of my budget. But that would be a super simple addition to allow the user to view inside temperature, maybe even feed that back into the Wunderground. There is also an on-board ILLUMINOSITY SENSOR SLOT!! You might add an LED strip to make this Thing an auto-magic NIGHT-LIGHT! There's also an on-board ECDSA slot, not sure what all you might use that for but its certainly useful (possibly for hashing).

The Thing just packs so much in one board. What an awesome little device!

Step 6: Another Project: a 'Smart' Alarm Clock

So I won't get into much detail about this project, it's just for interest. A few years back (Christmas 2013 I believe) I made about a dozen of these other clocks for family/friends. They were made of a Pro Trinket, a DS1307 RTC, a DHT sensor, a piezo buzzer, an LCD, a potentiometer, and some buttons for a home-brewed 'smart' alarm clock. The 'smart' part is really just because of the RTC's ability to store time/date for years, even when the device is powered off. All the pieces were mounted on cheap plastic picture frames. The final ones actually turned out nice, and had custom posterboard drawings surrounding all the elements. Shown in the picture was my prototype.

This clock allowed the user to view time/date and calendar events (I also did some calendar events for the WunderThings as you might have noticed). It also allows for the user to set an alarm (with the potentiometer), which is what the piezo buzzer was for. I found some cool tunes for the user to choose from (super mario theme, star wars imperial march, more).

Anywho, I thought including this project might inspire someone to give their own 'smart' clock idea a chance. I also wanted to give you some background on my clocking experiences. If I get enough requests, I will make an instructable just for this project.

Sadly I have not been an active contributor to the open source community in the past, so I will remedy this by going back through some of my favorite projects over the years and posting them!

Thanks for reading. :)