All uFire boards communicate through I2C. The ISE board's I2C address defaults to 0x3F. What if you want to measure pH and ORP? You'll need two ISE boards and when you buy them, they will both have the address 0x3F. Obviously that isn't going to work.
To fix this issue, you'll need to change one of the board's address. You'll only need to do this once. Think of it as part of assembling your device, not part of your device's program, or some step an end-user would need to do.The Shell Example
The easiest way to change the I2C address is to connect one board, lets assume we are going to change the board that's going to measure ORP, to any controlling device. Load the "Shell" example. If you are using the Arduino IDE, it will be in the "File / Examples / Isolated ISE Probe Interface / pH" menu, if not, you can download it on GitHub.
After you upload it, you'll see a small display of information about your device; if you've got it connected properly, the configuration information, etc. You'll get a ">" command prompt. Depending on your device you might need to press enter to see the prompt and if you didn't automatically see the configuration information, you can enter "c".
While you're there, you can scroll through the source for a list of the available commands. You can also take a reading and adjust device configuration from here.
But to get to the point of this, to change the I2C address, type "i2c 3e". This particular Shell example takes the I2C address passed by the command and assumes it is a hex number. After you enter that command, the device will change its address to 0x3E, store that new address in its EEPROM, and use it from there on, even after losing power and resetting.Afterwards
Now that you've done that, you will need to instantiate your uFire ISE classes with the new address. All the options are explained in the documentation. The code would change from:
That's it. You can connect both devices together and communicate with them individually now.Some things to remember
- Don't change the address with both boards connected, it might appear they are both responding to commands, but only one actually is, although both are receiving the same I2C communication and both will change their I2C address
- If you forget what you changed the address to, you can upload an I2C scanner and see what is detected.
- If you enter an invalid I2C address, you may not be able to communicate with your device anymore. You'll need to get in touch with uFire and send your board back to be reprogrammed.