Hi everybody, I'm new to this forum and to arduino as whole, but I'm pretty handy with electronics.
Ihttp://www.arduined.eu/arduino-solar-charge-controller/ wanted to build this circuit:
I build this circuit using EAGLE CAD but used the arduino nano instead of the mini that the project calls for.
here is the circuit I build:
Problem is that the circuit does absolutely nothing just sits there the led which is supposed to indicate activity remains lit and the battery remains at same voltage even when the solar input is connected and providing a higher voltage than the battery.
the only different parts I'm using is the 2 pnp transistors I'm using pn2907 instead of the 2n3906.
Thank you for your help
This is the code on the project:
const int setPoint = 13.5 * 20 / (20+82) * 1024 / 5;
int measurement = 0;
int pulseWidth = 0;
int difference = 0;
int stepSize = 0;
int calculation = 0;
int led = 13;
void setup() {
TCCR2A = TCCR2A | 0x30;
TCCR2B = TCCR2B & 0xF8 | 0x01;
analogWrite(11, 117);
analogWrite(3, 137);
// Serial.begin(9600);
pinMode(led, OUTPUT);
}
void loop() {
measurement = analogRead(A1);
calculation = setPoint - measurement;
difference = abs(calculation);
stepSize = difference;
if (measurement < setPoint)
{
pulseWidth += stepSize;
if (pulseWidth > 255) pulseWidth = 255;
analogWrite(led, 0); // pwm to LED
}
if (measurement > setPoint)
{
pulseWidth -= stepSize;
if (pulseWidth < 0) pulseWidth = 0;
analogWrite(led, 255); // pwm to LED
}
// Serial.println(pulseWidth);
analogWrite(9, pulseWidth);
delay(10);
}

