+ Post New Thread
Results 1 to 7 of 7
  1. #1
    Full Member level 6
    Points: 4,037, Level: 14

    Join Date
    Dec 2006
    Location
    Delhi , India
    Posts
    328
    Helped
    10 / 10
    Points
    4,037
    Level
    14

    Sending data from pic microcontroller to web server using ethernet.....

    Hello Friends , i have to design a system where i need to send data ( some voltages , status of some pins of mcu) via ethernet using ENC28J60 to a web hosting server's database table .

    DATA -> ETHERNET(ENC28J60) -> WEB HOSTING SERVER ->MYSQL DATABASE -> TABLE .

    The data needs to be saved on the server on database file , so that it could be accessed from any where on the internet.

    I will be accessing a php based file on address bar which will access the table of the database and return the result in form of html file in tabular form....

    Please suggest what will be the best approach .....

    The medium has to be ETHERNET only internet connection.
    and the Microcontroller has to be a PIC only , no arduino!

    So basically i need to remote monitor a hardware i/p and some data , which i could access from anywhere.....


    Since i will be communication with a server , then do i need to implement TCP/IP client server handshaking....

    I have successfully done the same using GPRS via GSM MODEM using AT+HTTP get request.But in this current application i intend to use ETHERNET ONLY.


    Please guide...

    •   AltAdvertisement

        
       

  2. #2
    Advanced Member level 4
    Points: 7,598, Level: 20
    Achievements:
    7 years registered

    Join Date
    Jul 2010
    Location
    Sweden
    Posts
    1,019
    Helped
    387 / 387
    Points
    7,598
    Level
    20

    Re: Sending data from pic microcontroller to web server using ethernet.....

    What PIC processor? Forget TCP on a small one. Use UDP to communicate with a "helper" software on some server, that can access the web/php page.
    It helps if you can hardcode the MAC address of the gateway on the local subnet, otherwise you must implement ARP.


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  3. #3
    Full Member level 6
    Points: 4,037, Level: 14

    Join Date
    Dec 2006
    Location
    Delhi , India
    Posts
    328
    Helped
    10 / 10
    Points
    4,037
    Level
    14

    Re: Sending data from pic microcontroller to web server using ethernet.....

    Quote Originally Posted by std_match View Post
    What PIC processor? Forget TCP on a small one. Use UDP to communicate with a "helper" software on some server, that can access the web/php page.
    It helps if you can hardcode the MAC address of the gateway on the local subnet, otherwise you must implement ARP.
    Thx dear ,
    Since I m not much familiar with Networking ,I will share my hardware setup detail with you.Can you please suggest what is the best approach.
    MCU ---> enc28j60 --> lan cable ----> router---->server---->data to be stored on mysql database table.

    My concern is by using which protocol the connection can be easily established with the server , I need to read the response from the server also.
    Can i implement something like sending data using http get request , after establishing network connection.
    Please suggest suitable procedure .

    I want to use pic18 series microcontroller.



    •   AltAdvertisement

        
       

  4. #4
    Super Moderator
    Points: 261,903, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    45,774
    Helped
    13912 / 13912
    Points
    261,903
    Level
    100

    Re: Sending data from pic microcontroller to web server using ethernet.....

    PIC18 isn't very effective for ethernet implementation, but feasible. Examples are available from microchip.
    You get less software overhead by using a Wiznet ethernet controller with hardware protocol layer.

    The other part of your question is purely software related: How to communicate with data server? There are many options, depending on the interface exposed by the server. It can use http interface but also send SQL commands to a shell.


    1 members found this post helpful.

  5. #5
    Full Member level 6
    Points: 4,745, Level: 16

    Join Date
    Feb 2002
    Posts
    321
    Helped
    30 / 30
    Points
    4,745
    Level
    16

    Re: Sending data from pic microcontroller to web server using ethernet.....

    Just create a CRUD REST api. I just type in google "php rest api" and it list heaps of examples for creating CRUD REST api. In your embedded platform, you just need to setup a HTTP client and use POST, PUT, GET and DELETE to modify your database. You should probably secure your API. Just type in google SSL, API keys with PHP, and the same for PIC.



  6. #6
    Full Member level 6
    Points: 4,037, Level: 14

    Join Date
    Dec 2006
    Location
    Delhi , India
    Posts
    328
    Helped
    10 / 10
    Points
    4,037
    Level
    14

    Re: Sending data from pic microcontroller to web server using ethernet.....

    Quote Originally Posted by FvM View Post
    PIC18 isn't very effective for ethernet implementation, but feasible. Examples are available from microchip.
    You get less software overhead by using a Wiznet ethernet controller with hardware protocol layer.

    The other part of your question is purely software related: How to communicate with data server? There are many options, depending on the interface exposed by the server. It can use http interface but also send SQL commands to a shell.
    Thanks FVm , I tried to implement the application using arduino uno and Wiznet ethernet shield.It ran successfully.

    But my concern is to run the same using pic microcontroller and wiznet w5500 chip instead of arduino shield.Reason :

    1. I dont want to depend on arduino uno or mega board or ethernet shield for the same because in case of final product going faulty in field I have to replace the entire board which are quite expensive.

    I want to make it cheap so willing to use any suitable pic microcontroller along with wiznet w5500 chip.I want to know any libraries from microchip of mikroe available to implement what arduino did in so easy way.
    Any ready to use example with pic to implement web client.



    •   AltAdvertisement

        
       

  7. #7
    Full Member level 6
    Points: 4,745, Level: 16

    Join Date
    Feb 2002
    Posts
    321
    Helped
    30 / 30
    Points
    4,745
    Level
    16

    Re: Sending data from pic microcontroller to web server using ethernet.....

    If you are going use a PIC, I recall in the past Microchip had a stack for the PIC24. Alternatively you should look at lwip and check what PICs they have targeted or examples. This will give you an idea of the flash size for your PIC.



--[[ ]]--