Pages: [1]   Go Down
Author Topic: Ethernet shield: setting MAC/IP from outside  (Read 552 times)
0 Members and 1 Guest are viewing this topic.
The Netherlands
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As you might know the Ethernet shield comes without a MAC address. You start the Ethernet library with furnishing your own MAC and it's your responsibility to make sure that this MAC address is unique in your network.

Unfortunately if you have more than one Arduino in your network, this means that you need to make a dedicated sketch. Or I should say: you need to alter your sketch for every upload.

I am looking for a way to make this configurable from the outside. The first idea would be to use some pins and hardwire those to +5v or GND creating an binary 'address' for the last byte of the MAC and IP. This would be possible if one had enough pins.

However my current project involves an Ethernet shield (which is not that strange given the question) using pins 10 through 13. Then an LCD is mounted that uses pin 4 through 9 and analog 0. My application uses pin 3 and analog 1 through 5. Leaving only pin 2 (as 0 and 1 are RX/TX and it is not a good idea to hardwire those) which gives not much configuration power...

Are there any thoughts on other options? Are there pins I am forgetting? Is there a technique I am forgetting? Please not that anything that does something with randomisation is not an option (as it would neither guarantee uniqueness nor make it manageble). And while on the subject... why does the Wiznet chip not carry it's own MAC? Would make live so much simpler...
Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could store the mac address in EEPROM.  The address can be set  from  the serial port, and once set, your setup code could check that a valid mac address was available and use it to init the Ethernet library.
« Last Edit: November 29, 2009, 09:35:00 am by mem » Logged

The Netherlands
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That is an interesting thought... what I did not yet mention is that the setting of the address must be quite simple, so I can let field engineers do it. Creating some sort of dialog via the Serial would be feasible I'd say. Thanks. Open to other options of course, so enlighten me!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 29
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Could you do it like a wireless router setup, where there's a default MAC and IP, you connect to that IP via a web browser, where you edit the values in a form, and then those values get saved to EEPROM and take effect when you reset?
Logged

0
Offline Offline
Faraday Member
**
Karma: 7
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

+1 for EEPROM.

You could also add a small I2C flash IC, and store the MAC address (and IP, default router, etc, etc) there.  Make it a DIP package and the node's identity would be in the flash chip, which could be programmed separately.

-j
Logged

The Netherlands
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are the I2C pins not hardwired to other pins (digital/analog)?
Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the i2c pins are available when using the Ethernet shield. They are analog pins 4 and 5 (digital pins 18 and 19)
« Last Edit: December 02, 2009, 06:01:16 am by mem » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could use a analogue Pin and fit a pd, and by changing the resistor values you would get a new ADC value which could be used to change a section of the mac/ip address. This is a hard wire option if that helps?

I would only read it once at startup, as you dont want voltage changes to affect the operation!

Pete
Logged

Pages: [1]   Go Up
Jump to: