ArduCAM now Supports ESP8266 Arduino Board with WIFI Websocket Camera Demo

Featured

It is good news to hear that the Arduino IDE support was announced on the ESP8266 community forum, the source code can be found from . It is more than another Arduino board, but can be thought as a Arduino combined with a WIFI shield. With faster CPU speed and much smaller form of factor, most important the less than $10USD price is more attractive, you are worth to try although there are also some limitations. Setup is fairly simple with downloads for Linux, OS X, and Windows. More detail setup can be found from adafruit guide.

Now ArduCAM ports our camera libraries for ESP8266, you can use the ESP8266 module with ArduCAM modules to take high quality high resolution photos and save to SD card, or even to publish the photos to webpage. In this tutorial we will use ESP8266 arduino board to take photos and publish to webpage.

Websocket Background

In order to transfer a photo to webpage, I have to briefly introduce the technology of websocket first. WebSocket is a protocol providing full-duplex communication channels over a single TCP connection. It is designed to be implemented in web browsers and web servers, so it can be used by any client and any platform like PCs, laptops, pads and smart phones. The standard HTTP protocol which is C/S based architecture, a client send a request to a server, the server send the information requested back to the client and close connection immediately. Unlike the standard HTTP protocol, the websocket protocol only use HTTP protocol for handshake stage, and keep the connection open afterward. It allows bi-directional conversation between a browser and the server. Detail websocket description can be found from wiki.

In this demo, we create a websocket server on the ESP8266 arduino borad. It connects to a user defined WIFI router by DHCP, then you can connect to this server via your web browser.

Demo Prerequisite

To complete this demo you need two items:

Hardware connection

The connection between the ESP8266 board and ArduCAM mini is shown as the following picture and table.

 

 

 

 

 

 

 

 

Arduino Sketches and library

Before running the demo sketch, you need to copy three libraries ArduCAM, UTFT4ArduCAM_SPI and ESP8266-Websocket to the Arduino libraries folder.

Open the demo sketch ArduCAM_Mini_OV2640_websocket_server.ino, change the following line according to your own wifi AP router, then upload.

const char* ssid = "your_ssid";
const char* password = "your_passpwd";

ESP8266_sketch ESP8266_upload

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The assigned IP address can be determined via serial monitor message.

DHCP_IPaddress

 

 

 

 

 

 

 

 

 

 

 

 

 

Provide you now have the IP address 192.168.1.105 for websocket server, and open the camera_demo.html located in your Arduino\arduino-1.6.5-r5\libraries\ArduCAM\examples\ESP8266\ArduCAM_Mini_OV2640_websocket_server\html folder from your web browser. Change the websocket IP address get from the serial monitor marked in red box in the picture.

ESP8266_webpageClick the “Connect” button, you will see the websocket connection request from the serial monitor. After few seconds, the webpage will notify the successful connection established.

ESP8266_websocket_request

After that you can click the send button to send a websocket message to ESP8266. It will trigger the capture command on the ESP8266 arduino side, and it will send back the captured image and display on the webpage.

ESP8266_websocket_demo