I made some progress this weekend. My Jameco order came in so I go out my breadboards and went crazy.
I seem to be able to read all the voltages so far, but I haven't tried to turn on or off the transistors.
I measured the voltage out of the solar panel and read it into the Galialeo, I can also read the
battery voltage. I needed more MS Excel experience so I figured out how to calculate the line
using Excel. It was pretty easy but I hadn't done it before so it was good experience.
Here's the spreadsheet/line equation for my solar voltage. I needed that to display the
voltage in the Arduino serial window. I tested by moving my desk lamp closer to or farther from the
panel.
I still need to check the current drain of the Galileo and also see if I can turn on and
off the voltage at the battery. Here's the circuit so far (with the code used to read/print voltages).
/* Solar cell battery charger/regulator
All this does is read the voltage at solar cell (A0) and
The battery voltage (A1). It blinks the LED to show that
it's looping - in case the serial didn't work ;-)
*/
#define voltage_in 0
#define voltage_out 1
#define charge_enable 11
int x;
int y;
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
int chon = 5000; // charge on time
int choff = 2000; // charge off time
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
//digitalWrite(charge_enable, LOW);
}
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
//delay(1000); // wait for a second
x = analogRead(voltage_in); // voltage from solar panel
y = analogRead(voltage_out); // voltage on battery
Serial.print("Solar A/D count is: ");
Serial.print(x);
Serial.print(". Which is about this many volts: ");
Serial.println((x * .0579) + .6249);
Serial.print("Battery A/D is: ");
Serial.print(y);
Serial.print(". Which is about this many volts: ");
Serial.println((y * .0579) + .6249);
delay(1000);
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000);
}