What's the best way to differentiate between two custom ESP32 boards?
What's the best way to differentiate between two custom ESP32 boards?
I have two, and maybe more in the future, separate ESP32 custom boards. They are very similar except one is a little newer and has a buzzer attached to one pin via a transistor, and the older one does not. I want to run pretty much the same code on both, but I need to know which board it is. It is difficult to check for the existence of the buzzer/transistor, but it is probably possible. However, I was hoping I could read some sort of single byte ROM or something similar, where I could read a number between 1-255 or 1-65536 (2 bytes). Maybe this is something that is accessible on the I2C bus? Once I read that number then I could differentiate the two boards and run the program differently. I can even use it to decide which new firmware is appropriate for the board (although right now the similarity between the boards makes it less useful to have two entirely different firmware).
If I had some unused GPIO pins, I could force some to Vcc and some to GND in order to make a simple binary number. That's not very elegant.
I figure that this must be something that has been solved elegantly already.
Thank you for your help.
If I had some unused GPIO pins, I could force some to Vcc and some to GND in order to make a simple binary number. That's not very elegant.
I figure that this must be something that has been solved elegantly already.
Thank you for your help.
-
- Posts: 94
- Joined: Tue Sep 07, 2021 12:07 pm
Re: What's the best way to differentiate between two custom ESP32 boards?
Similar discussion https://maker.pro/forums/threads/serial ... ace.32369/ suggested https://www.allaboutcircuits.com/electr ... ntegrated/
which looks like a $3 serial number.
But if I had several available input pins, I'd use them as an N-bit code and build them into the board design.
which looks like a $3 serial number.
But if I had several available input pins, I'd use them as an N-bit code and build them into the board design.
Craige
Re: What's the best way to differentiate between two custom ESP32 boards?
Thank you. A one to two dollars a chip is a hefty price to pay for this.
Especially when I am paying $1.50 for the ESP32.
I’ll see if I can free up some GPIO for this.
Especially when I am paying $1.50 for the ESP32.
I’ll see if I can free up some GPIO for this.
Re: What's the best way to differentiate between two custom ESP32 boards?
If you have a point where you know by external means which board it is, you can set a fuse with that ID and then refer to it later. Perhaps a device unique factory app and then you update to a common app via OTA.
Re: What's the best way to differentiate between two custom ESP32 boards?
Some option may be to use efuses.
https://docs.espressif.com/projects/esp ... efuse.html
and here is practical use case i think:
https://esp32.com/viewtopic.php?t=11556&start=10
In my opinion good way to test it is with virtual efuse:
https://docs.espressif.com/projects/esp ... ual-efuses
https://github.com/espressif/esp-idf/tr ... stem/efuse
https://docs.espressif.com/projects/esp ... efuse.html
and here is practical use case i think:
https://esp32.com/viewtopic.php?t=11556&start=10
In my opinion good way to test it is with virtual efuse:
https://docs.espressif.com/projects/esp ... ual-efuses
https://github.com/espressif/esp-idf/tr ... stem/efuse
Re: What's the best way to differentiate between two custom ESP32 boards?
That's a good idea. Maybe when I test the assembled devices, I can also set the FUSE!
Re: What's the best way to differentiate between two custom ESP32 boards?
You already do. Presumably you have a pull up or pull down on the base of the transistor. You could then just read the pin state of that GPIO pin to the transistor, and it will be high or low.They are very similar except one is a little newer and has a buzzer attached to one pin via a transistor, and the older one does not.
If I had some unused GPIO pins, I could force some to Vcc and some to GND in order to make a simple binary number.
Re: What's the best way to differentiate between two custom ESP32 boards?
Great idea. Will try it.You already do. Presumably you have a pull up or pull down on the base of the transistor. You could then just read the pin state of that GPIO pin to the transistor, and it will be high or low.
Re: What's the best way to differentiate between two custom ESP32 boards?
Maybe I didn't understand something, but why can't you just compare mac addresses? they seem to be unique, more or less.
#include <WiFi.h>
Serial.println(WiFi.macAddress());
#include <WiFi.h>
Serial.println(WiFi.macAddress());
-
- Posts: 94
- Joined: Tue Sep 07, 2021 12:07 pm
Re: What's the best way to differentiate between two custom ESP32 boards?
That could work well if there are only a handful of V1 boards and the CPUs can't be easily swapped and all the V1 mac addresses were recorded or still available. This will typically be the case for me. But keeping a list of more than 5 or so mac addresses in the code starts to be a problem, and if there is a v2 and a v3 it starts to seem like a better solution is needed. If the board can identify the rev number to the CPU seems perfect, especially if planned from V1.
Craige
Who is online
Users browsing this forum: top_secret_guy and 23 guests