A device includes a substrate having a first surface. A piezoelectric nanowire is disposed on the first surface of the substrate. The piezoelectric nanowire has a first end and an opposite second end. The piezoelectric nanowire is subjected to an amount of strain. A first Schottky contact is in electrical communication with the first end of the piezoelectric nanowire. A second Schottky contact is in electrical communication with the second end of the piezoelectric nanowire. A bias voltage source is configured to impart a bias voltage between the first Schottky contact and the second Schottky contact. A mechanism is configured to measure current flowing through the piezoelectric nanowire. The amount of strain is selected so that a predetermined current will flow through the piezoelectric nanowire when light of a selected intensity is applied to a first location on the piezoelectric nanowire.