What's the best way to differentiate between two custom ESP32 boards?

mzincali
Posts: 46
Joined: Wed Jun 08, 2022 7:23 am

What's the best way to differentiate between two custom ESP32 boards?

Postby mzincali » Thu Sep 29, 2022 8:24 am

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.

Craige Hales
Posts: 94
Joined: Tue Sep 07, 2021 12:07 pm

Re: What's the best way to differentiate between two custom ESP32 boards?

Postby Craige Hales » Thu Sep 29, 2022 2:07 pm

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.
Craige

mzincali
Posts: 46
Joined: Wed Jun 08, 2022 7:23 am

Re: What's the best way to differentiate between two custom ESP32 boards?

Postby mzincali » Thu Sep 29, 2022 6:40 pm

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.

davidzuhn
Posts: 17
Joined: Fri Sep 20, 2019 1:50 am

Re: What's the best way to differentiate between two custom ESP32 boards?

Postby davidzuhn » Thu Sep 29, 2022 10:10 pm

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.

chegewara
Posts: 2362
Joined: Wed Jun 14, 2017 9:00 pm

Re: What's the best way to differentiate between two custom ESP32 boards?

Postby chegewara » Thu Sep 29, 2022 10:14 pm


mzincali
Posts: 46
Joined: Wed Jun 08, 2022 7:23 am

Re: What's the best way to differentiate between two custom ESP32 boards?

Postby mzincali » Fri Sep 30, 2022 8:42 am

That's a good idea. Maybe when I test the assembled devices, I can also set the FUSE!

username
Posts: 530
Joined: Thu May 03, 2018 1:18 pm

Re: What's the best way to differentiate between two custom ESP32 boards?

Postby username » Sat Oct 01, 2022 1:16 pm

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.
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.

mzincali
Posts: 46
Joined: Wed Jun 08, 2022 7:23 am

Re: What's the best way to differentiate between two custom ESP32 boards?

Postby mzincali » Wed Oct 26, 2022 5:45 pm

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.
Great idea. Will try it.

aid219
Posts: 4
Joined: Tue Oct 25, 2022 8:20 am

Re: What's the best way to differentiate between two custom ESP32 boards?

Postby aid219 » Fri Oct 28, 2022 6:44 am

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());

Craige Hales
Posts: 94
Joined: Tue Sep 07, 2021 12:07 pm

Re: What's the best way to differentiate between two custom ESP32 boards?

Postby Craige Hales » Fri Oct 28, 2022 4:04 pm

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: No registered users and 102 guests