Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Ethernet based monitoring and control

Status
Not open for further replies.

haxan

New Member
Hi everyone. I want to add an Ethernet webbased interface to my relay control module.

My PIC18F4480 contains information regarding the relays connected to it (which ones are on and off).

I want to add another controller maybe like PIC18F97J60 (with ethernet) to make the information on PIC18F4480 viewable and controllable on the web interface. I have seen web seminars on TCP/IP stack distribution from microchip which do such stuff. However i want to keep the code simple as possible. Please has anyone worked on PIC ethernet based MCU's, please guide me how to get started.

Is it necessary to get the PICDEM.net 2 board first or can i start without it aswell?
 
Last edited:

DirtyLude

Well-Known Member
If you are having trouble with the software stacks, you might want to try the Wiznet chips like W5100. Built in MAC/PHY plus the IP Stack is implemented on the chip already. You can do TCP/UDP like an HTTP server with just a state machine in software.
 

haxan

New Member
thanks DirtyLude, will these chips be able to store webpage ?

Also its a complete different MCU. I will need to learn its coding language again :(

I am already very new to PIC and was trying to grip PIC18 using C18 compiler.
Earlier i wrote a RS-485 based communication library, that wont work with this Chip since its only made for PIC18 series.
In my case, i have several controllers on RS-485 Data BUS and the master communicates with all of them. I wanted to make the master be able to show the status of all the controllers using ethernet webpage and then finally make them go on the internet.

Have you worked on these W5100 chips?
 
Last edited:

stevech

New Member
thanks DirtyLude, will these chips be able to store webpage ?

Also its a complete different MCU. I will need to learn its coding language again :(

I am already very new to PIC and was trying to grip PIC18 using C18 compiler.
Earlier i wrote a RS-485 based communication library, that wont work with this Chip since its only made for PIC18 series.
In my case, i have several controllers on RS-485 Data BUS and the master communicates with all of them. I wanted to make the master be able to show the status of all the controllers using ethernet webpage and then finally make them go on the internet.

Have you worked on these W5100 chips?

Yes, I use the Wiz812MJ module. Don't start with a chip. I have a huge amount of code for the '812MJ. But it's for Atmel AVR and for NXP ARM. I "graduated" from PICs long ago and never use them now. Free and better software for these other microprocessors. But some naively love the PICs.

The '812MJ makes it all quite easy.
 
Last edited:

haxan

New Member
There is not enough help for '812MJ using google. It gives results for Miachel Jackson.

The good thing about PIC is its help from others. (consider this forum). Also easy availability from local markets.

anyways i am not here to talk about PIC. I am just saying that i have a complete communication system made which has several PIC's on the Data BUS. Also the Master controller for the Data BUS is PIC18. So making the Master be able to communicate with Ethernet would be really helpful so that i don't have to design everything again.

You can check that microchip provides ethernet solutions on their website aswell, Online Registration Redirect

my only problem is that i dont know how to start with that.
 

stevech

New Member
There is not enough help for '812MJ using google. It gives results for Miachel Jackson.

The good thing about PIC is its help from others. (consider this forum). Also easy availability from local markets.

anyways i am not here to talk about PIC. I am just saying that i have a complete communication system made which has several PIC's on the Data BUS. Also the Master controller for the Data BUS is PIC18. So making the Master be able to communicate with Ethernet would be really helpful so that i don't have to design everything again.

You can check that microchip provides ethernet solutions on their website aswell, Online Registration Redirect

my only problem is that i dont know how to start with that.

Have you ever spent a bit of time reading avrfreaks.net forum? Great help there, and like PIC, a zillion sample projects. And the Arduino hardware using AVR.

Wiz812MJ is quite popular. Circuit Cellar magazine has had several articles on its use. google Wiz812MJ. The SPI interface makes it easy.

WIZ812MJ Ethernet SPI/Bus Module (RJ45) 2.54mm Pitch ($19.50) : Saelig Online Store
 

haxan

New Member
Thank you stevech for the AVR details. the website avrfreaks is really awesome. I will certainly move from PIC once this small project is completed :)

3v0, i saw that the wiznet has SPI interface. Will it be possible to send/receive data from PIC18 and Wiz. Also where will the webpage be stored?
Will i need a programmer for WIZ or it can be done via SPI?
 

DirtyLude

Well-Known Member
The Wiznet W5100 IS NOT a different microcontroller. It is an interface chip like the ENC28J60, but it has the IP stack on chip. You communicate with it over SPI. Even though I say it's easier than using one of the software stacks, it's still fairly advanced programming to implement a HTTP server.

::WIZnet::
**broken link removed**

I have the WIZ812MJ I originally used for testing.

I've used both the W5100 and W5300 in designs. The W5100 chip is tough to work with physically, because it has 0.4mm lead spacing.
 

3v0

Coop Build Coordinator
Forum Supporter
@hexan

You have done good work on the RS485 network.

But given you aversion to documentation and possibly complexity I think you will find the ethernet connection much worse the CRC and CAN.

My suggestion is that you use RS232 over USB to talk to the PC.

3v0
 

haxan

New Member
I have gathered some info on Ethernet embedded controllers from Microchip such as PIC18F97J60 (these have ethernet chip/module built right into it).

Here is my first code:
#define THIS_IS_STACK_APPLICATION
#include "TCPIP Stack/TCPIP.h"
#include "TCPIP Stack/StackTsk.h"
#include "TCPIP Stack/Tick.h"
#include "TCPIP Stack/dhcp.h" // Only if DHCP is used.
#include "TCPIP Stack/http.h" // Only if HTTP is used.
APP_CONFIG AppConfig;
BYTE AN0String[8];

void My_Logic(void); // My Logic in the system

void main(void)
{
TickInit();
StackInit();
HTTPInit(); // Only if HTTP is used.

while(1)
{
TickUpdate(); // Update tick count. Can be done via interrupt.
StackTask(); // Let Stack Manager perform its task.
HTTPServer(); // Only if HTTP is used.
My_Logic();
}
}

void My_Logic(void)
{
TCPPutROMString(sktHTTP, (ROM BYTE*)"Welcome to my Ethernet based system!");
}


This code compiles okay. To test this i have to order the PICDem2 .net board which might take sometime to come.
In mean while, i have another issue.

First is construction of the Ethernet Transformer. I have the circuit but most of the components are pretty weird.

Second. This ethernet module for PIC18 works only if clock is 25MHz or more where as rest of my system if built on 4MHz clocks. Is there anyway to fix the communication issues which will arise other than to change all the delays etc?
Something like prescaler applied to the PIC having the ethernet module?
 

haxan

New Member
okay now i have seen the web browser based communication with Proteus simulation.

The problem is that the uses RTL8019AS. Now i know that implementing the schematic in PCB will cause a lot of problem with all the transformer and filters for twisted pair and Mag jack 45 it would be too much of a hassle.

I am going to order a few Wiz812MJ. I have read their data sheets, however i couldnt find their firmware in C which i could call in and use with my controller. Can anyone provide me the direct link there?

I want to interface it with PIC18F452, is this controller up for the job?

And when we upload the webpage source (bin) file, where does it actually go (EEPROM, ROM) ?
 

DirtyLude

Well-Known Member
But given you aversion to documentation and possibly complexity I think you will find the ethernet connection much worse the CRC and CAN.

My suggestion is that you use RS232 over USB to talk to the PC.

I'm going to go with this. Given your questions I'm going to say give it up for now. It sounds like your running before walking.

There is a sample AVR program Wiznet provides that's for an AVR. It's under the W5100 chip / downloads. It is pretty complicated, though. Really, overly complicated. There's a Circuit Cellar article out there that has some PIC code. It's much simpler, but it's also not very good, and it's for simple UDP messaging.
 

haxan

New Member
I have built the circuit on Proteus ISIS using PIC18F4620 and ENC28J60.

I took help from schematic provided at http://www.ljcv.net/library/sc/pic10t-2.0.pdf

However when i use the TCP/IP stack provided at Microchip TCP/IP Stack v3.75 Modified Version for PIC10T, i dont get any anything on LCD nor does the ethernet module (ENC28J60) picks up any IP from DHCP. I have tried without DHCP and it still doesnt show anything on the Virtual terminal.

I have also tried changing the configuration by using Button 0 but still nothing.

Can anyone guide me what i can be doing wrong or why is the LCD displaying nothing and also why is the ENC not working.

I have attached the image of schematic i made.
 

Attachments

  • Capture.JPG
    Capture.JPG
    248.1 KB · Views: 2,251

haxan

New Member
It took me a week or maybe a little more but i have done what i wanted. YEEEEE!! :D

I can now control my hardware (turn off lights (LEDS) and read/write data on to my microcontroller board through ethernet and also internet.

My webpage for this control and monitoring feature is AJAX based with JSON so data can be directly evaled with javascript sent from C.

Thank you all for your support and suggestions. Couldn't have started without you guys.

I must say, microchip's TCP/IP stack version 5.20 is really easy to use.
I have used Explorer 16 board to interface ethernet with my controllers data bus using RS-485.
 

stevech

New Member
I have gathered some info on Ethernet embedded controllers from Microchip such as PIC18F97J60 (these have ethernet chip/module built right into it).

Here is my first code:



This code compiles okay. To test this i have to order the PICDem2 .net board which might take sometime to come.
In mean while, i have another issue.

First is construction of the Ethernet Transformer. I have the circuit but most of the components are pretty weird.

Second. This ethernet module for PIC18 works only if clock is 25MHz or more where as rest of my system if built on 4MHz clocks. Is there anyway to fix the communication issues which will arise other than to change all the delays etc?
Something like prescaler applied to the PIC having the ethernet module?

All that agony, and more, is why I the WizNet 812MJ is so much easier.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Top