iot - embed to http.pptx [sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo...
TRANSCRIPT
![Page 1: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/1.jpg)
Internet of Things!Internet of Things!Discuss with your board
![Page 2: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/2.jpg)
How many languages in IOT?How many languages in IOT?
![Page 3: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/3.jpg)
The web discuss in HTTP (typically)The web discuss in HTTP (typically)
![Page 4: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/4.jpg)
and my board?and my board?
![Page 5: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/5.jpg)
HTTPMQTT
LWM2MCOAP
UDP/IPTCP/IP
![Page 6: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/6.jpg)
The HTTP nature
Not connected
Client/ServerClient/Server
String based
![Page 7: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/7.jpg)
![Page 8: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/8.jpg)
Formats, parsers and low resources
We have just 2k bytes of RAM...
Ok, we have to proxy all things...
We also have to drink a couple of beers...
Beeeeeerrrr!!!
![Page 9: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/9.jpg)
Board is connected directly using TCP/IP
● Connected protocol (we can discuss about this)
● New application support (we have to design it)
● New application formats (we have to design it)● New application formats (we have to design it)
● No error management (we have to design it)
● No re-connect on failures (we have to design it)
![Page 10: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/10.jpg)
Users uses HTTP resources
● Resources basedo GET http://domain.tld/a-path
● Existing applicationso Browsers, Api clients etc...
● Existing formatso HTML, JSON, XML etc...
● Response code (eg. error management)o 4xx Client errorso 5xx Server errors
![Page 11: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/11.jpg)
How the board is connected to users
![Page 12: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/12.jpg)
Not Connected → Connected
BoardProxy
Connected TCP/IPSTREAM
User 1
BoardProxy
User 2
Other cloud services
![Page 13: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/13.jpg)
How the proxy works
TCP/IP Module
Golang ChannelHTTPServer
s.writeChannel <- data[0]
ON/OFF LED
ModuleGolang Channel
Serverdata = <-s.writeChannel
![Page 14: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/14.jpg)
The flip-side of the discussionThe flip-side of the discussion
![Page 15: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/15.jpg)
The proxy cannot contact users at anytimeusers at anytime
![Page 16: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/16.jpg)
How the board is connected to users
![Page 17: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/17.jpg)
HTTP Client/Server model can be a problem!
● Unable to discuss with users at anytime…o Cannot shows any board figure (any nature)
● How to add the missing method?o HTTP Pollingo HTTP Long Pollingo HTTP Chunked responseso Web Sockets
● Change the application layer?o MQTT - Telemetry Transport
![Page 18: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/18.jpg)
Just grab the server code! Golang!func main() {
router := mux.NewRouter()
server := proxy.Server{
Router: router,
HttpServer: &http.Server{
Addr: "0.0.0.0:8082",
Handler: router,
},},
BoardServer: &board.Server{
Addr: "0.0.0.0:9005",
},
}
server.ListenAndServe()
}
https://github.com/wdalmut/iot-http-to-low-level
![Page 19: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/19.jpg)
Embedded Side
● Now the server side is up and running● I’ve still to solve the embedded side
problem…Excuse me Sir,
● How to Continue???o First I have to choose a platformo Then I have to choose a development
environment
Excuse me Sir, what do you mean Platform???
![Page 20: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/20.jpg)
Which Platform?
● The Platform, in this case, is the electronic object that will embed our application
● IoT = Internet Of Things● In many cases “Small Things”...● In many cases “Small Things”...● Not much space… we have to make it as small as
possible
● Use a Microcontroller
![Page 21: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/21.jpg)
What About TCP/IP Interface?
● TCP/IP is a pretty much complicated protocol● It has been developed during ‘70 by a group of
engineers
● You don’t want to do it again...
● Use a Tcp/Ip Module● Wiznet W5100
![Page 22: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/22.jpg)
HW Setup
Wiznet
Microcontroller
LEDs
![Page 23: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/23.jpg)
Looking for an Environment
● Lots of Environment for Microcontroller C code development
● Very complicated to use and understand● C language is pretty complex● C language is pretty complex
![Page 24: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/24.jpg)
Just Make It Simple...
● What about a Graphic Environment?● It will reduce the code overhead and simplify application
development :-)
● Yes, it is scalable if you use it in the right way…● Yep, it could be debugged like a text based…● Yeah, it can be simulated as well…● Sure, it could… OK, please somebody stop the
questioning engineer!!!
![Page 25: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/25.jpg)
Make it simple...and Smart
● We are going to use flowcode for the development of embedded side
● Flowcode is a Graphic Integrated Development Environment (or G-IDE)Environment (or G-IDE)
● It looks like a flowchart, but allow you to program microcontrollers FLASH memory
![Page 26: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/26.jpg)
Make it veeery simple...
Pretty Cool, Ah?
![Page 27: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/27.jpg)
Using a Component
● Inside Flowcode a lot of complex problems could be easily solved using a component
● A component is a set of API that allow you to interface a complex peripheral inside your flowchartcomplex peripheral inside your flowchart
● In Flowcode, CAN, USB, Ethernet are all components● Besides APIs, components require also an initial
configuration, in the form of, so called, “extra properties”● A component is added to a project simply
Dragging&Dropping it inside the project itself
![Page 28: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/28.jpg)
Configure Ethernet Component
GateWay Address
SubNet MaskSubNet Mask
Our Node Address
![Page 29: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/29.jpg)
TCP/IP Management 1
![Page 30: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/30.jpg)
TCP/IP Management 2
![Page 31: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/31.jpg)
And it Works!!!
Amazing!!!
Beeeerr!!!
![Page 32: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/32.jpg)
Wants only Graphics???
![Page 33: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/33.jpg)
Code References
Embedded Code:● www.francescoficili.com
Golang Server Implementation:Golang Server Implementation:● https://github.com/wdalmut/iot-http-to-low-level
Labview Server Implementation:● www.francescoficili.com
![Page 34: IOT - Embed to HTTP.pptx [Sola lettura] · %hvlghv $3,v frpsrqhqwv uhtxluh dovr dq lqlwldo FRQILJXUDWLRQ LQ WKH IRUP RI VR FDOOHG ³H[WUD SURSHUWLHV´ $ FRPSRQHQW LV DGGHG WR D SURMHFW](https://reader034.vdocuments.us/reader034/viewer/2022042302/5ecd7fb570ecc14b111189d2/html5/thumbnails/34.jpg)
Learn More
FlowCode: ● Product Website: http://www.matrixtsl.com/flowcode/● Italian Course: http://www.elettronicain.it/MyMain/corsi/
Golang:● https://golang.org/