legal contact rss
 

I wanted to adjust the solarcells according to the sun position.

While not having found a reasonable price for an actuator with a stepper motor, I decided to use the usual linear actuator and try another trick.

The idea that inspired my work was the fact that two ldr's shoul be enough to find out if the suns position is optimal or not. If not optimal, adjust the angel of the cells by activating the actuator accordingly until the suns position, from reading the ldr's, is perfect.

the blockly script

var Differenz;

console.log('Start');console.log(formatDate(new Date(), 'hh:mm:ss'));// Initialisiere WertesetState('sonoff.0.PVrelay01.POWER1' /* PVrelay01  POWER1 */, false);setState('sonoff.0.PVrelay01.POWER1' /* PVrelay01  POWER1 */, false);Differenz = 0;// Only during daytimeif (compareTime('08:00', '20:00', 'between', null)) {  console.log('Daytime');  on({ id: [].concat(['sonoff.0.LDR01.ANALOG_Illuminance1']).concat(['sonoff.0.LDR01.ANALOG_Illuminance2']), change: 'ne' }, async (obj) => {    Differenz = (getState('sonoff.0.LDR01.ANALOG_Illuminance1').val + 7) - getState('sonoff.0.LDR01.ANALOG_Illuminance2').val;    console.log('Loop 1');    console.warn(Differenz);    if (Differenz != 0) {      if (Differenz > 0) {        console.warn('Up');        setState('sonoff.0.PVrelay01.POWER1' /* PVrelay01  POWER1 */, false);        setState('sonoff.0.PVrelay01.POWER2' /* PVrelay01  POWER2 */, true);      }      if (Differenz < 0) {        console.warn('Down');        setState('sonoff.0.PVrelay01.POWER1' /* PVrelay01  POWER1 */, true);        setState('sonoff.0.PVrelay01.POWER2' /* PVrelay01  POWER2 */, false);      }    } else {      console.error('Stop');      setState('sonoff.0.PVrelay01.POWER1' /* PVrelay01  POWER1 */, false);      setState('sonoff.0.PVrelay01.POWER2' /* PVrelay01  POWER2 */, false);    }  });}

Results

14:12:02.608infojavascript.0 (2102691) Start javascript script.js.common.PV_Anlage.follow_the_sun
14:12:02.621infojavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Start
14:12:02.621infojavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: 12:12:02
14:12:02.621infojavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Daytime
14:12:02.622infojavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: registered 2 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
14:12:16.095infojavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Loop 1
14:12:16.096warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: 1
14:12:16.096warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Up
14:12:16.102infojavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Loop 1
14:12:16.103warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: 2
14:12:16.103warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Up
14:12:26.418infojavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Loop 1
14:12:26.418warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: 3
14:12:26.418warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Up
14:12:26.422infojavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Loop 1
14:12:26.423warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: 1
14:12:26.423warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Up
14:12:36.099infojavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Loop 1
14:12:36.099warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: -2
14:12:36.100warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Down
14:12:46.148infojavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Loop 1
14:12:46.149warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: 1
14:12:46.149warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Up
14:12:56.104infojavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Loop 1
14:12:56.105warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: 3
14:12:56.105warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Up
14:13:11.788infojavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Loop 1
14:13:11.789warnjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: 0
14:13:11.789errorjavascript.0 (2102691) script.js.common.PV_Anlage.follow_the_sun: Stop
14:13:15.581infojavascript.0 (2102691) Stop script script.js.common.PV_Anlage.follow_the_sun