Piezoelectric devices for energy harvesting and ambient sensing