Adding fluctuations to 5V

dcmicrocontrollerpowerserialvoltage

hobbyist here, hope someone can guide me.

I'm using I2C (only have 4 wires{PWR, GND, SDA, SCL}) to communicate with two exterior Circuit (Circuit A, and Circuit B, both have MCUs), which can be swapped between two locations (lets call them, left and right).

I need to identify which Circuit is in what location. I initially thought of using a voltage divider to lower left 5V to 4.9V and using an ADC on MCU to identify.

However, i now see this will melt my voltage divider as Circuit B draws 1.5 Amps, while the Circuit A draws 150mA.

Im now thinking if i can purposely add a fluctuation to my 5V DC PWR line, about 4.9V (between 5V to 4.8V) which my ADC could identify.

Can this be done with an OP-Amp? and if so, can you suggest the circuit.

If not, any other suggestions?

Thanks

Best Answer

I'm assuming the following

  • You have control over hardware and firmware of the sub-components A and B.
  • Each location L and R has a connector (or a set of connectors), which provide: power, ground, connection to I2C

Then there are several options, which revolve around adding a location pin to the location's connector. This pin can have a digital signal (low for Left, high for Right). Or, it could have an analog voltage set by a fixed voltage divider (the voltage would be distinct at each location).

  • A microcontroller (μC) in Circuit A (and B) can read its locating pin and choose its I2C slave address based on the location.
  • A μC can have a fixed I2C slave address. The slave would report the value of its locating pin during system initialization. Then the software on the master would take care of routing the messages.