solar tracker controller


Closed Thread
Results 1 to 40 of 42

Hybrid View

  1. #1
    Join Date
    Mar 2011
    Posts
    6


    Did you find this post helpful? Yes | No

    Smile Re: solar tracker controller

    "The line begining with "Start", the first thing the program goes is disable the motor outputs....."

    i think that can be apply to my proramming.... the function is just like the proramming ioannis write....

    greater: 'greater routine
    b2 = b0 - b1 'find the difference
    if b2 > 10 then cw 'is it within the range? if not go to clockwise/ solar panel facing west
    low PORTB.0 'pin portb.0 low /stopping the solar panel for moving
    low PORTB.1 'pin portb.1 low / stopping the solar panel for moving
    goto start 'if it is in the range,do it again

    lesser: 'lesser routine
    b2 = b1 - b0 'find the difference
    if b2 > 10 then ccw 'is it within the range? if not got counter clockwise/solar panel facing east
    low PORTB.0 'pin portb.0 low /stopping the solar panel for moving
    low PORTB.1 'pin portb.1 low / stopping the solar panel for moving
    goto start 'if it is in the range, do it again

    so what the suitable timing for the pause...?

    i not try it yet to the motor....
    i am currently doing the circuit.... and now try to assemble the circuit with the lcd....
    i need to add command for lcd in the proramming ....

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: solar tracker controller

    Quote Originally Posted by muzakyo View Post
    "so what the suitable timing for the pause...?
    Well, I personally leave the motor on untill the sensors are indicating that there is no more indifference. I also start a timer each time the motors are started and check it for a timeout condition.

  3. #3
    Join Date
    Mar 2011
    Posts
    6


    Did you find this post helpful? Yes | No

    Smile Re: solar tracker controller

    i think i will follow Ioannis idea about the programming of the motor....
    also such as dave said...... stop only there are indifference in Cds value.....

    this is the proramming for the LCD



    TRISA = 1 'Set all PORTA pins as inputs (Cds)
    TRISc = 0 'Set all PORTc pins as outputs (motor)
    TRISD = 0 'Set all PORTD pins as outputs (LCD)
    TRISB = 1 'Set all PORTD pins as outputs (limit switch)

    start:

    pot porta.0,255,v1 'Read 1st CdS Sensor (east)
    pot porta.1,255,v2 'Read 2nd CdS Sensor (west)


    'LCD display
    Serout 1,4,[254, 1] 'Clear Screen
    Pause 25
    Serout portd.1,1,["Cds 1 = "] 'display Cds 1 =
    Serout portd.1,1,[#v1] 'display value Cds 1
    Serout 1,1,[254,192] 'Move cursor to first position on second line
    Pause 5
    Serout portd.2,1,["Cds 2 = "] 'display Cds 2 =
    Serout portd.2,1,[#v2] 'display value Cds 1
    Pause 100 'display the Cds value for a little time


    my problems is there are 4 output for the lcd so i dont know where to put this programming that only have two output.....?

    detail lcd
    16 x 2 characters LCD display
    With yellow backlight
    Built in controller (HD44780 or equivalent)

    http://www.cytron.com.my/usr_attachm..._Schematic.pdf
    Last edited by muzakyo; - 4th March 2011 at 16:19.

  4. #4
    Join Date
    Mar 2011
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: solar tracker controller

    v1 var byte 'variable v1
    v2 var byte 'variable v2
    v3 var byte 'variable v3

    TRISA = 1 'Set all PORTA pins as inputs (Cds)
    TRISB = 1 'Set all PORTB pins as outputs (limit switch)
    TRISC = 0 'Set all PORTC pins as outputs (motor)

    start:
    pot porta.0,255,v1 'Read 1st CdS Sensor (east)
    pot porta.1,255,v2 'Read 2nd CdS Sensor (west)

    if v1 <= 230 then skp 'start program
    if v2 > 230 then slp 'is it dark enough to sleep? (sleep mode)

    skp:
    if v1 = v2 then start 'If equal, do nothing
    if v1 > v2 then greater 'If greater, check how much greater
    if v1 < v2 then lesser 'If lesser, check how much lesser

    if PORTB.1 = 0 then face_east 'limit switch1
    if PORTB.2 = 0 then hold 'limit switch2

    greater: 'greater routine
    v3 = v1 - v2 'find the difference
    if v3 > 10 then cw 'is it within the range? if not go to clockwise/ solar panel facing west
    low PORTC.0 'pin portb.0 low /stopping the solar panel for moving
    low PORTC.1 'pin portb.1 low / stopping the solar panel for moving
    goto start 'if it is in the range,do it again

    lesser: 'lesser routine
    v3 = v2 - v1 'find the difference
    if v3 > 10 then ccw 'is it within the range? if not got counter clockwise/solar panel facing east
    low PORTC.0 'pin portb.0 low /stopping the solar panel for moving
    low PORTC.1 'pin portb.1 low / stopping the solar panel for moving
    goto start 'if it is in the range, do it again

    slp:
    low PORTC.0 'stopping the solar tracker for moving
    low PORTC.1 'stopping the solar tracker for moving
    sleep 1800 'sleep the system for half an hour
    goto start

    cw: 'Turn the sensor array clockwise
    high PORTC.0 'Turn on h-bridge
    pause 100 'Let it turn for a moment
    goto start 'Check again

    ccw: 'Turn the sensor array counter clockwise
    high PORTC.1 'Turn on h-bridge
    pause 100 'Let it turn a moment
    goto start 'Check again

    face_east: 'facing east
    low PORTC.0 'pin portb.0 low /stopping the solar panel for moving
    low PORTC.1 'pin portb.1 low / stopping the solar panel for moving
    sleep 14400 'wait for 4 hours
    high PORTC.1 'pin portb.1 high /solar panel back facing east ready for next day sun shine
    pause 1000 'wait for 1 sec
    goto start 'check again

    hold:
    low PORTC.0 'pin portb,0 low / stopping the parabolic for moving
    low PORTC.1 'pin portb.1 low /
    sleep 3600 'wait for 1 hour
    goto start
    end



    WHY THIS PROGRAMMING CANNOT BE COMPILE....
    WARNING - THE MICROCHIP ASSEMBLER (MPASM)ONLY ALLOW 62 CHARACTER TO BE USED FOR PATH AND FILE NAME. CURRENT LENGTH IS 68 CHARACTERS....

    I DONT UNDERSTAND..... PLEASE ANYONE EXPLAIN TO ME....?

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: solar tracker controller

    Maybe you have not noticed but you CAPs lock seems to be stuck on.

    The waring message means exactly what it says.
    Move you project directory closer to the root of the drive so there are less than 62 characters between "C" and the end of your file name.
    C:\myProject\xxx.bas
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Microstepper controller
    By aratti in forum Schematics
    Replies: 14
    Last Post: - 3rd January 2015, 16:52
  2. Replies: 14
    Last Post: - 6th March 2011, 05:08
  3. Replies: 2
    Last Post: - 14th July 2008, 22:11
  4. Fridge controller
    By nomad in forum General
    Replies: 4
    Last Post: - 23rd February 2008, 07:13
  5. Dedicated LCD Controller question
    By chuckles in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th February 2006, 14:44

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts