Ameba Arduino Getting Information From Internet
by joeyzh in Circuits > Wireless
828 Views, 12 Favorites, 0 Comments
Ameba Arduino Getting Information From Internet
The Internet is a huge treasure data mine, if you know where and how to get it. In this project, we will show you how to use a simple search query and get the result out of Google.
you can use an Arduino board with wifi shield to complete this project. I am however using an Arduino compatible board called Ameba Arduino since it has a built-in wifi shield. You can find it at: https://www.seeedstudio.com/Ameba-Arduino-Wireless-Board-p-2699.html.
Search Query
We are going to use Google search protocol in this simple project. The Google search request is a standard HTTP GET or POST command, which returns results in either XML or HTML format, as specified in the search request.
The basic search request should includes three elements:
- The host name or IP address of this search.
- Search interface port (default HTTP serving port: 80 for HTTP, and 443 for HTTP over SSL/TLS)
- A path describing the search query.
If you'd like to know about Google's GET/POST command, please refer to this link: https://www.google.com/support/enterprise/static/gsa/docs/admin/72/gsa_doc_set/xml_reference/request_format.html
Code Reference
The Arduino sketch, WifiWebClient.sketch, is attached for your reference (If you have Ameba Arduino board, you can click "File" -> "Examples" -> "AmebaWiFi" -> "WiFiWebClient" to open it).
There are two lines of code that needs to be modify to suit your environment, ssid[] & pass[] for your AP's SSID and password. In the lower part of the code, you can see the three elements that consist the full search request, the interface port 80, the query GET command and the host name.
Downloads
Result
You can compile and download the code to your Ameba Arduino board, press the reset button, you can then see the information retrieved from Google is shown in the Arduino IDE. The search result will be in HTML format which can be used in other application.