0% found this document useful (0 votes)
3 views

UDP TCP server

The document outlines a series of experiments involving the ESP8266 and ESP32 microcontrollers for sending and receiving humidity data over UDP and TCP protocols. It includes code snippets for connecting to WiFi, sending UDP packets, and receiving data from a DHT sensor. The experiments aim to demonstrate basic UDP communication and the handling of incoming packets to extract humidity information.

Uploaded by

vedhviraat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

UDP TCP server

The document outlines a series of experiments involving the ESP8266 and ESP32 microcontrollers for sending and receiving humidity data over UDP and TCP protocols. It includes code snippets for connecting to WiFi, sending UDP packets, and receiving data from a DHT sensor. The experiments aim to demonstrate basic UDP communication and the handling of incoming packets to extract humidity information.

Uploaded by

vedhviraat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Sntujacig Clagya:

1bede

Puoqyam:
indud <ESP 8266 Wifi .h>
# indudu < Wifi Udp. h>
# ínlue BHT. h'
DHT dht (4, DHTI|); /Da en boasd pin

tenst chay ssid "BTETLEC_24GHz";


Cemst has pass Ba "Biet@ 2081ec";
Censt únt utp Pot 5319 /UDP pot to isfen en s 319

WIf:0DP udps

Surial , bujn Ci68007;


Saial -prt in (" Connuting te kfi ....");
-bigtn (6sid , pasued);
periment1
No.. . .

oeriment
Title: Le uot ODP SUwu Date:| /20 -20
Page No.: 68
on ESp8as 6 ESP32
6SP8a.66ESP 3a and spend yth humidihy
dota ta UDe dint whn HOQuobled.

ESPSA66|32 USB cab9HI11 &ense umpng

Jhi
ESP8A66

HTi1 6NAGA tit damsnstsaks hoa té implamant basc


UDP communiLatipn. ithan ESP&acs dusius

Reauisemnts:
Bouenlsad packtt sinduA applisafien en yous
1. AttpsLpackuksendis. com L
sstim - gpen SoUAte utilit, te allau
Patkut Aendus iA an
'TCR and UDP pakets..
Aendug and MuikAg sepesatu agpliatien
packt de the ESRSR66
OD
sendt a UDP pa ckt with
de th IP addaess and
ho content boand i itning.
the ESPR 266
poHt whue

B.I.E.T.
WL- CONNEGTED)
i t CnNift. statiuu O)

ailay lovo); Ifl. ...");


Sviol, println ("ornucting do
SUrial . putln ("NIfI enoctd"),
udp.bgin (udp fot);

Packets
iit pakat Sita - udo. pasePackotC;a

Aie iNcoming UDP packuk

fauuteugn thnl:0 ; o r
olata

data
Aunitity
kuridia ata bck te e
udp. bgin okat (ucp. ceitnt
sumstu1PC), uáp. umstag°
udp. end Packet C):

alay
/ de auoid utie sugonse
ay Ci000);

IRuad data a DHT sense


homdrt. suadMunidity (;
Kelua huni kity ;

Ji Ciet n t c n

ind Dity

Geieie SesPhM Peraters T

LOF

LOF

dosn yoçLonifn

He

(b) Receiving humidity on UDP client based on request to UDP server NodeMCU (ESP8266)
No.
i m e n t

oneriment
Iitle:
Date: | /20 -20
Page No.: 54

ESPSA66 and
upended aith"hiniady
UDp cdient nhn KLQLKted. B.I.E.T. -
sntujacu Ciagrant;

# inude <ESP8266 Jifi. h

DHT drt C4 ,DHTI); Da en oua pn


I Ruplace with you netooyk udentials
Censt Uhas ssíd : "BIEJ-EC-.4 qMz")
Censt has pasAUDOLd e Biet @
aoA1 ec"E;

WifiSAwel sewele0); I Uuate a ins tance en


pot go.

Suial. begin Cisa00);

iEicb tqin (ssid., pastan)


kIfih
wiment
No..
Date: | /20 -20
eniment
ite
Page No.: 65
ESPB66 ESP32
en ESPS66 ESP3a and upenl wth Aunidity
data te TCe cint ohun.
ALqied.
(empgnnts ReQuised:
ESP3Ri6sUSB able pHI IL 4nAs,
jnying
qram
ESP 32 haH istns 6 ainComing patkuta and
nds humisuty data
dumonstsatis he
dusices.

ltup Axduins IDE.


Lnstall HLQuis.ea Jibsasis

Snctude ibhaxis ún skteh

Cient onAHoms

Hardlu ient AoLsts and


Hspend to client. -B.I.E.T.
4hile ( WiEi. statu()) =WLCONNECTED)

dulayuoo);

Seria.. psintln (" CormutAd to Nif i");ANE


SNAA. btgin 0; ||Staut th sowA

vid Jep()
Wifi (ient lient - sHNeS. aNailablel); (Ckeck for itnt
Conneton
(client)

SiaL . psúntn C"Ns icnt connetea")Abikhh

4od actuat kuni aity af


I14nd the Aumidity ata
dlúent. puunt (espense), up
Cient . pút (Aumiaityl;
Wdose the conne chiem
tient, stop( )
Sosial -päint in (" (lient distornected ");
ement
No.

iment
Title:
Date: / /20 20
Page No..f6

(b) Receiving humidity on TCP client based on


requet o TCP server NodeMCU (ESPE266)

ulhully tHIatua gn ESPSA6


kSP8366/3a
vsih Aumidity data ta ICe
and uuspend1d
intwshunqLsed.
B.I.E.T.

You might also like