I will attempt to explain how the hardware works in this piece as far as I understand it at the moment.
So I decided to understand how the arduino works behind the scenes. I wanted to know what components it was made up of and how the components come together to form the whole system. Like every complex system , it is modular. There is the power system, that chooses between the power jack and the USB power and produces 5v and 3v3 for the rest of the system. There is a USB to serial controller that contains the bootloader which is used to load programs into the ATMEGA328P.
The Power System
If there is a power suply connected to the power jack. The power supply should be between 9v and 15v. The two chips are voltage regulators that produce 5v. I still dont understand why there are two voltage regulator chips.
The Vin is directly connected to the power supply.
Vin is connected to the LM385D chip which contains two op amps. One of the opamps is used as a comparator and the other is not used at all. 3V3 is compared to Vin/2 if Vin/2>3V3 then the output is 5v and that is used to turn off the supply from the USB. The 5v generated is then connected to the LP2985 chip which is a voltage regulator that takes in 5v and outputs 3v3 .
If instead Vin/2<3.3 , the mosfet is turned on and the USB power is used instead. USB provides the 5v to the LP2985 chip.
And that’s the power system.
USB to Serial Controller
The USB controller is implemented with the ATMEGA8U2-MU. It contains the bootloader code which is used to load the code unto the ATMEGA328P.
This includes support circuitry like the silicon crystals and the pull-up resistors. There is also the ICSP interface that can be used to program the chip. The ICSP connects to the microcontroller SPI interface.
This is the main controller. The code you write for the arduino is executed by this controller. And it is directly connected to the I/O pins. The controller is programmed via the TX,RX pins connected to the USB to serial controller
And that’s it. This is relatively high level explanation. I will stop here for now. Next up, would be an explanation of the software.