Many consumer electronics have some kind of built-in protection to prevent users from plugging in batteries the wrong way or connecting the charger incorrectly. On some, this takes the form of a "keyed" connector, which physically prevents you from plugging in a connector any other way. On others, onboard electronics prevent damage to sensitive electronics if the user does manage to provide some kind of reverse voltage.

This is known as "reverse polarity protection," and there are several ways to accomplish it with electronics.

Modify the circuit below to add reverse polarity protection. That means if someone accidentally plugged in the 5V supply to the circuit the wrong way (flipped + and -), current would not flow through the circuit.

You can see a simulation of the circuit here.

If you start the simulation, you should see the green LED light up. We'll assume that this means "things are good and your circuit is working."

Now, if you switch the 5V and GND inputs to the circuit, the red LED lights up. We'll assume that the red light turning on means that "your circuit blew up because you gave it a negative voltage." That's bad.

How could you modify the circuit so that the green light still lights up with the correct voltage but the red light does not light up when you switch the input wires?

You should not modify any of the existing components (e.g. anything to the right of row 5 in the breadboard above).

Hint: Use a diode.