The 20mA per pin max. are considered for single pins. If you intend to run all pins high at the same time the current per pin can (will) drop to 8mA per pin
You will have to use transistors to switch the relays.
The power supply isn’t the limiting factor, as much as the on-board regulator is. It can provide 500mA, of which 300mA can be used by the Core during heavy wifi activity. This leaves you with 200mA, and that’s pushing it already. 16*16=256mA, which is more than the remaining 200mA in the best case scenario.
With @ScruffR’s addition, you’d have to look for relay that require less current, or figure out a way to boost your current externally (transistor?).
@Carsten4207, were you expecting to use all GPIO pins on the Core to drive the relays or us an I/O expander? As both @Moors7 and @ScruffR pointed out, you will need to consider driving the relays via transistors and I am assuming you will use flyback diodes accross the relay coils. Also, good power-supply decoupling will be vital.
Have you considered a pre-built unit like this one:
@hdemeillon, the relay module I had suggested AND the one you are proposing use opto-isolators to separate the power requirements between the relay board and the driving processor. The relays DO require 5V to drive their coils and so you will need to supply that separately to the board with enough current to drive all the relays. However, each channel’s opto-isolator means your are driving an LED via a GPIO pin on processor (Photon), reducing the current requirements and isolating the relay coil driving voltage/current requirements from those of the LED/Login input from the Photon.
The board you linked to only requires 5ma drive on the opto-isolator to activate the relay. Make sure the 5V supply to provide to the DC+ of the relay board can handle the all-relays-on total current. I suggest using a 1A supply. Also, if you power the Photon from the same supply via Vin, make sure you add decoupling capacitors between the Vin and GND rails of the Photon to reduce power supply noise when the relays switch. I suggest a 100uF electrolytic and a 0.1uF ceramic as a good start. Make sure to keep your wiring between the Photon and the relay board short and I HIGHLY recommend using a breaker panel for your power management. Even better, get a qualified electrician for the AC parts!