arduino 项目的唯一机器 ID [英] Unique machine ID for arduino project

查看:36
本文介绍了arduino 项目的唯一机器 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 arduino 构建一些远程传感器节点,它们将使用 RF 将数据传输回基站.是否有某种独特的 id 支持到 arduino 中,我可以使用它来识别基站的远程 arduino 传感器节点?如果不是,其他人是如何解决这个问题的?

I am building some remote sensor nodes for arduino, they will use RF to transmit data back to a base station. Is there some sort of unique id backed into arduino that I can use to identify the remote arduino sensor node to the base station? If not, how do others solve this issue?

我意识到我可以在编译该节点的源代码时对 nodeid 进行硬编码,但这似乎无法很好地扩展.我需要的是类似于 http 域中的 mac 地址.

I realize that I could hard code a nodeid when I compile the source for that node, just seems like that would not scale too well. What I need is something analogous to a mac address in http land.

推荐答案

(抱歉英语不好,我是德国人)据我所知,Arduino 没有唯一的产品 ID,但在重置后,RAM 中的每个字节都有一个随机值,该值在每个 arduino 上都不同.这个程序应该在每个 arduino 上输出不同的值.:

(sorry for bad english, I'm German) As far as I know, the Arduino does not have an unique product ID, but after a reset every byte in the RAM has a random value which is different on every arduino. This program should output a different value on every arduino.:

void setup()
{
  uint32_t checksum = 0;
  for(uint16_t u = 0; u < 2048; u++)
  {
    checksum += * ( (byte *) u );//checksum += the byte number u in the ram
  }
  Serial.begin(115200);
  Serial.println(checksum , HEX);
}
void loop()
{
}

更新:你可以在 eeprom 上写一个数字一次 -> 你有你的唯一 ID

UPDATE: You could just write a number on the eeprom once -> You have your unique ID

这篇关于arduino 项目的唯一机器 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆