Identificator of Spider card

Hi all,

Can you give me a nice solution for the problem below, please ?

At present, I’m working with 3 spider cards, each card has a special functionality, but they have the same sensor equipments: every 30s, these cards will make reading and sending the sensor values to the server via webservice.

I have one question, how to get the identificator of these card in order to differentiate the values of 3 identique sensors wired on 3 different spider cards ?

At this moment, I have manually created an identificator for them, but it’s not a “pro” solution if we work with 50 or 100 cards.

Best regards,

hv

Do you mean something like a serial no?
You could use EWR (ExtendenWeakReference) to write some data directly to the module Flash.
But this data will be deleted, every time you reflash the firmware.
You could add a SD card or Flash module, and store the data there, by this it’s persistent for sure.

How does your “manually created idetificator” look like?

1 Like

Maybe the serial number can solve my problem, but how to get it by means of .NETMF?

[em]“You could use EWR (ExtendenWeakReference) to write some data directly to the module Flash”[/em] It is clearly better than my method, and I should take attention it after flashing the firmware. But it is not yet a expected “pro” solution. (srry for my exigency !)

In fact, my method for creating manually indentificator is to use the xml file stored in SD card, one xml file for each spider card.

A special method is used for listing insert_SD card event in order to read and save this Id in memory card. But it is not a generic solution because of clumsy user or developer error.

Thanks a lot for your answer.

hv

[quote=“hoavinh”]
Maybe the serial number can solve my problem, but how to get it by means of .NETMF? [/quote]

I meant you could generate a serial number on your own, and store it in EWR, Flash module or SD card.

Thanks again your rapid response.
Is there a gadgeteer module by which i can get an identificator or serie number or anthor things ? for example, can ethernet_J11D provide a MAC address ?

BR,
hv

Another option is to use the device its MAC address…

update. EMX holds an unique mac address itself

Thanks for your suggestion. I just check NetworkInterface of this module, but what method can I get it by programming ?

Update. Ok I will look for EMX method. But if you find where is the method for it, can you give me please ?

BR,
hv

see the NetworkInterface Class in assembly Microsoft.SPOT.Net
this class holds a propery called PhysicalAddress

Thanks a lot. Using ExtendenWeakReference is a better solution at the moment (thanks Reinhard OstermeierHero for it), i think. If someone can propose another solution, i’m really interested.

@ andre.m - I thought that each EMX has a unique address.

@ andre.m - I guess GHI can tell :wink:

The spider dose have a unique MAC…
If you are not sure… you can use the code below to generate a unique code per card… no need for extended memory …

https://www.ghielectronics.com/community/codeshare/entry/822

1 Like

you have lots of pins available. use a few to assign a hardware ID. you can use a dip switch.

Hi @ JayJay,

Thanks a lot your code. I have just one question, perhaps I don’t understand your code yet.
In the function,


GenerateUniqueMacAddr(object myUniqueId = null), 

you said that the string “myUniqueId must to be UNIQUE” and "This would be great if only each board had a UNIQUE SERIAL NUmber ahhhhhh… ". This word UNIQUE means the “UNIQUE SERIAL NUmber” of each board ( if that’s right … i think i’m turning in round… ) ? In the case of “myUniqueId = null”,


var r = new Random();
r.NextBytes(myMac);

could you please give me a double check that your code could generate unique (different) MAC addresses for 100 boards ?

BR,
hv

Hi Mike,

Can you make more clear please ? What is “dip switch”, sorry for my bad knowledge.

Those are DIP switches, but you can’t use THOSE dip switches to set a unique ID; they are however representative of what dip switches look like.

But now you’re clarifying that there’s ~100 devices, so you’ll need a bank of 7 switches (7-bit address giving 128 possible combinations).

1 Like

Why not using One Wire DS2401?

The spider has a unique Mac address each EMX module comes with a sticker that shows the unique Mac address…

As for the cerb family board they all have a unique serial number in the processor.

you can also apply and buy a block of Mac addresses specific to your company… not sure about the minimum number of boards allowed…

Another thing you can try is create your unique string based on the combination of date and time…

Then start each board at different times for example one or few seconds apart, which will create a unique string that you would store in the extended weak memory…

Using my code with the above will guarantee you a unique string per board… using the same code

Thanks a lot,
I think that I’m in possession of several good solutions now for my problem.

Thanks again.
hv

@ andre.m -

I like to use dedicated devices for specific function…

The Maxim DS2401 is very easy to use, just a single wire for data and power. It consummes about… nothing and the library is included with .netmf.

Just enumarate the devices on the bus you will get the (unique) ID of the DS2401.

1 Like