To increase the volume of your piezo, increase the voltage applied to
it. The voltage is currently limited to 5 V, but the buzzer would be much
louder at 9 or 12 V. Because higher voltages can’t be sourced from the
Arduino, you would need to use an external power source for the buzzer,
such as a 9 V battery, and then switch the power into the buzzer using a
transistor as an electronic switch. You can use the same sketch with the
schematic shown in Figure 4-39