Hardware Reference
In-Depth Information
communicates with the microcontroller via SPI, as does
the SD card on the shield or board. The temperature
sensor is an analog input, and the 120V relay to control
the air conditioner is a digital output. The IP camera in this
project is a consumer item that has a built-in server, so all
you have to do is configure it to speak to your router. The
clients are just web browsers on your smartphone, tablet,
or personal computer.
4. ... and the current thermostat trigger point.
5. The server sends the resulting page to the client.
6. Because the cat cam image is embedded in the page,
the client requests it from the IP camera.
7. The IP camera sends the image to the client.
8. The client changes the trigger point via a form on the
page, and submits it using HTTP POST.
9. The server reads the POST request and updates the
thermostat.
10. The server sends back a response page.
Even though it seems simple enough, there are actually 10
steps to the interaction, which are listed below:
Some of this, like getting the camera image and the
resulting page, can be solved using HTML. You won't need
to do any extra programming, because it will be taken care
of by the browser when it interprets the HTML. The main
programming challenge is to build a basic web server on
the Arduino that serves files from the SD card.
1. The client makes an HTTP GET request for the main
interface page (index.htm).
2. The microcontroller server reads the page from the SD
card.
3. The server reads the temperature...
Mobile
Client
GET
index.htm
1
5
7
200 OK
index.htm
6
200 OK
image.jpg
8
GET
image.jpg
POST
form
200 OK
result.htm
10
Ethernet
Shield
Camera
3
Temperature
Sensor
Get sensor
Microcontroller
2
4
Get
index page
Get
thermostat
SD
Card
Relay
Figure 10-4
The interaction diagram for the CatCam 2
and air conditioner controller.
Update
thermostat
9
 
Search WWH ::




Custom Search