Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

[SOLVED] Sending data from pic microcontroller to web server using ethernet.....

jit_singh_tara

Full Member level 6
Joined
Dec 22, 2006
Messages
328
Helped
9
Reputation
18
Reaction score
4
Trophy points
1,298
Location
Delhi , India
Activity points
4,299
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...
 

std_match

Advanced Member level 4
Joined
Jul 9, 2010
Messages
1,083
Helped
408
Reputation
816
Reaction score
404
Trophy points
1,363
Location
Sweden
Activity points
8,260
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.
 

jit_singh_tara

Full Member level 6
Joined
Dec 22, 2006
Messages
328
Helped
9
Reputation
18
Reaction score
4
Trophy points
1,298
Location
Delhi , India
Activity points
4,299
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.
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
46,761
Helped
13,880
Reputation
28,008
Reaction score
12,519
Trophy points
1,393
Location
Bochum, Germany
Activity points
272,910
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.
 

eziggurat

Full Member level 6
Joined
Feb 15, 2002
Messages
322
Helped
30
Reputation
62
Reaction score
18
Trophy points
1,298
Activity points
2,915
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.
 

jit_singh_tara

Full Member level 6
Joined
Dec 22, 2006
Messages
328
Helped
9
Reputation
18
Reaction score
4
Trophy points
1,298
Location
Delhi , India
Activity points
4,299
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.
 

eziggurat

Full Member level 6
Joined
Feb 15, 2002
Messages
322
Helped
30
Reputation
62
Reaction score
18
Trophy points
1,298
Activity points
2,915
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.
 

Toggle Sidebar

Part and Inventory Search


Welcome to EDABoard.com

Sponsor

Sponsor

Design Fast


×
Top