auto camera pointing

Satchid

Member
@Erco,

Your post http://www.picaxeforum.co.uk/showthread.php?30093-Steering-a-dolly-by-means-of-a-black-line-lt&p=312320&viewfull=1#post312320 g-ave me alot of info. Thank you for that.

to erco et all
I have made a line following platform so that I can place a camera tripod on it. The camera is suppose to point towards a static subject wile it is moving around it in a somewhat circular manner.

It is therefore that the camera has to turn around its axis in order to keep view on the subject as stable as posible.

So, I planned to put a beacon of some kind, 2 feet above the subject. Then I need a sensing device about 2 feet above the camera. the sensor should keep the camera pointing towards the subject by means of a stepper or servo motor build under the camera on the tripod. I have a stepper motor, a servo motor I have to purchase if i would use it.

In a post from Erco in an other thread, I found maybe a possible solution (here the post) http://www.picaxeforum.co.uk/showthread.php?30093-Steering-a-dolly-by-means-of-a-black-line-lt&p=312320&viewfull=1#post312320 )

I like the one with the 38 or 56 Khz beacon.


I suppose 2 sensors on top off the camera and one beacon above the object.

Question: what would the code look like? would it be similar of a line follower?


Thanks,
Willy
 

techElder

Well-known member
Be sure to provide a way to shut this system off before you shoot.

You camera systems probably contain optical systems that could misread your pointing system.

Unless you're using some old school photography!
 

hippy

Technical Support
Staff member
It may be possible to use the video feed from the camera to analyse frames and do the tracking but that would require something beyond the scope of a PICAXE. There some systems which already do that, including -

http://1beyond.com/autotracker

I believe Wii controllers include an IR sensor which can track multiple IR sources which might provide a means of tracking a person or object which could possibly be used with a PICAXE.

This is one of those projects where the simple back of a napkin 'track a line on the floor and keep the camera pointed at an object' specification belies all the complexity of doing that. I also believe there is intended to be autonomous repeatability layered on top which adds to the complexity.

I am sure Hollywood has a solution for achieving the end result required but I doubt it is either cheap or would use a PICAXE.
 

Satchid

Member
I am sure Hollywood has a solution for achieving the end result required but I doubt it is either cheap or would use a PICAXE.
Indeed Hippy, $5000 per day for rental. complete repeatability. My pocket is to small for even keeping the bill.
 

Satchid

Member
I puchased 4 laser modules as in Erco's post http://www.picaxeforum.co.uk/showthread.php?29407-infra-red-range-sensor&p=304311&viewfull=1#post304311

What would i use as reflector that can reflect in all directions? Could I use an IR led modulated at 180Khz. Can the picaxe 28x2 make this pulsetrain for the IR led?

Then I will start with 3 laser modules and use a linefollowing code.

Like: left- middle- and right laser. Let it go right if the left laser hit the reflector and let it go left if the red laser hit the sensor. (no up and down is needed)

I will see later what I need reprograming to have the camera not to oscilate.
 

AllyCat

Senior Member
Hi,

I will see later what I need reprograming to have the camera not to oscilate.
Don't overlook that a servo (used with a PICaxe) has at most only 150 "directions" (byte values 75 - 225) so can only resolve the direction to about 1 degree (that's a lot in photographic terms). Also, the servo position is sometimes reported to "dither" or "jitter", even when a constant value is set by the program.

Using PULSEOUT might improve the resolution, but perhaps with the risk of more dither. Of course a mechanical linkage may help (by reducing the sweep angle) or there are "continuous rotation" servos, but they are basically just a geared dc motor and speed control electronics in a single "box", with a rather usuitable interface protocol.

IMHO you probably need "Power and Speed" for steering (line following) and "Accuracy and Stability" for the camera panning, so I would use a Servo for steering and a (geared) Stepper motor for camera panning. Then you would need "Servo Line-Follower" type program code for steering and "Stepper Line/source-Follower" code for the Camera Panning. ;)

Cheers, Alan.
 
Last edited:

premelec

Senior Member
Retroreflector, corner reflector 3m "scotch light" with some provision for proportionate change in intensity when off angle to make tracking correction... not trivial ;-0
 
Last edited:

erco

Senior Member
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.
 

oracacle

Senior Member
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.
did some one make and "auto turret" type thing based on this idea using S9686 (or similar) and some lasers? It had 2 servos to keep track of a piece of reflective tape.

Found it:
http://www.picaxeforum.co.uk/showthread.php?26523-Laser-Tracker-Pan-amp-Tilt&highlight=S6986
another one your as it turns out erco.

It would need some work to make it smooth but I suppose the ground work is there.
 
Last edited:

Satchid

Member
channels.PNG
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.
Thank you Erco,
If that is not working, Could I do the following:

I am making a tunnel thing made from 6 thin aluminium plates of 3cm by 4.5cm, I put these plates in a stack and put a 3mm spacer between each of them on the 3cm edge and glue that together. Now I have 5 channels of 4cm high 3mm wide and 3cm deep as shown in the picture above. To eliminate the reflections inside de channels, I will smoke the inside with the smoke of burning vegetable oil. Now I place this so that the target is only visible trough the middle rectangle opening aligned with the centre of the camera. We it turns a little out of direction, then the target is lost in the middle opening but seen in the second opening left or right from the centre opening. Behind the middle 3 openings I place 3 of the laser sensors. I will (because of the interference mail), let only the middle laser active and deactivate the 2 other lasers. Erco I hope that the 3 receivers are responsive to the one laser. Then I will (hope to) have:
high when middle sensor is on alone.
high when middle and left (right) receiver is on together
and high when left (right) receiver is on alone

This way I have 5 signals that i have to work with in the picaxe.

Could this work?

At the start I wil work with a stepper motor with as many microsteps as i can posably do. The rest I wil have to see.

Willy
 
Last edited:

erco

Senior Member
That's just what I would try, optical blinders/shutters to isolate each receiver's field of view. But you can only have one modulated laser emitter on, so you could either multiplex an array of lasers (switch one on at a time) or scan one laser back & forth with a servo.
 

Satchid

Member
Erco, I should have asked you this before,
In your massive experience, what would you experiment with? Only Panning is needed. The moves are rather slow. The max distance from camera to target is 3 meter.

C


Thank you so far.
Willy
 

Satchid

Member
Hallo everybody,
I am loocking for how to code a picaxe 28x2 to do the folowing:

I have a potensiometer connected to an analog input on the picaxe and an step and dir output to the stepperdriver.

Now, If the potensiometer turn 5°, then I want the steppermotor to turn allso 5°
If the potensiometer turns 10° back, then I want the steppermotor likewise turn 10° back.



Thanks,

Willy
 

hippy

Technical Support
Staff member
Now, If the potensiometer turn 5°, then I want the steppermotor to turn allso 5°
If the potensiometer turns 10° back, then I want the steppermotor likewise turn 10° back.
From where the pot is you can determine where the stepper should be and then apply the required number of steps to move the stepper to that position.
 

PieM

Senior Member
Now, If the potensiometer turn 5°, then I want the steppermotor to turn allso 5°
If the potensiometer turns 10° back, then I want the steppermotor likewise turn 10° back.
You need a feedback with a potensiometer or absolute encoder on the steppermotor shaft.
 

Satchid

Member
From where the pot is you can determine where the stepper should be and then apply the required number of steps to move the stepper to that position.

Thanks Hippy,
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?

Thanks,
Willy
 

hippy

Technical Support
Staff member
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
 

Satchid

Member
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.
 

hippy

Technical Support
Staff member
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
 

Satchid

Member
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 said:
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
 

hippy

Technical Support
Staff member
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 ...

Allso wath is ** doing there?
A = B ** 32768 is the equivalent of A = B * 32768 / 65536 while avoiding overflow.
 

Satchid

Member
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
 

PieM

Senior Member

Satchid

Member
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
 

Satchid

Member
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.
 

erco

Senior Member
OK, so you swapped the stepper motor to a DC gearmotor? Good change. You need a SLOW gearmotor (at least 100:1) so you can turn on your motor H-bridge with a high command, then immediately check your sensors as your are moving, then stop the motor when your sensors say centered. You won't need PID if everything moves fairly slowly.
 

Satchid

Member
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
Erco, I was wondering for wat you have to say about this.
 

erco

Senior Member
Not sure I understand. You want to use two laser sensors with no laser separatd d by a plate to detect an IR beacon? Where did that idea come from? What beacon? I'd just use two simple 38 khz IR receivers to detect a 38 kHz IR beacon.
 

Buzby

Senior Member
I wouldn't bother with any of these lasers, IRs, beacons, baffles, etc.

If your camera is following a pre-programmed route, then a bit of trig will give you the direction to point the camera at each position on the route.

Pre-calculate the points beforehand, then just play them back.

Cheers,

Buzby
 

Satchid

Member
two simple 38 khz IR receivers to detect a 38 kHz IR beacon

Not sure I understand. You want to use two laser sensors with no laser separatd d by a plate to detect an IR beacon? Where did that idea come from? What beacon? I'd just use two simple 38 khz IR receivers to detect a 38 kHz IR beacon.
Erco, That Is exactly wat I wanted to do. But I have wrongly purchased these waveshare laser sensors modules, I wanted to use the sensor alone in the configuration that you described (in stead of the two simple 38 khz IR receivers). But allso that is not going to work because i found out that these receivers are only giving a digital signal. 0 and 1.

So I am now going to try it with two simple 38 khz IR photo transistors to detect a 38 kHz IR beacon as you sugest. Ill let you know.

Willy
 

erco

Senior Member
You want 3-pin black or metal IR receiver modules, not phototransistors. If your IR beacon is sending a steady (unmodulated) 38 kHz IR carrier then you need "continuous signal compatible" 38 khz receiver modules. Most aren't. Get some TSSP4038 modules: https://www.vishay.com/docs/82458/tssp40.pdf . They go low and stay low when a steady 38 khz signal is received. Others will only go low for a quarter second or so.

For ordinary receiver modules, you need a modulated IR beacon signal, and your receivers will have to COUNT pulses to verify detection. Schematic attached.
 

Attachments

Satchid

Member
Tank you Erco,
I just received the tssp40 receiver and the tsal 6200 IR led's. I want to use pwmout on an axe117 board to make the 38Khz so I do not have to make a new circuit.
I looked at the data sheet of the tsal 6200 and think that it can use 100ma on it continuously. http://80.93.56.75/pdf/0/1/8/5/2/01852077.pdf
Can I therefore go to 200ma on that LED if I use 50% duty cycle? pwmout B.2, 25, 51 ; 38000Hz at 50% @ 4MHz
I need 180° radiation angle and therefore I place LED's at 12° in a half circle, 15 total. I will have plenty current if I use the ULn2003a on the axe117 board. That is capable of delivering 500ma per channel and the channels can be paralleled at the input to deliver a total of 15 tsal 6200 leds.

Thanks.

Willy
 

erco

Senior Member
Ordinary 5mm IR LEDs are plenty powerful at well under 20 mA. Sounds like you overbought.

I adjust range/sensitivity using PWM and series resistor. Too much IR is bad, untraceable reflections and overloading the receiver.
 

Satchid

Member
Hi,

@Erco: I have no experience with IR and therefore, I have purchased the tsal 6200 IR led thinking that I can adjust the power of it. It is also the led that is used in the data sheet of the tssp4038 IR receiver. I need a varying distance from ~ 4meter to ~1meter distance in different angles.

I will have to experiment with different led's, different currents and possibly more.

But how do I program this:

do I use IRIN? Do I use if pinc.1? or do I use readadc for getting the 1 or the 0 from the sensor in the program? I have no clue.

Is the IRIN command also working for a constant 38Khz stream?

A litle help could get me starting in this.

Willy
 

hippy

Technical Support
Staff member
But how do I program this:

do I use IRIN? Do I use if pinc.1? or do I use readadc for getting the 1 or the 0 from the sensor in the program? I have no clue
If using a TSSP4038, or an older TSOP4038, those can detect continuous IR modulated at 38kHz.

They include 33K output pull-up and outputs will be low when IR is detected, high when not. So just connect the output to a digital input pin then use the appropriate "pinX.Y" variable to determine if the signal on that pin is low or high, whether IR is detected or not.
 
Top