Show Posts
Pages: [1]
1  Topics / Product Design / Re: 2 Axis Solar Tracker (The evolution of an idea) on: August 07, 2012, 06:39:04 pm
@Pito
Excellent observations and insights. (Thanks)

Some time ago I took some measurements on a handful of LED’s I have.
Using a consistent light source I measured the output voltage.

I want to avoid doing a calibration process so the actual output voltage is not as critical as finding 3 LED’s that give the same measurement under the same lighting conditions. Alternatively if you are going to calibrate the sensors it won’t matter as the various outputs will be converted to an equal min max scale.

LED as Light Sensor Output Voltage (mV)
Transparent Red                  112.9
Clear Red                            73.1
Opaque Red                        34.6
Clear Green                        78.1
Clear Green (Mini) 1            56.8
Clear Green (Mini) 2            46.4
Clear Green (Mini) 3            57.6
Clear Green (Mini) 4            47.7
Clear Green (Mini) 5            34.8
Clear Green (Mini) 6            28.6
Clear Green (Mini) 7            51.5
Opaque Green                     45.3
Clear Yellow                       158.7
Opaque Yellow                    70.8
2  Topics / Product Design / Re: 2 Axis Solar Tracker (The evolution of an idea) on: August 06, 2012, 08:29:36 pm
Updated the schematic at the top of the thread.
Added caps to pins 7, 20, and 21.
Also added blocking diode to the solar panel(s).
3  Topics / Product Design / Re: 2 Axis Solar Tracker (The evolution of an idea) on: August 06, 2012, 08:24:07 pm
1. mind the total current through 328p when all relays on, better use the transistors for switching the relays.
2. I would not use the tracking with those optical homing sensors - add simply an RTC and you can calculate the SUN's position with GREAT precision even at night smiley
p.

As the software is programmed now only 1 relay will ever be on at any given time.
But I will be measuring the current through the relay just for curiosity now.  smiley-wink

RTC (Real Time Clock?)
Incorporating a clock into the system will add a layer of complexity I am not familiar with at this time.
It may be a better alternative/solution but I don’t have that knowledge in my tool bag.
The three photoresistors, as I originally configured them, were more accurate than was necessary.
I would also think that using an absolute type of positioning system would mean I have to position the system in a particular manner at a particular time.

If you have a good example of using the RTC in a solar tracker I would like to look at it.

Your post also made me realize the photoresistors are probably sensitive enough to track the moon.
Possibly wasting energy throughout the night. Hmmmm smiley-confuse
4  Topics / Product Design / Re: 2 Axis Solar Tracker (The evolution of an idea) on: August 05, 2012, 12:28:14 pm
You might want to provide a rechargeable battery.  If the tracker follows the sun until sunset it will be in just the wrong position to power the motors at sunrise.  With no power it will have to wait until it gets enough energy from the reflected sunrise light to move the array back to the sunrise position.

 smiley-kiss...
I forgot to mention that in the write up, but you are correct.
I have an old cordless wall phone that I am going to scavenge the rechargeable battery out of (possibly circuitry also).
It is only 3.6v so I will have to expirement to see if it will be big enough to trip the relay and drive the assembly.

The linear regulator wastes some of that precious solar energy.  A DC-to-DC converter would be more efficient.

Any recommendations or links to an appropriate converter?

I was also thinking of replacing the photoresistor circuit(s) with plain LED’s to improve efficiency.
I wouldn’t have to power them as they work like mini solar cells (light in - electrons out).
It would also reduce part count and cost.

Thanks for the input.
5  Topics / Product Design / Re: 2 Axis Solar Tracker (The evolution of an idea) on: August 05, 2012, 11:56:19 am
Don't forget diodes across the relays.
Missing 0.1uF caps from pins 7, 20, 21 to  Gnd.

I updated the original schematic at the top of the thread per your suggestions.

I used 1N4007 diodes as I have them on hand.
A good choice? or is there something better?
What parameters qualifies as better?
I am thinking low leakage high breakdown voltage ratings.

Curious:
There is no circuitry after the coil (it goes directly to ground) and as I have it shown now any spikes can feed back to the microcontroller.
It would make more sense to me to have the diodes in-line with the controller pins blocking any return voltage.
Is the Newbie looking at this the right way?


Quote
Protection diodes for relays
Transistors and ICs must be protected from the brief high voltage produced when a relay coil is switched off.
The diagram shows how a signal diode (eg 1N4148) is connected 'backwards' across the relay coil to provide this protection.
http://www.kpsec.freeuk.com/components/relay.htm


Also I added the .1uF (100nF) cap across the 7, 20, 21 node.
I notice you used the word "caps" (plural) in your post.
Do you recommend 3 (one for each pin)?

Your comments and thoughts are greatly appreciated.
Thanks
6  Topics / Product Design / Re: 2 Axis Solar Tracker (The evolution of an idea) on: August 05, 2012, 10:46:39 am
Why have you chosen to use pulleys and not directly drive the axis from the motors (as you are using gearmotors anyway)?

Good Question…

Originally I was going to cannibalize an old scanner and printer for the drive components. I found some timing belts and pulleys that matched the drives on the scavenged stepper motors I had at http://www.mcmaster.com/#mxl-series-timing-belts/=ipu9sj. Later I decided I did not want the added cost and complexity of using steeper motor driver(s). I would also have to energize the steppers continuously to get them to “hold” the array in place due to wind loading. I also looked into worm gear drives but could not justify their cost for this project. In the end I just substituted DC gear motors for the stepper motors in the design and went forward with the project.

If all goes well I want to build a bigger better version. I was thinking the worm gear drives in your cars electric windows would be something to investigate.

I’m pretty sure I can get the direct drive approach to work for both the pan and tilt functions reducing the part count and cost. (good call)

This is exactly why I posted here at this time. We sometimes become so involved in the process we tend to overlook the obvious things that fresh eyes will catch. (Thanks)
7  Topics / Product Design / 2 Axis Solar Tracker (The evolution of an idea) on: August 05, 2012, 09:35:56 am
Good Day…
I have been developing this project for about a month now and thought I would share and hopefully get some feedback.

The idea is that it will track the sun and just wait for morning to realign again. No counting steps or any other absolute positioning required. Set it up, connect it to a battery, and walk away.

I have built a mock on the breadboard and successfully driven the gear motors as intended with the schematic shown below. Was hoping to get some peer review/proofing of the schematic and code before finalizing the design and committing to the actual build.
Thanks


Still need to incorporate battery charging circuitry and probably some fuse/overload protection also.

Readable PDF File:
http://www.gertweb.com/images/Solar%20Tracker.pdf


Initial Design Concept



Early design layouts of drive mechanism.

On the left a $7.00 Gear Motor. On the right a $25.00 Stepper Motor.
Hmmmm



Testing some “recycled” relays to reverse motor direction.
Uses the 5v from the microcontroller output pin to drive the relays controlling the 12v to the motors.
 
Truth Table
 J1 Low + J2 Low = Armature Grounded
 J1 Low + J2 High = Rotate Right
 J1 High + J2 Low = Rotate Left



The drive motors and design configuration I intend to use.


The gearbox gives an 8 to 1 gear ratio and it has a lot more torque than one might think. (a good thing)



Rev 4 of the prototype circuit board.
The more I contemplate the design the more I realize it will probably need an additional position sensor.
IE: How do you get it to turn and face East for the morning sun? Tracking the sun itself is easy.
But not getting it positioned correctly to start with could mean the panels will track facing directly away from the sun. Thoup!!

The chip will be programmed on the Arduino board and then transplanted to the solar assembly.
By doing this I freed up a lot of real-estate on the proto-board.



Built a quick mock up to program, test, and debug the sensor array.
Some Aluminum tubing, Styrofoam hamburger tray, a little masking tape, and a chunk of 7 wire cable.
(Who’s your daddy MacGyver?)



The un-calibrated sensor readings feed a much larger, more precise, data set to the microcontroller (as was expected). By skipping the calibration process I can remove a large layer of complexity from the design solution. The down side to this is that it is way more precise than need be. To get the sensor array I built to work correctly it needs to be within about ¼ to an 1/8 of a degree perpendicular to the sun. This will cause a large number of motor steps to keep alignment throughout the day. Great tracking performance (if you want to shoot down missiles), but poor utilization of collected solar energy. Tradeoffs are needed.
 
Using a solar cell and a volt meter I found I need to be within about plus or minus 5 degrees of perpendicularity for best collector efficiency. Instead of trying to tweak the design parameters with the software it will be easier to alter the array to give a bit more freedom to the perpendicularity tolerance.
 
Of Interest…
 I was reading Wikipedia after writing the above comments and it stated that a plus minus 5 degree angle will be greater than 99.6% efficient. It turns out the rod in my eye is a pretty accurate protractor. (grin)

---------------

The redesigned sensor array. I went with a plus minus 6 degree variance. This is probably still more accurate than need be.



Baby Steps…
I started developing the software by just acquiring the sensor data. Next, using that data, I wrote the code to compare values and turn switches on and off accordingly. The next step will be to actually wire relays in place of the indicator LED’s and drive the motors. I was pleasantly surprised when I realized I had 80% of the code done in one afternoon.



The code
Code:
/*
  Solar Tracker (Preliminary Example Code)
 
 Uses 3 photoresistors to track the suns movement.
 The microcontroller evaluates the photoresistor values and
 drives the appropriate positioning motor for correct alignment.
 
 created 28 Jul 2012
 By David A Smith
 modified 28 Jul 2012
 By David A Smith
 
 
 This code is in the public domain.
 
 */

// These constants won't change:
const int sensorPinA0 = A0;    // pin that the Bottom/Left sensor is attached to
const int sensorPinA1 = A1;    // pin that the Right sensor is attached to
const int sensorPinA2 = A2;    // pin that the Top sensor is attached to

//const int pmotorPinA0 = 11;        // pin that the pan motor relay is attached to
//const int pmotorPinA1 = 10;        // pin that the pan motor relay is attached to
//const int tmotorPinA0 = 9;        // pin that the tilt motor relay is attached to
//const int tmotorPinA2 = 8;        // pin that the tilt motor relay is attached to


// variables:
int sensorValueA0 = 0;         // Bottom/Left photoresistor
int sensorValueA1 = 0;         // Right photoresistor
int sensorValueA2 = 0;         // Top photoresistor

int panDelay = 1000;           // The amount of time the pan and tilt motor will run
int tiltDelay = 1000;          // this will vary depending on motor and drive train


void setup() {
 
    // Send debugging information via the Serial monitor
  Serial.begin(9600);
   
    //Assign and set motor driver pins to low
    pinMode(11, OUTPUT);
    digitalWrite(11, LOW);
    pinMode(10, OUTPUT);
    digitalWrite(10, LOW);
    pinMode(9, OUTPUT);
    digitalWrite(9, LOW);
    pinMode(8, OUTPUT);
    digitalWrite(8, LOW);
}

void loop() {
  // read the sensor:
  sensorValueA0 = analogRead(sensorPinA0);
  sensorValueA1 = analogRead(sensorPinA1);
  sensorValueA2 = analogRead(sensorPinA2);



  // Compare sensor readings and drive pan motor left or right
  // If the sensor values are equal (what we want) it will skip adjusting the pan motor
    // Pan Right
    if (sensorValueA0 > sensorValueA1){
      digitalWrite(11, HIGH);
      delay(panDelay);
      digitalWrite(11, LOW);
    }
    // Pan Left
    if (sensorValueA0 < sensorValueA1){
      digitalWrite(10, HIGH);
      delay(panDelay);
      digitalWrite(10, LOW);
    }

  // Compare sensor readings and drive tilt motor up or down
  // If the sensor values are equal (what we want) it will skip adjusting the tilt motor
    // Tilt Down
    if (sensorValueA0 > sensorValueA2){
      digitalWrite(9, HIGH);
      delay(tiltDelay);
      digitalWrite(9, LOW);
    }
    // Tilt Up
    if (sensorValueA0 < sensorValueA2){
      digitalWrite(8, HIGH);
      delay(tiltDelay);
      digitalWrite(8, LOW);
    }

   
  //Print debugging information
  Serial.print("Left/Bottom reading = ");
  Serial.println(sensorValueA0);     // the left/bottom sensor analog reading
  Serial.print("Right reading = ");
  Serial.println(sensorValueA1);     // the right sensor analog reading
  Serial.print("Top reading = ");
  Serial.println(sensorValueA2);     // the top sensor analog reading
 
  delay(1000);
}


Nothing I have presented here is finalized and all information is for review and informational purposes only.
For a more in-depth look at the development stages of this and other related projects visit my Facebook page.
(New friend requests are always welcome)
http://www.facebook.com/media/set/?set=a.445878665445702.103623.100000707171935&type=3&l=bfcf6b8267

EDIT 8-19-2012
Updated my personal web page to include this and other projects.
http://www.gertweb.com/arduino.html
8  Using Arduino / Sensors / Re: Problem with temperature sensor SMT160-3 on: June 23, 2012, 02:02:31 pm
I had a similar problem with my LM34 temp sensor. (http://arduino.cc/forum/index.php/topic,111366.0.html) Poor stability with inaccurate temp readings. I finally realized the 5v coming from the USB was the problem. Every time the hard disk spun or with heavy processing the PC USB would lag in its voltage output. (Dell Studio XPS)

Remedy: Switch to an external power supply. I don’t know about the SMT160-3 but the LM34 needs +5 to +20 on the Vs. I found running at a supply of 7v fixed my problem.

I am not an expert and this information may be inaccurate.
9  Using Arduino / Sensors / EEPROM Data Logging w/ LM34 Temp Sensor on: June 23, 2012, 11:51:02 am


The code below will log temperature data of a specified time period.

It is a 2 to 3 step process
 1. Clear EEPROM memory
      (this step is optional Temp Logger will overwrite any currently stored data)

Code:
/*
 * EEPROM Clear
 *
 * Sets all of the bytes of the EEPROM to 0.
 * This example code is in the public domain.

 */

#include <EEPROM.h>

void setup()
{
  // write a 0 to all 1024 bytes of the EEPROM
  // there are 1024 bytes in the ATmega328 EEPROM
  // 512 bytes on the ATmega168 and ATmega8
  // 4 KB (4096 bytes) on the ATmega1280 and ATmega2560
  for (int i = 0; i < 1024; i++)
    EEPROM.write(i, 0);
   
  // turn the LED on when we're done
  digitalWrite(13, HIGH);
}

void loop()
{
}

 2. Load and run LiquidCrystal Temperature Logger.
      The program will display acquired data on the LCD including the number of readings it has made.
      See code comments for more information on using and tweaking the program

NOTE:
      Using an external power source of 7v will give more accurate readings.
      During testing I used a 9v supply but noticed components on the Arduino board getting warm/hot.
      7v is enough for stability without heating up board components.
      It can be powered with the USB supply but it fluctuates too much and will distort readings.

Code:
/*
  LiquidCrystal Temperature Logger.
Developed using Arduino Uno R3

Pins configuration for standard HD44780 LCD
This sketch is for 16 character x 2 row LCD

 * LCD Pin 1 to Ground
 * LCD Pin 2 to +5
 * LCD Pin 3 to Center Leg Pot 10k
 * LCD Pin 4 to digital pin 12
 * LCD pin 5 to Ground
 * LCD pin 6 to digital pin 10
 * LCD pin 11 to digital pin 5
 * LCD pin 12 to digital pin 4
 * LCD pin 13 to digital pin 3
 * LCD pin 14 to digital pin 2
 * LCD pin 15 +5 (LED Backlight +) *optional
 * LCD pin 16 to Ground (LED Backlight -) *optional
 
Pin configuration for LM34DZ http://www.ti.com/lit/ds/symlink/lm34.pdf

 * Vs   to +5
 * Vout to Analog pin A0
 * GND  to Ground
 
Sketch created by David A. Smith 6-22-2012
 
 Modified from
 http://reversemidastouch.blogspot.com/2010/03/arduino-lm34-temperature-sensor.html
 "eeprom_write" from File > Examples > EEPROM > eeprom_write
 
 */

// include the library code:
#include <EEPROM.h>
#include <LiquidCrystal.h>

int addr = 0;                   // the current address in the EEPROM we're going to write to
int sensor_pin = 0;             // the analog pin for LM34 temp sensor
int sensor_reading = 0.0;       // variable to store the value coming from the sensor
float vref = 4.85;              // variable to store the voltage reference used
                                // using a separate thermometer tweak vref value to fine tune the displayed temperature
                               
int fahrenheit = 0;             // variable to store the fahrenheit temperature
int centigrade = 0;             // variable to store the centigrade temperature
int acquisition_timer = 5000;   // variable to control the time between updates (in ms)
                                // 300000 = 5 min intervals
int loop_counter = 0;
int bytemax = 1024;             // adjust this value for your eeprom memory limit
                                // there are 1024 bytes in the ATmega328 EEPROM
                                // 512 bytes on the ATmega168 and ATmega8
                                // 4 KB (4096 bytes) on the ATmega1280 and ATmega2560

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);


void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16,2);
  pinMode( sensor_pin, INPUT );    // set LM34 temp sensor pin as an input
  analogReference(DEFAULT);        // set the analog reference to the 5V internal reference
  delay(1000);
}

void loop() {
 
  int sensor_reading = analogRead(sensor_pin);               // stores the digitized (0 - 1023) analog reading from the LM34
  float fahrenheit = (100.0 * sensor_reading * vref)/1023;   // calculates the actual fahrenheit temperature
  float centigrade = ((fahrenheit-32)/1.8);                  //conversion to degrees C

 // set the cursor to (0,0):
   lcd.setCursor(0,0);
   lcd.print(centigrade);
   lcd.print((char)223);   // degree symbol
   lcd.print("C ");
   lcd.print(fahrenheit);
   lcd.print((char)223);   // degree symbol
   lcd.print("F");

 //Print readings counter on the second row
   lcd.setCursor(0, 1);
   lcd.print("Readings: ");
   
 // if the eeprom is not full
   if (loop_counter <= bytemax) {
   lcd.print(loop_counter);
   
 // divide by 4 because analog inputs range from 0 to 1023 and
 // each byte of the EEPROM can only hold a value from 0 to 255.
   int val = sensor_reading / 4;

 // write the value to the appropriate byte of the EEPROM.
 // these values will remain there when the board is turned off.
   EEPROM.write(addr, val);

 // advance to the next address.
 // there are 1024 bytes in the ATmega328 EEPROM
 // 512 bytes on the ATmega168 and ATmega8, 4 KB (4096 bytes) on the ATmega1280 and ATmega2560
  addr = addr + 1;
  delay (acquisition_timer);
  }
 
    else {
      lcd.print("Full");
      delay(acquisition_timer);          // 300000 = 5 min intervals
    }
    loop_counter++;

 // turn off automatic scrolling
   lcd.noAutoscroll();
 
 // clear screen for the next loop:
   lcd.clear(); 
}


 3. Retriving the data
      The temp logger will tell you when the eeprom is full.
      The code below will retrieve the data and print it to the serial monitor.

NOTE:
      After printing the 1024 data points it will pause for 5 min and then print them again. (better coding needed)
      During the pause simply ctrl-a then ctrl-c to copy the data and past it to Excel or other programs.
      If your chip has different memory limits you will need to tweak the code accordingly.
      Again refer to code comments for more detail.

Code:
/*
 * EEPROM Read
 *
 * Reads the value of each byte of the EEPROM and prints it
 * to the computer.
 * This example code is in the public domain.
 */

#include <EEPROM.h>

// start reading from the first byte (address 0) of the EEPROM
int address = 0;
byte value;
float vref = 4.85;              // variable to store the voltage reference used

int bytemax = 1024;             // adjust this value for your eeprom memory limit
                                // there are 1024 bytes in the ATmega328 EEPROM
                                // 512 bytes on the ATmega168 and ATmega8
                                // 4 KB (4096 bytes) on the ATmega1280 and ATmega2560
                               
void setup()
{
  // initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
}

void loop()
{
  // read a byte from the current address of the EEPROM
  value = EEPROM.read(address);
 
  Serial.print(address);
  Serial.print("\t");
  value = value *4;
  float fahrenheit = (100.0 * value * vref)/1023;   // calculates the actual fahrenheit temperature
  Serial.print(fahrenheit);
  Serial.println();
 
  // advance to the next address of the EEPROM
  address = address + 1;
 
  // there are only 1024 bytes of EEPROM, from 0 to 1023, so if we're
  // on address 1023, wrap around to address 0
  if (address == bytemax){
    delay (300000);     //Delays the loop for 5 min
                        // copy paste from the serial monitor to XL or other program
    address = 0;
  }
  else {
    delay(100);
    }   
}

Any questions, comments, or suggestions are welcome.
Enjoy
10  Using Arduino / LEDs and Multiplexing / Re: Need help replicating the Nerdkit LED array project on: June 18, 2012, 10:21:51 pm
Does your offer still stand?
If so what color LED's do you prefer? (grin)

Also...
Reading the forum here there is a question of whether or not the Arduino can handle the needed current.

My LED Array Build
http://www.nerdkits.com/forum/thread/431/
Pages: [1]