Intro:
I build this project mainly out of my need to watch videos on multiple devices. I use to see few lectures on my Home Laptop , Some on my Tab and very few on my mobile ,hence i maintain a copy of videos on all these devices and believe me it is a hectic
I can run a webserver on my laptop but that would be too much waste of Energy and this is where I found My Minized Board as the Work & Power Saver .
For Implementing a Webserver on minized i need to run Application which handles TCP/IP and Application Layer in OSI model, moreover i need to connect to the Network through on board Murata 1DX WiFi module.
I searched all the Maruta 1DX documentation to interact with WiFi module through SDIO but I was out of luck as they have not provided any documentation regarding the Data Commands i need to send to access it but they provide only software Support to Linux by means of Yocto Recipies.
So i made up my mind that in order to use WiFi , i need to go with PetaLinux rather than Craming my Head !
To my Good Luck i found Avnet Provides a Speedway Training for Integrating Sensors on MiniZed with PetaLinux (2017.1 and 2017.4) .
I followed that Course and it is very helpful one
What Our Application Do:
Our Minized Board Run a webserver and we will be using Linux Image with Python Integration so that we can do server side programing using Python.
We Used the Python Server to handle those Requests regarding Setting the Led Color and Interacting with Sensors,so all these can be done from our web browser Iself.
Coming to Hosting the Video Files for Streaming onto my Devices , Instead of using onboard emmc , I Built it such that it renders videos stored on thumb drive.There few reason for that Option:
1.)I got my old pendrive sitting Idle in my Self
2.)It is easy to copy files into the Thumb Drive
3.)I can Use Larger Capacity Pendrives (16gb,32gb ) or Portable Hard disks that support ext or fat filesystem
4.)I am conservative regarding not to exhaust Read/Write Cycles of Flash based eMMC
5.)I don't want to see the USB host port empty
So I load the Required Video files onto the Pendrive and my Minized Board Automatically Generate Webpages and Uses them to stream those files and Control the Sensors (I just Included the Led Control )!
How to Implement it:
For Simplicity , I break it into a 3 Step Process
I have Uploaded the Required files as Minized_WebServer.zip : https://drive.google.com/open?id=14jOCErAT-KVfMHQ_vDgM2Hnb9hd61fGY
It Contains Directory Structure as shown below:
Step 1.) Loading the PetaLinux on Minized:
Here We Need to:
->Flash the QSPI with "flash_fallback_7007S.bin" file using SDK or XSCT (by Setting Boot Switch to "J" side - JTAG mode)
->Copy the "image.ub" onto the emmc
Just follow the Avnet Document for running "Python Web Server on MiniZed" attached here , if you like you can find that Project Application Here
Step 2.) Loading Website files & Videos to Host on our Minized Webserver :
-> Just Copy the Directory "webserver" onto your Pen Drive(You can also store other folder that don't cause any problem for us !)
-> Copy the Videos from PC into videos directory , its Path = "{Pen_Drive_Name}/webserver/files/videos/"
Note: Our Application Automatically Generates videos.html page only for Videos Copied into that above mentioned Directory only
Step 3.) Running the Web Server :
->Plug the Pendrive into USB host Port of minized
->Connect the USB-JTAG cable to PC and AUX USB Cable to PC/Charger for Powering our USB
Note:the Startup code automatically mounts the Pendrive onto '/mnt/usb' , if you plug the Pendrive later then Simply Press Reset / Mount the USB to that Location
->Run the Serial Terminal on PC (115200/8 bit Data / 1 Stop /No Parity)
->Login to PetaLinux with "root" as both Username & Password
->then Run this Simple Line to Start the Bash Script which automates everything and Displays the IP address of the Website (Server)
/mnt/usb/webserver/start_server.sh
The Website IP adress is same as the IP adress of Minized , it is Displayed as shown Below:
That's It , Our Webserver is Running.
Just Open the Server IP address or Minized IP adress on Browser,It Should Look like this :
-> Press the Menu Page(Top Right Corner) and Navigae to Videos page where we can See our Hosted Videos:
->Navigate to Sensors Page where we input our Server to Turn ON/OFF Leds:
Demo - Working of Minized Web Server:
Bingo ! We got a Powerful Webserver Running Videos hosted on USB Thumb drive !