Paper Feeder - Acknowledgements

|
Acknowledgements
|
bet | 2/9 | Sana | 02.01.2020 | Hajmi | 3,42 Mb. | | #8209 |
A 65mm long rod with a roller section and a gear on the end serves to feed the paper off the roll.
2.1.1 Roller
The roller is 50mm long and has a diameter of 5mm. It is made of a gripping plastic that helps pull on the paper to roll it out. The roller is mounted to be free spinning.
2.1.2 Gear
A small plastic gear is located on the end of the paper feeder rod opposite the latch. It has a 6mm radius and is 2mm wide. When the lid is closed, the gear makes contact with another small gear below. This spins the roller to feed the paper through the slot.
2.2 Opening Mechanism
The opening mechanism is a rod with a latch on one end, and an oval shaped piece of on the opposite site designed to pop the lid open.
2.2.1 Latch
The latch serves to allow the user to open the lid, and is located right beside it. Half of it is smooth plastic, curving down towards the middle. The other half closer to the edge is corrugated for grip when opening. It has a length of 17mm and a width of 8mm.
2.2.2 Rod
A 61mm long plastic rod with a diameter of 3mm sits between the latch and the flip opener. When the lid is closed, the rod is held in place by a very small clip. When closed, the lid sits under a lip that keeps it shut. Opening the lid causes the rod to be free spinning.
2.2.3 Flip Opener
Attached to the end opposite the latch is a small ovular bit of plastic 7mm long. Pulling the latch open causes this to rotate downwards. As it rotates down, it pushes against a ledge 6 mm from the top of the printer. This pops the lid out from under the lip allowing access to the paper storage.
3.1 Background
The Wi-Fi module chosen for this project allows sending and receiving data wirelessly from the internet. This will be utilized to get the current temperature and wind speed in Saskatoon. Several ordered steps need to be done in order to utilize this device. The process of online data acquisition is done through what is called an Application Program Interface (API). A websites API serves as an easy and efficient way for site users to access data of interest. A website like www.openweathermap.org allows anyone to easily access weather data through their API. It is essentially a service that allows one to access a custom URL that contains data of interest that can be easily parsed and used. The main steps include selecting the data of interest, using the Wi-Fi module commands to retrieve data from a website, and parsing the data that has been returned.
3.2 API Configuration
There are slightly different methods of setting up the API URL for each service. The process will be detailed below for the two API services used in this project. Open Weather Map is used for weather data, and Wordnik is used for the word-of-the-day.
3.2.1 Weather API
To begin, the data API URL of interest needs to be set up with the city and data parameters to help narrow in on useful data. With the service Open Weather Map, it is necessary to create a profile with them to receive an API “key” that is needed to make an API request. The free version of this service allows a person to request current weather data, or a 5 day forecast with weather predictions every 3 hours. Parameters must be appended to the API URL in order to select the desired unit (imperial or metric), and to validate the API call with the unique API key. These parameters are appended to the link in the form of “¶meter=value”. The completed URL to receive metric data of current weather in any city would appear as:
http://api.openweathermap.org/data/2.5/find?q=&units=metric&appid=
3.2.2 Word-of-the-Day API
Wordnik is a free service with many functions such as defining words, listing related words, pronunciation of words, and others. Similar to Open Weather Map, it also requires an API “key” for data requests. This particular API URL requires little customization. The URL needed to request the word of the day would be:
http://api.wordnik.com/v4/words.json/wordOfTheDay?api_key=
3.3 HTTP Communication
To communicate with the website servers, use of HTTP is required. There is a step-by-step process to follow for communication. First, the microcontroller needs to send commands to the Wi-Fi module that are needed to make the API Request for the URL determined in the first step. Next, it needs to connect to the Saskatchewan Polytechnic wireless internet. This is done with a simple command that only needs to know the network name and password (if there is one). The next step is to make a connection with the website domain. The parameters of this request are the domain that will be connected to, the type of data transfer used, and the port number.
To properly use this to connect to the website, the data transfer type will be Transmission Control Protocol (TCP), and the port that deals with HTTP requests is 80. Next, it is required to specify the length of the GET request that will be sent to the server. GET (not an acronym) is an HTTP request method that can be used to pull data from the URL of interest. The main part of the GET request is the customized URL from the first part. This tells the server to send the data from that URL. The length of this request is simply the number of all characters and spaces in the GET request line. Finally, the GET request is sent to the server, which replies with the raw data.
The last step is parsing the data that has been received from the server.
3.4.1 JavaScript Object Notation
JavaScript Object Notation (JSON) is a format for the interchange of data. This is typically the default data format for API services. Other data structures include Hyper Text Markup Language (HTTP) and less commonly Comma Separated Values (CSV). The structure of JSON is a collection of name/value pairs that allows for identifiers to be associated with values and other identifiers[Int]. The length of data is not always the same, but the identifiers are, so a person can always find the data associated with the identifier. The order of identifiers is nearly always exactly the same each time, allowing byte-by-byte parsing techniques to be used.
3.4.2 Parsing JSON
With the limited RAM of microcontrollers, it isn’t always possible or ideal to parse the data with typical JSON parsing techniques. For large amounts of data, it is necessary to parse byte-by-byte. This is possible by taking note of the patterns of data to be expected. Unwanted data can be skipped by waiting until characters such as parenthesis and colons appear. Since identifiers and values will follow the same order for each API call, it is possible for the programmer to know that the desired piece of data will always appear in-between a certain pair of quotation marks. An example of the JSON format can be seen in Figure 2 from w3schools.com.
Figure 2 - JSON Format Example
4.0 Instructions for Operation
This quick and easy-to-follow guide will help you set up, use, and maintain the Wi-Fi Weather Printer. The device is powered from a regular wall outlet and connects automatically to your wireless network. No tools are needed to get started, and there is no assembly required. In a few simple steps you will be ready to print out the current weather in your city.
4.1 Parts Included
1x Weather Station
1x AC wall adapter
2x receipt printer paper roll (Length: 58 mm long, Diameter: 39 mm)
|
| |