This is if you want to program your breadboard arduino and have an atmega328P-PU with the Optiboot bootloader already on the chip. The biggest issue I have found with breadboarding any chip is that they don’t always want to fully seat into the breadboard. In my experience, I find that pressing firmly down on the chip while uploading saves a ton of trouble!
The LED attached to pin 19 (D13) of the chip is there just as an example. I usually upload the example Blink sketch first to verify that I am able to upload a sketch since it gives me visual confirmation.
If you are using an oscillator.
Note: the caps with the oscillator are pF, NOT uF. Sorry.
If you want to use the FTDI Basic Breakout Board for timing.
There is probably room for improvement here but this is what I have come up with for a 3.7 Volt LiPo battery meter. In the picture below I am charging my battery from a 5 volt source. All the charge controlling circuitry is built into the battery. I just wanted a way to monitor the charging progress, although, this could certainly be added to any project that uses a 3.7 volt LiPo battery for its power supply.
Hope this helps.
//3.7V LiPo Battery Meter
//3.7V LiPo Battery Meter
//Use two 1.2 K Ohm resisters as a voltage divider from the positive
//and negative terminal of the battery to read reference voltage from.
//we wouldnt want to send to much voltage to our Arduino.
//Make sure to tie the ground back to the Arduino. Otherwise, expect some odd readings.
int sensorPin = 0; //set up the sensor pin for reading the voltage
int sensorValue = 0; //variable to store the value coming from the sensor
void setup()
{
//This is the default value, but we can set it anyways
analogReference(DEFAULT); //5V Reference on UNO
Serial.begin(9600); //initialize serial communication
}
void loop()
{
sensorValue = analogRead(sensorPin); //set sensorValue as an analog read of the A0 pin
//print the value of the sensor multiplied by 0.00326 to get true voltage reading.
//this is a value of 0 – 1023 coming from the sensor pin and has to be converted.
Serial.println(“Battery Voltage Is”);
Serial.println(sensorValue * 0.00951);