The attraction of hydrogen as a clean fuel has continued to stimulate interest and development in generation, storage and usage. One of the most attractive approaches for hydrogen generation is z-scheme solar water splitting using semiconductor electrodes and photocatalysts where solar light serves as the source of energy and water serves as the source of hydrogen. Although many oxide photocatalysts have been used in past for water splitting, they only respond to ultraviolet radiation. The number of photocatalysts that are active for water splitting under visible light irradiation is very limited. Therefore, it is important to develop visible-light-driven photocatalyst materials for solar water splitting via a suitable bandgap engineering process. The bandgap of a visible-light-driven photocatalyst should be narrower than 3.00 eV (λ > 415 nm). In this context, we are using TiN nanowires which is converted very controllably to TiN1-xOx (TNO) by bringing a trace amount of oxygen during or after the growth of TiN nanowires into the deposition chamber. TNO is semiconducting whose bandgap is a function of oxygen content. By controlling the oxygen content in TNO, we are able to tune its bandgap to a value where absorption of visible light is strong to generate hydrogen and oxygen from splitting of water. When N atoms in TiN are partially substituted by O atoms in TNO, the top of the valence band (highest occupied molecular orbital, HOMO) is shifts higher compared to the corresponding metal oxide (TiO2) without affecting the level of the bottom of the conduction band (lowest unoccupied molecular orbital, LUMO). The potential of the HOMO for the oxinitride is located at higher potential energy than that for the corresponding oxide due to the contribution of N 2p orbitals, making the bandgap energy sufficiently small to respond to visible solar light (< 3eV).