SlideShare una empresa de Scribd logo
1 de 19
Descargar para leer sin conexión
Creating an Arduino Web
         Server
  From scratch hardware and software
Web Servers

Simpler than you think

A web server

  Listens for connections

  Parses requests

  Send back status messages and resource
  requested
Arduino Overview

Open source physical computing platform

Multiple form factors

Easy to code (C/C++ like) and use (USB)

Low cost

Great for prototypes, wearable computers,
sensor networks etc
Arduino Hardware
ATMega 8 bit microcontroller

32K program memory, 2K SRAM, 1K EEPROM

Dual purpose digital inputs and outputs

Analog inputs

High performance (16 MIPS)

Low power (3.3V or 5V)
Arduino IDE/Software

Open source

Cross platform (Mac, PC and Linux)

Alpha but stable

Simple to use

Includes documentation, help, samples and
library for common tasks
Arduino Shields

Hardware can be easily extended

Shields plug in on top of standard boards

Build your own or buy off the shelf (lots
available)

Stackable, can use more than one
Ethernet Shields

Several shields available

Two main types DHCP and non DHCP

Some configuration required

Non DHCP you set IP and MAC address in
code
IP and MAC address

Set IP address and MAC address in your
code

Need to be careful with duplicates

Set up like so:
Ethernet.begin(mac, ip);
Ethernet Library

Standard ethernet library

Includes Client and Server classes

Create server like so:
Server server(80);
server.begin();

Bare bones web server about 20 lines of
code and 5K compiled
HTTP Protocol


HyperText Transfer Protocol

Used by web servers to transfer web pages
to be displayed in your web browser

Connection (usually) on port 80
TCP Connections

TCP three way connection handshake

Client sends SYN with random number (A)

Server replies with SYN-ACK containing A+1
and random number (B)

Client replies with ACK containing B+1

Luckily ethernet library does this for you!
Connection Code

Create a client
Client client = server.available();

Connected
while (client.connected()
{
....
}
HTTP Requests

Start with request “GET index.html HTTP/1.1”

Optional headers “Accept-Language: en”

Empty line

Optional message body (POST and other
requests)
HTTP Request Hack


Standard GET request have request followed
by blank line

So just ignore what is requested and check
for blank line
Request Code
Read characters
char c = client.read();

If newline and last character was newline
if (c == 'n' && blankline) {
  ...
}
if (c == 'n') {
      blankline = true;
}
HTTP Response

Send back status line "HTTP/1.1 200 OK"

Send back content type "Content-Type: text/
html"

Send blank line

Send (HTML) content
Response Code

Send status and content type
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();

Send content
for (int i =0; i < nolines; i++) {
   client.println(content[i]);
}
Close Connections


Clear up after you
client.flush();
client.stop();
Arduiono Web Server
       Demo


Aruino IDE

Web browser

Más contenido relacionado

La actualidad más candente

Chatting dengan beberapa pc laptop
Chatting dengan beberapa pc laptopChatting dengan beberapa pc laptop
Chatting dengan beberapa pc laptopyayaria
 
Encrypt all transports
Encrypt all transportsEncrypt all transports
Encrypt all transportsEleanor McHugh
 
Network programming Using Python
Network programming Using PythonNetwork programming Using Python
Network programming Using PythonKarim Sonbol
 
Python Network Programming – Course Applications Guide
Python Network Programming – Course Applications GuidePython Network Programming – Course Applications Guide
Python Network Programming – Course Applications GuideMihai Catalin Teodosiu
 
ikh331-06-distributed-programming
ikh331-06-distributed-programmingikh331-06-distributed-programming
ikh331-06-distributed-programmingAnung Ariwibowo
 
Socket programming
Socket programmingSocket programming
Socket programmingAnurag Tomar
 
Advanced Sockets Programming
Advanced Sockets ProgrammingAdvanced Sockets Programming
Advanced Sockets Programmingelliando dias
 
maXbox Starter 39 GEO Maps Tutorial
maXbox Starter 39 GEO Maps TutorialmaXbox Starter 39 GEO Maps Tutorial
maXbox Starter 39 GEO Maps TutorialMax Kleiner
 
Hands on with Smart Contracts session #3
Hands on with Smart Contracts session #3Hands on with Smart Contracts session #3
Hands on with Smart Contracts session #3Gene Leybzon
 
[4] 아두이노와 인터넷
[4] 아두이노와 인터넷[4] 아두이노와 인터넷
[4] 아두이노와 인터넷Chiwon Song
 
sbt-ethereum: a terminal for the world computer
sbt-ethereum: a terminal for the world computersbt-ethereum: a terminal for the world computer
sbt-ethereum: a terminal for the world computerSteve Waldman
 
Poker, packets, pipes and Python
Poker, packets, pipes and PythonPoker, packets, pipes and Python
Poker, packets, pipes and PythonRoger Barnes
 
Application Layer and Socket Programming
Application Layer and Socket ProgrammingApplication Layer and Socket Programming
Application Layer and Socket Programmingelliando dias
 
Opentalk at Large - StS 2005
Opentalk at Large - StS 2005Opentalk at Large - StS 2005
Opentalk at Large - StS 2005Martin Kobetic
 

La actualidad más candente (20)

Chatting dengan beberapa pc laptop
Chatting dengan beberapa pc laptopChatting dengan beberapa pc laptop
Chatting dengan beberapa pc laptop
 
Encrypt all transports
Encrypt all transportsEncrypt all transports
Encrypt all transports
 
Network programming Using Python
Network programming Using PythonNetwork programming Using Python
Network programming Using Python
 
Python Network Programming – Course Applications Guide
Python Network Programming – Course Applications GuidePython Network Programming – Course Applications Guide
Python Network Programming – Course Applications Guide
 
Whispered secrets
Whispered secretsWhispered secrets
Whispered secrets
 
Socket System Calls
Socket System CallsSocket System Calls
Socket System Calls
 
ikh331-06-distributed-programming
ikh331-06-distributed-programmingikh331-06-distributed-programming
ikh331-06-distributed-programming
 
Socket programming
Socket programmingSocket programming
Socket programming
 
Ppt of socket
Ppt of socketPpt of socket
Ppt of socket
 
Advanced Sockets Programming
Advanced Sockets ProgrammingAdvanced Sockets Programming
Advanced Sockets Programming
 
maXbox Starter 39 GEO Maps Tutorial
maXbox Starter 39 GEO Maps TutorialmaXbox Starter 39 GEO Maps Tutorial
maXbox Starter 39 GEO Maps Tutorial
 
Hands on with Smart Contracts session #3
Hands on with Smart Contracts session #3Hands on with Smart Contracts session #3
Hands on with Smart Contracts session #3
 
[4] 아두이노와 인터넷
[4] 아두이노와 인터넷[4] 아두이노와 인터넷
[4] 아두이노와 인터넷
 
sbt-ethereum: a terminal for the world computer
sbt-ethereum: a terminal for the world computersbt-ethereum: a terminal for the world computer
sbt-ethereum: a terminal for the world computer
 
Poker, packets, pipes and Python
Poker, packets, pipes and PythonPoker, packets, pipes and Python
Poker, packets, pipes and Python
 
Application Layer and Socket Programming
Application Layer and Socket ProgrammingApplication Layer and Socket Programming
Application Layer and Socket Programming
 
Introduction to Rust
Introduction to RustIntroduction to Rust
Introduction to Rust
 
iCloud keychain
iCloud keychainiCloud keychain
iCloud keychain
 
Opentalk at Large - StS 2005
Opentalk at Large - StS 2005Opentalk at Large - StS 2005
Opentalk at Large - StS 2005
 
Socket Programming
Socket ProgrammingSocket Programming
Socket Programming
 

Similar a Create an Arduino Web Server

Unit-4 networking basics in java
Unit-4 networking basics in javaUnit-4 networking basics in java
Unit-4 networking basics in javaAmol Gaikwad
 
Network Programming in Java
Network Programming in JavaNetwork Programming in Java
Network Programming in JavaTushar B Kute
 
Network programming in Java
Network programming in JavaNetwork programming in Java
Network programming in JavaTushar B Kute
 
Lan chat system
Lan chat systemLan chat system
Lan chat systemWipro
 
Your app lives on the network - networking for web developers
Your app lives on the network - networking for web developersYour app lives on the network - networking for web developers
Your app lives on the network - networking for web developersWim Godden
 
Raspberry pi Part 23
Raspberry pi Part 23Raspberry pi Part 23
Raspberry pi Part 23Techvilla
 
Driver Configuration Webinar
Driver Configuration WebinarDriver Configuration Webinar
Driver Configuration WebinarAVEVA
 
Network Prog.ppt
Network Prog.pptNetwork Prog.ppt
Network Prog.pptEloOgardo
 
Networking Java Socket Programming
Networking Java Socket ProgrammingNetworking Java Socket Programming
Networking Java Socket ProgrammingMousmi Pawar
 

Similar a Create an Arduino Web Server (20)

Unit-4 networking basics in java
Unit-4 networking basics in javaUnit-4 networking basics in java
Unit-4 networking basics in java
 
Unit 8 Java
Unit 8 JavaUnit 8 Java
Unit 8 Java
 
Network Programming in Java
Network Programming in JavaNetwork Programming in Java
Network Programming in Java
 
Network programming in Java
Network programming in JavaNetwork programming in Java
Network programming in Java
 
Sockets
Sockets Sockets
Sockets
 
6005679.ppt
6005679.ppt6005679.ppt
6005679.ppt
 
Lan chat system
Lan chat systemLan chat system
Lan chat system
 
Your app lives on the network - networking for web developers
Your app lives on the network - networking for web developersYour app lives on the network - networking for web developers
Your app lives on the network - networking for web developers
 
03 sockets
03 sockets03 sockets
03 sockets
 
Raspberry pi Part 23
Raspberry pi Part 23Raspberry pi Part 23
Raspberry pi Part 23
 
java networking
 java networking java networking
java networking
 
Driver Configuration Webinar
Driver Configuration WebinarDriver Configuration Webinar
Driver Configuration Webinar
 
Java 1
Java 1Java 1
Java 1
 
Networking
NetworkingNetworking
Networking
 
Network Prog.ppt
Network Prog.pptNetwork Prog.ppt
Network Prog.ppt
 
Net Programming.ppt
Net Programming.pptNet Programming.ppt
Net Programming.ppt
 
class30.ppt
class30.pptclass30.ppt
class30.ppt
 
Osi model
Osi modelOsi model
Osi model
 
class28.ppt
class28.pptclass28.ppt
class28.ppt
 
Networking Java Socket Programming
Networking Java Socket ProgrammingNetworking Java Socket Programming
Networking Java Socket Programming
 

Más de Justin Mclean

A Practical Guide to Connecting Hardware to Flex
A Practical Guide to Connecting Hardware to FlexA Practical Guide to Connecting Hardware to Flex
A Practical Guide to Connecting Hardware to FlexJustin Mclean
 
ColdFusion Security and Risk Management
ColdFusion Security and Risk ManagementColdFusion Security and Risk Management
ColdFusion Security and Risk ManagementJustin Mclean
 
Connecting RIAs and hardware together
Connecting RIAs and hardware togetherConnecting RIAs and hardware together
Connecting RIAs and hardware togetherJustin Mclean
 
ColdFusion Security and Risk Management
ColdFusion Security and Risk ManagementColdFusion Security and Risk Management
ColdFusion Security and Risk ManagementJustin Mclean
 
Connecting hardware to ColdFusion
Connecting hardware to ColdFusionConnecting hardware to ColdFusion
Connecting hardware to ColdFusionJustin Mclean
 
Connecting open source hardware to the web
Connecting open source hardware to the webConnecting open source hardware to the web
Connecting open source hardware to the webJustin Mclean
 
Putting your device in a browser or on the web
Putting your device in a browser or on the webPutting your device in a browser or on the web
Putting your device in a browser or on the webJustin Mclean
 
Connecting hardware up to ColdFusion
Connecting hardware up to ColdFusionConnecting hardware up to ColdFusion
Connecting hardware up to ColdFusionJustin Mclean
 
Connecting Hardware to Flex (360MAX)
Connecting Hardware to Flex (360MAX)Connecting Hardware to Flex (360MAX)
Connecting Hardware to Flex (360MAX)Justin Mclean
 
A practical guide to connecting hardware to Flex
A practical guide to connecting hardware to FlexA practical guide to connecting hardware to Flex
A practical guide to connecting hardware to FlexJustin Mclean
 

Más de Justin Mclean (11)

A Practical Guide to Connecting Hardware to Flex
A Practical Guide to Connecting Hardware to FlexA Practical Guide to Connecting Hardware to Flex
A Practical Guide to Connecting Hardware to Flex
 
ColdFusion Security and Risk Management
ColdFusion Security and Risk ManagementColdFusion Security and Risk Management
ColdFusion Security and Risk Management
 
Connecting RIAs and hardware together
Connecting RIAs and hardware togetherConnecting RIAs and hardware together
Connecting RIAs and hardware together
 
ColdFusion Security and Risk Management
ColdFusion Security and Risk ManagementColdFusion Security and Risk Management
ColdFusion Security and Risk Management
 
Connecting hardware to ColdFusion
Connecting hardware to ColdFusionConnecting hardware to ColdFusion
Connecting hardware to ColdFusion
 
Connecting open source hardware to the web
Connecting open source hardware to the webConnecting open source hardware to the web
Connecting open source hardware to the web
 
Putting your device in a browser or on the web
Putting your device in a browser or on the webPutting your device in a browser or on the web
Putting your device in a browser or on the web
 
Connecting hardware up to ColdFusion
Connecting hardware up to ColdFusionConnecting hardware up to ColdFusion
Connecting hardware up to ColdFusion
 
Edge Of The Web
Edge Of The WebEdge Of The Web
Edge Of The Web
 
Connecting Hardware to Flex (360MAX)
Connecting Hardware to Flex (360MAX)Connecting Hardware to Flex (360MAX)
Connecting Hardware to Flex (360MAX)
 
A practical guide to connecting hardware to Flex
A practical guide to connecting hardware to FlexA practical guide to connecting hardware to Flex
A practical guide to connecting hardware to Flex
 

Último

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Último (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

Create an Arduino Web Server

  • 1. Creating an Arduino Web Server From scratch hardware and software
  • 2. Web Servers Simpler than you think A web server Listens for connections Parses requests Send back status messages and resource requested
  • 3. Arduino Overview Open source physical computing platform Multiple form factors Easy to code (C/C++ like) and use (USB) Low cost Great for prototypes, wearable computers, sensor networks etc
  • 4. Arduino Hardware ATMega 8 bit microcontroller 32K program memory, 2K SRAM, 1K EEPROM Dual purpose digital inputs and outputs Analog inputs High performance (16 MIPS) Low power (3.3V or 5V)
  • 5. Arduino IDE/Software Open source Cross platform (Mac, PC and Linux) Alpha but stable Simple to use Includes documentation, help, samples and library for common tasks
  • 6. Arduino Shields Hardware can be easily extended Shields plug in on top of standard boards Build your own or buy off the shelf (lots available) Stackable, can use more than one
  • 7. Ethernet Shields Several shields available Two main types DHCP and non DHCP Some configuration required Non DHCP you set IP and MAC address in code
  • 8. IP and MAC address Set IP address and MAC address in your code Need to be careful with duplicates Set up like so: Ethernet.begin(mac, ip);
  • 9. Ethernet Library Standard ethernet library Includes Client and Server classes Create server like so: Server server(80); server.begin(); Bare bones web server about 20 lines of code and 5K compiled
  • 10. HTTP Protocol HyperText Transfer Protocol Used by web servers to transfer web pages to be displayed in your web browser Connection (usually) on port 80
  • 11. TCP Connections TCP three way connection handshake Client sends SYN with random number (A) Server replies with SYN-ACK containing A+1 and random number (B) Client replies with ACK containing B+1 Luckily ethernet library does this for you!
  • 12. Connection Code Create a client Client client = server.available(); Connected while (client.connected() { .... }
  • 13. HTTP Requests Start with request “GET index.html HTTP/1.1” Optional headers “Accept-Language: en” Empty line Optional message body (POST and other requests)
  • 14. HTTP Request Hack Standard GET request have request followed by blank line So just ignore what is requested and check for blank line
  • 15. Request Code Read characters char c = client.read(); If newline and last character was newline if (c == 'n' && blankline) { ... } if (c == 'n') { blankline = true; }
  • 16. HTTP Response Send back status line "HTTP/1.1 200 OK" Send back content type "Content-Type: text/ html" Send blank line Send (HTML) content
  • 17. Response Code Send status and content type client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println(); Send content for (int i =0; i < nolines; i++) { client.println(content[i]); }
  • 18. Close Connections Clear up after you client.flush(); client.stop();
  • 19. Arduiono Web Server Demo Aruino IDE Web browser