That will work. A PIA Port can drive that transistor.
Be aware that relays will
generate lots of electronic noise. The diode over the relay will help but the preferred way is via optocouplers.
Since the relays will switch low voltage and reasonable currents it will be allright. Above 20V is to be avoided!