Close

One last push for functionality

A project log for Wi-Fi Thermal Receipt Printer V1

This was a technical thesis project designed to allow a user to get a print out of the current weather and the word of the day via Wi-Fi.

scott-clandininScott Clandinin 07/14/2016 at 20:130 Comments

Version 1 of the printer will nearly be set in stone I believe. The last thing I want to do is add in weather forecast data before being happy with it.

Speeding things up

In an effort to improve printing and data acquisition time, I re-evaluated my method for ensuring a proper connection. Before, everytime I made an API call, I would restart the wifi connection to ensure I was making the API call immediately after a successful connection. This process would take several seconds.

I found from the ESP8266 command set that rather than start a new connection, I can just check to see if the module is connected to my network. This command takes less than a second to process, which can greatly improve the speed of data requisition. The particular command I use to check the wifi status is "AT+CWJAP?". If connected, it will list my network name and IP address. If not connected, it will reply with "No AP.

Ditching OpenWeatherMap

OpenWeatherMap was a nice and reliable API for me, but the forcast request is inferior to other weather APIs. The forecast API call here will return the 5 day forecast in 3 hour blocks. I took a look at some other APIs and found a great one.

The Dark Sky Forecast API

This is an awesome free API with a lot of customization. Check out the documentation here. This API has the option of having blocks for minutely, hourly, daily weather forecast, as well as the ability to exclude any blocks that are not wanted. There is also a units preset for Canada so that wind speed is in kph rather than m/s! The daily forecasts are great as well, a lot of data, summary for the day, highs and lows.

The first 1000 API calls per day are free at this website, then following ones are fractions of a penny. I will never reach anywhere near that amount, so this is great for me.

The Challenge

The only difficult/annoying part of this will be parsing byte-by-byte again. It will be nice when I eventually learn how to process this on my own server, but in the meanwhile byte-by-byte will have to do. The following image can be intimidating to find patterns but there is a great tool for understanding the JSON format easier.

https://jsonformatter.curiousconcept.com/

Sorry for the low quality, but as you can see it's not quite as scary.

Discussions