The images represents circuits interfaced with an Arduino microcontroller. The first image is a controller circuit for running a piezo buzzer. I understand the application of the transistor here, but am not sure why the resistor is present in parallel with the speaker. The second schematic is a circuit that lights LEDs based on the voltage read at the analog pin A0. I thought that arduino's input impedance was very high? What is the application of this resistor? And finally, the second image is a controlling circuit that I do not understand. The device on the left is suppose to represent a 12V relay. The diode is present to prevent voltage spikes from the relay after it has been switched off. My concern is that, given the transistor is an an NPN (BC548), the current would flow from collector to emitter (i.e. to ground in this schematic). The data sheet, and the article, write that the pin orientation is collector, base, emitter. With the diode reverse biased (the cathode is at the relays positive terminal), how does this circuit work?