I am using Arduino for the first time and I have question regarding I2C communication protocol.
I was looking at the specifications of Arduino Mega and it says 'Current per I/O pin = 20 mA'. Therefore, can I give 20 mA to each individual sensor on the bus simultaneously? e.g for 50 sensors the total current required will be 1A, so can I provide that much amount of current to the sensors in I2C communication protocol?
No, Atmega2560 is limited to 800mA total, and there are limits to the what each port (groups of 8 pins) can tolerate.
Check out section 30 or 31 I think of the Atmega2560 datasheet.
Why would you power the I2C devices via IO pins?
I would recommend a seperate power supply as the onboard regulator is not rated for 1A anyway. And neither can the USB port supply that much current.
Also, if you have a device connected to SCL/SDA (the I2C pins) and the device is not powered, the device may act like it is ‘phantom powered’ thru its I2C pins, and with that many devices will likely result in communication problems.
5V, 1A or 2A supplies can be had for about $6 USD.