This project is sponsored by LCSC. I have been using electronic components from LCSC.com. LCSC has a strong commitment to offering a wide selection of genuine, high quality electronic components at best price. Sign up today and get $8 off on your first order.

Adding power supply to the Arduino

The Arduino power jack can accept an input voltage range of 7 to 16 volts. The most common input sources are a trusty 9V battery or a 9-12VDC power supply. Because most sensors and chips require a 5V source, we will need the LM7805 voltage regulator to cut the 9V down to a component friendly 5V. If you connect more than 16V, you risk damaging the IC.

Adding board components

Pin mapping of ATmega328P-PU

Pin mapping of ATmega328P-PU

Before moving on, check out this image. It's a great resource for learning what each of the pins on your ATmega chip do in relation to the Arduino's functions. This will clarify a lot of confusion behind why you hook up certain pins the way you do. For even more detailed information, take a peek at the datasheet for the ATmega 168 (short version) (long version). Here's the sheet for the ATmega328 (short version) (long version).

Pin 7 - VCC, digital supply voltage (+5V) 

Pin 8 - GND (ground rail) 

Pin 22 - GND (ground rail) 

Pin 21 - AREF, analog reference pin for ADC (+5V) 

Pin 20 - AVcc, supply voltage for the ADC (+5V)

Uploading sketch to your Arduino

You can go here to know about the ways to upload sketch to arduino.

You will need a USB-to-Serial device. I used the FDTI Basic Breakout Board (5V). If you just want to get it working, you can skip installing the 6-pin header and just run jumper wires straight from the USB-TTL header to the appropriate pins on the breadboard. Be sure the pins are routed correctly for the serial device you choose; the pins on the breakout board are labeled with three-digit names. During my build I discovered the microcontroller needs a perfectly timed press of the reset button to ready the chip to be programmed and the breakout board has a pin called DTR/GRN which sends a signal to the reset pin when hooked up properly. So, connect a jumper wire from (DTR/GRN) on the breakout board to Pin 1 of the ATmega328 via a 0.1µF ceramic capacitor.