Including four part circuits(Power supply circuit, Comparison circuit, USB Download circuit and AVR single chip microcomputer circuit)
The comparison circuit is the most interesting part I think. Compare the USB power supply with DC power supply through lm358, and select the power side.