​ ​ ​ ​ auto camera pointing - Page 3
Page 3 of 4 FirstFirst 1 2 3 4 LastLast
Results 21 to 30 of 36

Thread: auto camera pointing

  1. #21
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    23,403

    Default

    Quote Originally Posted by Satchid View Post
    But how do I translate adc input (0 to 250) into steps. Just a short hint could help me.

    ex: if it is 125 is middle. Then 62 would be 50 steps less, and 187 would be 50 steps more. is it done with a fore next loop or so?
    It will simply be maths. A pot can have position 0 to 1023. Your stepper will have MAX_STEPS steps per maximum amount of movement. So you can determine for a particular P percentage ...

    MAX_ADC * ( P / 100 ) * K = MAX_STEPS * ( P / 100 )

    MAX_ADC * K = MAX_STEPS

    IF MAX_ADC is 1023 ( for READADC10 ) and there are say 2880 steps for full movement -

    K = MAX_STEPS / MAX_ADC

    K = 2880 / 1023

    STEP_POS = ADC * ( 2880 / 1023 )

    Mathematically ...

    STEP_POS = ADC * ( 2880 / 1023 )
    STEP_POS = ADC * 2.8152492668621700879765395894
    STEP_POS = ADC * ( 2 + 0.8152492668621700879765395894 )
    STEP_POS = ( ADC * 2 ) + ( ADC * 0.8152492668621700879765395894 )
    STEP_POS = ( ADC * 2 ) + ( ADC * Int( 0.8152492668621700879765395894 * 65536 ) / 65536 )
    STEP_POS = ( ADC * 2 ) + ( ADC * 53427 / 65536 )
    STEP_POS = ( ADC * 2 ) + ( ADC ** 53427 )

    PICAXE implementation ...

    STEP_POS = ADC * 2
    STEP_POS = ADC ** 53427 + STEP_POS

  2. #22

    Default

    Quote Originally Posted by PieM View Post
    No absolute position on steppermotor.

    from where ?
    I will have a centerposition at 125 This is set at the start to be the middle mechanicaly by means of a home switch.

    It is like that on my CNC machine as well. At startup the motor will be homing into homeswitches and set the home position as 125. Then do the rest.

    But wat can I use, proram loop: repeating with counting loops, pwm, for next loop.
    The propblem is that the potmeter is never going to be at ease and waiting for the loop to be finished, it will be constantly moving left and right. Mosty in small angles but sometimes in a big angle.

  3. #23
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    23,403

    Default

    If you have a centre position of 125, presumable 250 steps to cover the full range of stepper motion (0-250), and read your pot with READADC10 (0-1023) -

    Mathematically ...

    STEP_POS = ADC * ( 250 / 1023 )
    STEP_POS = ADC * 0.2443792766373411534701857283
    STEP_POS = ADC * Int( 0.2443792766373411534701857283 * 65536 ) / 65536
    STEP_POS = ADC * 16015 / 65536
    STEP_POS = ADC ** 16015

    Implementation...

    STEP_POS = ADC ** 16015

  4. #24

    Default

    [QUOTE=hippy;
    STEP_POS = ( ADC * 2 ) + ( ADC * 53427 / 65536 )
    STEP_POS = ( ADC * 2 ) + ( ADC ** 53427 )

    PICAXE implementation ...

    STEP_POS = ADC * 2
    STEP_POS = ADC ** 53427 + STEP_POS [/QUOTE]

    I do understand wat you do till this point, but I do not understand wat you are doing here. Allso wath is ** doing there?

    Thanks

  5. #25
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    23,403

    Default

    Quote Originally Posted by Satchid View Post
    I do understand wat you do till this point, but I do not understand wat you are doing here.
    It is basically converting a 'multiply by a less than 1' number into something the PICAXE can understand. For example one cannot do A = B * 0.5 with PICAXE maths.

    However one can multiply by a number and then divide by that same number and get the same result. If we choose 65536 as the number to multiply and divide by -

    A = B * 0.5

    A = B * ( 0.5 * 65536 ) / 65536

    A = B * 32768 / 65536

    then ...

    Quote Originally Posted by Satchid View Post
    Allso wath is ** doing there?
    A = B ** 32768 is the equivalent of A = B * 32768 / 65536 while avoiding overflow.

  6. #26

    Default

    Hippy,
    Here is a litle program to find steps and dir. At the end I have "steps_to_go" (w5) the number of steps that the motor needs to move and "dir" the direction.
    Would you think this can work?
    what if the potentiometer changes before motor is at the end of previous move?
    Now How do I pulse this out to the stepper.

    Code:
    main:
    
    symbol old_adc	   = w0
    symbol new_adc	   = w1
    symbol oldstep_pos   = w2
    symbol newstep_pos   = w3
    symbol temp_step_pos = w4
    
    symbol steps_to_go   = w5  
    symbol dir  	   = c.1
    symbol steps          = c.2
    	old_adc = new_adc
    start:
    	Readadc 0, new_adc	;readadc becomes readadc10 before uploading, read position of potmeter, place in New_adc
    
    ;CALCULATING STEPS AND DIRECTION
    	if new_adc = old_adc then goto start 		;if new & old-adc are the same, then do noting
    	temp_STEP_POS = new_ADC * 2 				;calculate stepper_pos related to potentiometer part 1
    	pause 5							;pause can be removed before uploading to picaxe
    	NEWSTEP_POS = new_ADC ** 53427 + temp_STEP_POS 	;calculate stepper_pos related to potentiometer part 2
    	old_adc = new_adc 					;remember value of new_adc in old_adc
    	pause 5							;pause can be removed before uploading to picaxe
    	If oldstep_pos < newstep_pos Then move_left 	;see for left or right
    	If oldstep_pos > newstep_pos Then move_right	;see for left or right
    move_left:
    	High dir						;set direction of steppermotor
    	steps_to_go = Newstep_pos - oldstep_pos	;calculate number of teps from previous position
    	newstep_pos = oldstep_pos			;set new oldstep_pos
    goto start	
    	
    move_right:
    	Low dir						;set direction of steppermotor				
    	steps_to_go = oldstep_pos - Newstep_pos	;calculate number of teps from previous position
    	newstep_pos = oldstep_pos			;set new oldstep_pos
    goto start

  7. #27
    Senior Member
    Join Date
    Jan 2010
    Location
    34 France
    Posts
    3,783

    Default

    Would you think this can work?
    No, of course!
    what if the potentiometer changes before motor is at the end of previous move?
    Here is the problem. Sorry but you need a feedback from motor or load position. Or use a servomotor.

    See:
    http://www.tigertek.com/servo-motor-...p-systems.html
    http://engineering.electrical-equipm...p-systems.html
    S'il n'y a pas de solution, c'est qu'il n'y a pas de problme . (Les Shadoks)

  8. #28
    Senior Member
    Join Date
    Jan 1970
    Location
    Colorado USA
    Posts
    3,003

    Default

    And add PID functions...

  9. #29

    Default

    Quote Originally Posted by erco View Post
    Wish you you would have asked first. Two laser sensors with overlapping fields of view interfere with each other. What may work (untested) is to multiplex them so only one laser is on at a time. In that case you would align lasers in some pattern as I did with that Hamamatsu laser sensor in my laser tracker videos.
    Erco,
    Thanks for warning me.

    Then, I would like to use 2 of them with a beacon instead of using the laser.

    I wouls put a plate about 20 cm long, Then on both sides of tha plate a laser sensor (laser switched of) and then an IR beacon maximum 4meters away. the received sigal would then be compared in the picaxe and the camera is then turned to corespond.

    BUT, I read somwhere in one of your many projects that the receiver was not responding to a other IR. You mentioned something of 180Khz or so.

    Should I modulate the beacon to that frecuency in order to be received by the receiver?

    Can I use that allso to make my IR LED pulsed in order to send high curent to the laser to incerase the light intensity?

    Thanks,

    Willy

  10. #30

    Default

    Quote Originally Posted by PieM View Post
    No, of course!
    Here is the problem. Sorry but you need a feedback from motor or load position. Or use a servomotor.
    I am not sending a coplete movement to the motor, but pulses, after each pulse i will look afgain If a further move is needed.

    here is a program shematic (using a dc motor.)

    read value 1,
    read value 2
    comaprair 1 & 2
    set direction if 1<2 left
    set direction if 1>2 right
    is difference is verry low, do nothing
    if difference is low, then high, pause1, low c.2 pause1 is small.
    if difference is medium, then high, pause2, low c.2 pause2 is medium
    if difference is high, then high, pause3, low c.2 pause3 is big.


    This way the dc motor will turn in a pulsed way longer or shorter in acordance with the pause1 2 or 3.

    After every pulse the is a new test for position.

Bookmarks

Posting Permissions

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