11188 views|28 replies

693

Posts

7

Resources
The OP
 

DIY sun-tracking solar panels [Copy link]

 
1. Select the actuator of the solar panel that can track the sun. 375516[/attach]
Reduction ratio (Reduction ratio=Input speed÷Output speed=Number of teeth of driven gear÷Number of teeth of driving gear) Number of pulses: 64 Step angle: 5.625 degrees (64 pulses per circle) Function: Determine the angular displacement of rotation by the number of pulses input, generally to control the offset angle of the wheels of the trolley, etc. Driving mode: 4 phases and 8 beats (forward A-AB-B-BC-C-CD-D-DA-A......) The phase excitation sequence of the stepping motor is: 375517 [/attach]
375518 [/attach]
375520[/attach]
A stepper motor is an actuator that converts electrical pulses into angular displacement. In simple terms: when the stepper driver receives a pulse signal, it drives the stepper motor to rotate a fixed angle (and step angle) in the set direction. You can control the angular displacement by controlling the number of pulses to achieve the purpose of accurate positioning; at the same time, you can control the speed and acceleration of the motor by controlling the pulse frequency to achieve the purpose of speed regulation.
Stepper Motor28BYJ48 four-phase eight-beat motor, voltage is DC5V-DC12V. When a series of continuous control pulses are applied to the stepper motor, it can rotate continuously. Each pulse signal corresponds to a change in the power-on state of one or two phases of the stepper motor winding, which corresponds to the rotor rotating a certain angle (a step angle). When the change in the power-on state completes a cycle, the rotor rotates one tooth pitch. Four-phase stepper motors can operate in different power-on modes. Common power-on modes include single (single-phase winding power-on) four beats (ABCDA...), double (two-phase winding power-on) four beats (AB-BC-CD-DA-AB-...), and eight beats (A-AB-B-BC-C-CD-D-DA-A...)
2. Start to install solar panels on stepper motors
3. Install the light intensity sensor module. The light intensity sensor module I chose is the BH1750 module. The BH1750 is an IIC working device. I use it to collect light intensity and feed the data back to the stepper motor to adjust the direction of the solar panel to track the direction with high light intensity. 4. Modular program Because the system I built is relatively large, in order to make the program clear and organized, I use modular programming. The following is the stepper motor program: #ifndef __STEPMOTOR_H #define __STEPMKOTOR_H #include

void Stepmotor_Angle(unsigned int angle, unsigned char dir,unsigned char speed); void Stepmotor_Stop(void); void Stepmotor_Delayms(unsigned int x); #endif #include "stepmotor.h" code const unsigned char CCW[8] = {0x08 ,0x0c,0x04,0x06,0x02,0x03,0x01,0x09};//Clockwise rotation code const unsigned char CW[8] = {0x09,0x01,0x03,0x02,0x06,0x04,0x0c,0x08};// Rotate counterclockwise void Stepmotor_Delayms(unsigned int x) { unsigned char y; for( ; x > 0; x--) { for(y = 110; y > 0; y--); } } /**************************************** ******************************* *Function name: Step_Motor *Function parameters: dir: Direction: dir = 0 clockwise Rotate, dir = 1 counterclockwise rotation speed: 4: fastest 10: slowest other speeds are selected between ?~10 * Function: The stepper motor rotates in a certain direction * Return value: None * Function Author: bqgup *Completion date: 2017.9.12 **************************************** ********************************/ static void Step_Motor(unsigned char dir,unsigned char speed) { unsigned char i, j; for(j = 0; j < 8; j++) { for(i = 0; i < 8; i++) { if(dir == 0) { P1 = CCW; } else if(dir == 1) { P1 = CW; } Stepmotor_Delayms(speed);//slowest 7 gears } } } /********************************* ****************************************** *Function name; Stepmotor_Angle *Function parameters : angle: angle dir: direction dir = 0 clockwise, dir = 1 counterclockwise speed: rotation speed, increase from 4 upwards, the larger the value, the slower the speed, please note that it cannot exceed the specified size of the data type *Function function : The stepper motor rotates a certain angle in a certain direction *Return value: None *Function author: bqgup *Completion date: 2017.9.12 ********************* ************************************************** */ void Stepmotor_Angle(unsigned int angle, unsigned char dir,unsigned char speed) { unsigned int pulse; unsigned int i; pulse = angle / 11.25 + 0.5; for(i = pulse; i > 0; i--) { Step_Motor(dir,speed); } } void Stepmotor_Stop(void) { P1 = 0x00; } [/code]
The following is the BH1750 light intensity module acquisition program[ #ifndef BH1750_H #define BH1750_H #include
#include

#define SlaveAddress 0x46 //Define the slave address of the device in the IIC bus, modify it according to the different ALT ADDRESS address pins //When the ALT ADDRESS pin is grounded, the address is 0xA6, and when it is connected to the power supply, the address is 0x3A sbit SCL=P1^2; //IIC clock pin definition sbit SDA=P1^3; //IIC data pin definition/********************************************************************** *Function name: delay_nms *Function function: delay xms *Function parameter: x *Return value: None*******************************************************************/ void delay_nms(unsigned int x); /************************************************************************** *Function name: BH1750_Start *Function function: I2C bus start signal *Function parameter: None *Return value: None***********************************************************************/ void BH1750_Start(); /************************************************************************** *Function name: BH1750_Stop *Function function: I2c bus termination signal *Function parameter: None *Return value: None********************************************************************/ void BH1750_Stop(); /************************************************************************** *Function name: BH1750_SendACK *Function function: I2c bus sends response signal *Function parameter: ack *Return value: None***********************************************************************/ void BH1750_SendACK(bit ack); /************************************************************************** *Function name: BH1750_RecvACK *Function function: I2c bus receives response signal *Function parameter: None *Return value: CY ***************************************************************************/ bit BH1750_RecvACK(); /********************************************************************** *Function name: BH1750_SendByte *Function function: I2C bus writes a byte *Function parameter: None *Return value: None*******************************************************************/ void BH1750_SendByte(unsigned char dat); /************************************************************************** *Function name: BH1750_RecvByte *Function function: I2C bus reads a byte *Function parameter: None *Return value: dat ***************************************************************************/ unsigned char BH1750_RecvByte(); /************************************************************************** *Function name: Single_Write_BH1750 *Function function: BH1750 single byte write *Function parameter: None *Return value: None****************************************************************/ void Single_Write_BH1750(unsigned char REG_Address); /********************************************************************** *Function name: Single_Read_BH1750 *Function function: BH1750 single byte read *Function parameter: None *Return value: None*******************************************************************/ //unsigned char Single_Read_BH1750(uchar REG_Address); /************************************************************************** *Function name: Init_BH1750 *Function function: BH1750 initialization *Function parameter: None *Return value: None********************************************************************/ void Init_BH1750(); #endif #include "bh1750.h" /********************************************************************** *Function name: delay_nms *Function function: delay xms *Function parameter: x *Return value:None********************************************************************/ void delay_nms(unsigned int x) { unsigned int y; for(; x > 0; x--) { for(y = 110; y > 0; y--); } } /************************************************************************** *Function name: Delay5us *Function function: delay 5us *Function parameter: None *Return value: None***********************************************************************/ void Delay5us() { _nop_();_nop_();_nop_();_nop_();_nop_(); _nop_();_nop_();_nop_();_nop_(); _nop_();_nop_();_nop_(); _nop_();_nop_();_nop_();_nop_(); } /********************************************************************** *Function name: BH1750_Start *Function function: I2c bus start signal *Function parameters: None *Return value: None **********************************************************************/ void BH1750_Start() { SDA = 1; //Pull up the data line SCL = 1; //Pull up the clock line Delay5us(); //Delay SDA = 0; //Generate a falling edge Delay5us(); //Delay SCL = 0; //Pull down the clock line } /************************************************************************** *Function name: BH1750_Stop *Function function: I2c bus termination signal *Function parameters: None *Return value: None *************************************************************************/ void BH1750_Stop() { SDA = 0; //Pull down the data line SCL = 1; //Pull up the clock line Delay5us(); //Delay SDA = 1; //Generate a rising edge Delay5us(); //Delay} /********************************************************************** *Function name: BH1750_SendACK *Function function: I2c bus sends a response signal *Function parameter: ack *Return value: None***********************************************************************/ void BH1750_SendACK(bit ack) { SDA = ack; //Write response signal SCL = 1; //Pull up the clock line Delay5us(); //Delay SCL = 0; //Pull down the clock line Delay5us(); //Delay} /************************************************************************** *Function name: BH1750_RecvACK *Function function: I2c bus receives response signal *Function parameters: None *Return value: CY **********************************************************************/ bit BH1750_RecvACK() { SCL = 1; //Pull up the clock line Delay5us(); //Delay CY = SDA; //Read response signal SCL = 0; //Pull down the clock line Delay5us(); //Delay return CY; } /************************************************************************** *Function name: BH1750_SendByte *Function function: I2c bus writes a byte *Function parameters: None *Return value:None********************************************************************/ void BH1750_SendByte(unsigned char dat) { unsigned char i; for (i=0; i<8; i++) //8-bit counter{ dat <<= 1; //Shift out the highest bit of the data SDA = CY; //Send data port SCL = 1; //Pull up the clock line Delay5us(); //Delay SCL = 0; //Pull down the clock line Delay5us(); //Delay} BH1750_RecvACK(); } /****************************************************************************** *Function name: BH1750_RecvByte *Function function: I2C bus reads a byte *Function parameter: None *Return value: dat ***********************************************************************/ unsigned char BH1750_RecvByte() { unsigned char i; unsigned char dat = 0; SDA = 1; //Enable internal pull-up, prepare to read data, for (i=0; i<8; i++) //8-bit counter{ dat <<= 1; SCL = 1; //Pull up the clock line Delay5us(); //Delay dat |= SDA; //Read data SCL = 0; //Pull down the clock line Delay5us(); //Delay } return dat; } /****************************************************************************** *Function name: Single_Write_BH1750 *Function function: BH1750 single byte write *Function parameter: None *Return value: None*******************************************************************/ void Single_Write_BH1750(unsigned char REG_Address) { BH1750_Start(); //Start signal BH1750_SendByte(SlaveAddress); //Send device address + write signal BH1750_SendByte(REG_Address); //Internal register address, please refer to Chinese pdf page 22//BH1750_SendByte(REG_data); //Internal register data, please refer to Chinese pdf page 22 BH1750_Stop(); //Send stop signal } /****************************************************************************** *Function name: Single_Read_BH1750 *Function function: BH1750 single byte read *Function parameter: None *Return value: None *************************************************************************/ /* unsigned char Single_Read_BH1750(uchar REG_Address) { unsigned char REG_data; BH1750_Start(); //Start signal BH1750_SendByte(SlaveAddress); //Send device address + write signal BH1750_SendByte(REG_Address); //Send storage unit address, starting from 0 BH1750_Start(); //Start signal BH1750_SendByte(SlaveAddress+1); //Send device address + read signal REG_data=BH1750_RecvByte(); //Read register data BH1750_SendACK(1); BH1750_Stop(); //Stop signal return REG_data; } */ /************************************************************************** *Function name: Init_BH1750 *Function function: BH1750 initialization *Function parameter: None *Return value:None************************************************************************/ void Init_BH1750() { Single_Write_BH1750(0x01); } void BH1750_DataAlter(unsigned int temp_data) // Convert data into units, tens, hundreds, thousands, and ten thousand { wan=temp_data/10000+0x30 ; temp_data=temp_data%10000; //Remainder operation qian=temp_data/1000+0x30 ; temp_data=temp_data%1000; //Remainder operation bai=temp_data/100+0x30 ; temp_data=temp_data%100; //Remainder operation shi=temp_data/10+0x30 ; temp_data=temp_data%10; //Remainder operation ge=temp_data+0x30; } void Multiple_read_BH1750(void) { unsigned char i; BH1750_Start(); //Start signal BH1750_SendByte(SlaveAddress+1); //Send device address + read signal for (i=0; i<3; i++) //Continuously read 6 address data and store in BUF { BUF = BH1750_RecvByte(); //BUF[0] stores the data in address 0x32if (i == 3) { BH1750_SendACK(1); //The last data needs to return NOACK } else { BH1750_SendACK(0); //Response ACK } } BH1750_Stop(); //Stop signal delay_nms(5); } void Disposal_BH1750() { Single_Write_BH1750(0x01); // power on Single_Write_BH1750(0x10); // H-resolution mode delay_nms(180); // Delay 180ms Multiple_read_BH1750(); // Continuously read data and store in BUF} [/code]


图片1.png (115.05 KB, downloads: 0)

图片1.png

图片2.png (16.21 KB, downloads: 0)

图片2.png

图片3.png (82.95 KB, downloads: 0)

图片3.png

图片5.png (90.99 KB, downloads: 0)

图片5.png

TIM图片2.jpg (109.41 KB, downloads: 0)

TIM图片2.jpg

TIM图片3.jpg (116.72 KB, downloads: 0)

TIM图片3.jpg

TIM图片4.jpg (86.67 KB, downloads: 0)

TIM图片4.jpg

图片6.png (94.63 KB, downloads: 0)

图片6.png
This post is from DIY/Open Source Hardware

Latest reply

Sunlight is different from lamps. It is parallel light. If the photodiodes are also placed in parallel, the resistance values will be the same.  Details Published on 2018-12-12 19:18
 

1w

Posts

204

Resources
2
 
Looks good, how does it work?
This post is from DIY/Open Source Hardware
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle

Comments

I took a video, but it's too big to upload. I used lights to simulate the sun, and the effect was very good. When I actually tracked the sun, the solar panels swung greatly because of clouds or obstructions in the sky. I plan to add time later to control the rotation of the stepper motor more accurately according to the time of day and season. I also plan to  Details Published on 2018-9-13 11:21
 
 

693

Posts

7

Resources
3
 
okhxyyo posted on 2018-9-13 10:55 It looks good, how is the effect?
I took a video, but the video is too big to upload. The effect is very good when I use lights to simulate the sun. When actually tracking the sun, because there are clouds or obstructions in the sky, the solar panels will swing greatly. I plan to add time later to control the rotation of the stepper motor more accurately according to the time of day and season. I also plan to change the stepper motor to a better one.
This post is from DIY/Open Source Hardware

Comments

You can put the video on Youku or iQiyi, and then put the link here. There is a special video and flash button. You can play it then.  Details Published on 2018-9-13 13:38
 
 
 

693

Posts

7

Resources
4
 
okhxyyo posted on 2018-9-13 10:55 It looks good, how is the effect?
I took a video, but the video is too big to upload. The effect is very good when I use lights to simulate the sun. When actually tracking the sun, because there are clouds or obstructions in the sky, the solar panels will swing greatly. I plan to add time later to control the rotation of the stepper motor more accurately according to the time of day and season. I also plan to change the stepper motor to a better one.
This post is from DIY/Open Source Hardware
 
 
 

3980

Posts

0

Resources
5
 
Good! However, the current structural cost far exceeds that of photovoltaic panels and is no longer economically viable.
This post is from DIY/Open Source Hardware
 
 
 

3980

Posts

0

Resources
6
 
This post was last edited by PowerAnts on 2018-9-13 13:19 The bidding price of the State Grid has fallen below 2 yuan/w, and a 2 square meter 300w component is only 600 yuan. The Sunflower system has increased the power generation by 30% at best. A 200 yuan tracker cannot prove its reliability and wind resistance.
This post is from DIY/Open Source Hardware

Comments

I just played it out of interest, and it was very low-level, I didn't consider any commercial profit  Details Published on 2018-9-13 14:35
 
 
 

1w

Posts

204

Resources
7
 
bqgup posted on 2018-9-13 11:21 I took a video, but it was too big to upload. I used lights to simulate the sun, and the effect was very good. When I actually tracked the sun, because there were clouds or obstructions in the sky, ...
You can put the video on Youku or iQiyi, and then put the link here. There is a special video and flash button. You can play it then.
This post is from DIY/Open Source Hardware
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
 
 
 

693

Posts

7

Resources
8
 
PowerAnts published on 2018-9-13 13:18 The bidding price of the State Grid has fallen below 2 yuan/w, and a 2 square meter 300w component is only 600 yuan. The Sunflower system has increased the power generation by 30% at best. A 200 yuan tracker is not...
I just played it out of interest, and it was very low-end. I didn't consider any commercial profit.
This post is from DIY/Open Source Hardware

Comments

I don't mean to question your motives, I just point out the current situation of the industry.  Details Published on 2018-9-13 20:27
 
 
 

419

Posts

1

Resources
9
 
Want to know how the mechanical structure between the solar panel and the motor is connected? Looking at the picture, can the solar panel only rotate 360 degrees horizontally?
This post is from DIY/Open Source Hardware

Comments

1. Tilt the solar panel to a certain angle to receive the most sunlight. I roughly measured that the angle between the solar panel and the ground is 39 degrees. 2. Install the bracket to raise the rotating shaft of the stepper motor, and then graft the solar panel on it. 3. Place the light intensity module around the solar panel. Solar energy  Details Published on 2018-9-13 16:32
Personal signature君应有语,渺万里层云,千山暮雪,知向谁边?
 
 
 

693

Posts

7

Resources
10
 
My student number was posted on 2018-9-13 15:00 I want to know how the mechanical structure between the solar panel and the motor is connected? Looking at the picture, can the solar panel only rotate 360 degrees horizontally?
1. First tilt the solar panel to a certain angle to receive the maximum sunlight. I roughly measured it here. The angle between the solar panel and the ground is 39 degrees. 2. Install the bracket on the rotating shaft of the stepper motor to raise it, and then graft the solar panel on it. 3. Place the light intensity module around the solar panel. The angle between the solar panel and the ground is fixed at 39 degrees, and then the solar panel rotates 360 degrees following the motor.
This post is from DIY/Open Source Hardware

Comments

One-dimensional tracking  Details Published on 2018-9-13 22:41
One-dimensional tracking  Details Published on 2018-9-13 20:32
 
 
 

3980

Posts

0

Resources
11
 
bqgup posted on 2018-9-13 14:35 I just played it out of interest, and it was very low-level, I didn't consider any commercial profit
I don't mean to question your motives, I just point out the current situation of the industry
This post is from DIY/Open Source Hardware
 
 
 

3980

Posts

0

Resources
12
 
bqgup published on 2018-9-13 16:32 1. Tilt the solar panel to a certain angle to receive the maximum sunlight. I roughly measured it here and found that the angle between the solar panel and the ground is 39 degrees. 2. ...
One-dimensional tracking
This post is from DIY/Open Source Hardware
 
 
 

419

Posts

1

Resources
13
 
bqgup posted on 2018-9-13 16:32 1. First tilt the solar panel to a certain angle to receive the maximum sunlight. I roughly measured it here. The angle between the solar panel and the ground is 39 degrees. 2. ...
OK, thank you
This post is from DIY/Open Source Hardware
Personal signature君应有语,渺万里层云,千山暮雪,知向谁边?
 
 
 

189

Posts

0

Resources
14
 
You need to consider the conditions on cloudy and rainy days, as well as at night.
This post is from DIY/Open Source Hardware

Comments

I added a battery, and during the day, I used solar energy to convert it into electricity to charge the small battery. I bought the wrong battery, and the capacity was very small. But the charging circuit didn't seem to be designed well, so I didn't do it.  Details Published on 2018-9-15 10:50
Personal signature单片机软件/硬件交流群:127034610
 
 
 

693

Posts

7

Resources
15
 
liushiming82 posted on 2018-9-15 09:31 It is necessary to consider the conditions of cloudy and rainy days, as well as the conditions at night
I added a battery, and during the day, I used solar energy to convert it into electricity to charge the small battery. I bought the wrong battery, and the capacity was very small, but the charging circuit seemed to be not designed well, so I didn't do it.
This post is from DIY/Open Source Hardware

Comments

Photovoltaic cells need MPPT to charge secondary batteries, otherwise the efficiency is relatively poor  Details Published on 2018-9-15 19:12
 
 
 

3980

Posts

0

Resources
16
 
bqgup posted on 2018-9-15 10:50 I added a battery and used solar energy to convert it into electricity to charge the small battery during the day. I bought the wrong battery, which has a very small capacity, but the charging...
Photovoltaic cells need MPPT to charge secondary batteries, otherwise the efficiency is relatively poor
This post is from DIY/Open Source Hardware
Personal signature

YesWatt艺瓦特电子科技有限公司 傻大粗电源转换器制造商 https://apu5ob0ydv0ysskfm03hs4dtqfr97j68.taobao.com/

 
 
 

1310

Posts

3

Resources
17
 
The OP, please recommend a PDF that calculates the sun's position https://www.nrel.gov/docs/fy08osti/34302.pdf
This post is from DIY/Open Source Hardware
 
 
 

869

Posts

0

Resources
18
 
Good, it's a rare and powerful post.
This post is from DIY/Open Source Hardware
 
 
 

88

Posts

0

Resources
19
 
Very good, very powerful. Learned.
This post is from DIY/Open Source Hardware
 
 
 

403

Posts

6

Resources
20
 
Good, I have learned something. A few years ago, I also bought a 15W solar panel. It has been idle for a long time. I will take it out and tinker with it when I have time.
This post is from DIY/Open Source Hardware

Comments

Sure, sure. Then add a battery to store the solar power. If you are interested, you can also make a power inverter to convert 12V to 220V. That would be awesome.  Details Published on 2018-9-17 09:18
Personal signature如果天空是黑暗的,那就摸黑生存;如果发出声音是危险的,那就保持沉默...但不要习惯了黑暗就为黑暗辩护;不要为自己的苟且而得意;不要嘲讽那些比自己更勇敢热情的人们。人可以卑微如尘土,不可扭曲如蛆虫。
 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list