<< return to Pixycam.com

Problems getting pan/tilt demo to work

Hi,
Received my Pixy cam, thanks very much. I have managed to “teach” Pixy some colours / objects and run a program through Arduino however, when I run the pan / tilt demo either through Pixymon or Arduino I cannot get it to track or follow an object.
I am using my own servos which work fine in all other programs I have but when connected to Pixy they dis[aly very erratic behaviour. I cannot even get it to avoid the object.

Good lighting and quite clear recognition (75 “goodness”).

Any ideas?

Thanks

Hi Zed,

Have you tried using a shorter or higher quality USB cable? Longer/cheaper cables have a larger voltage drop (and more noise) across the cable and therefore the servos might not be getting sufficient power. Let me know if you’re able to try this.

Scott

Hi,
I’ve tried a couple of different USB cables and some better lighting / objects (100 “goodness”) and have achieved the following:

Through Pixymon I can get the tilt function to work on its own and follow an object. The Pan function does not work at all - only very erratic function, at times I though it may be doing the opposite and avoiding the object but this could be quite subjective as the motion was very erratic.

Through Arduino, I cannot get it to work at all! Hello world program runs and can track / report fine but no discernable output from the pan/tilt demo.

Another question, have you guys any experience in working Pixy with the Adafruit products? Im looking at using the motor shield v2 but this may disable use of the ICSP pins. What would you recommend?

Hi any update on this? It is very frustrating that the pan/tilt demo does not work. Any ideas on what else I could try? I have tried different servos, different cables and changing the lighting / objects. The only thing I can get to work is the tilt function through PixyMon, nothing else works when running this demo.
Through I2C on an Arduino I can get X & Y co-ordinates and run hello world but nothing else.

Thanks again.

Hi Zed, it sounds like your pan servo is bad? We can send you another one, but you might try swapping the pan and tilt servos to see if the problem follows the servo.

Regarding the Arduino tracking demo— you need to run the “default program” on the Pixy side. (not the “pan/tilt demo program”).

thanks!

Hi, Ive tried about 3 different servos on the pan output and same bad result for all of them. In other programs I have running they all work alright so I am skeptical that it is the servo at fault (doesnt mean Im wrong though!). Any other ideas on what I might try?

Zed

It could be a power problem. Running servos off of USB is great because you don’t need to replace batteries, but it’s tight, doesn’t have much voltage overhead. And the voltage on USB ports from computer to computer varies a little, which might affect things (just guessing)… Can you try to hook up a power supply (or batteries) to the unregulated input for testing purposes? (see this page http://cmucam.org/projects/cmucam5/wiki/Powering_Pixy)

Hi again, yes Ive tried to Pixy from a seperate dedicated power source (6VDC) as well as via USB but same response.

Hi Zed, trying to help… not sure what the deal is with the servos you’re using. You can check the PWM that Pixy’s providing if you like-- should be clean with good edges.

If you’re using these servos (the little blue ones with “Tower” on the side):

they suck. Sorry, but they really do suck.

Hi, you’re help is really appreciated. Hope I’m not being a PITA either :).

I am using the following servos.

I have also tried a SuperTec S03 which works with the tilt function but not pan.

Can you tell me how I would go about sharing the PWM that my Pixy is outputting?

Thanks again

Hi Zed,

I’m not an expert on the hardware side, but I’d think the best way is to use an oscilloscope. They can get pretty expensive, so you could try looking in to some of the USB o-scope alternatives. This would give you a visual of the PWM waveform that you could then share, if that’s what you’re looking for.

Scott

Hi all,
I have the same problem with the pan/tilt. I have looked at the signal using scope. I found the PWm signal period is 10 msec. and I know that the standard servo period is 20 ms. Initially it should stop at the middle and move left and write, but for me it starts from around 500 microsecond to 2 msec. Cna we change these parameters and how?

Ah, Muaiad, you’re right. I think you uncovered the problem that Zed is having.

Indeed the pwm frequency of the servos is 100Hz by default, which we’ve set this way because it gives better response for the servos we use for the pan/tilt unit.

You can change the frequency to something that some slower servos are more used to (try 50 or 60 hz) Do this by going to “Servo frequency” under the “Servo” tab in the config parameters in PixyMon.

(Pixy has very little total latency (~10ms) and updates every 20 ms, so adding another 20ms of latency in the servo was hard to stomach, so we found servos where we can crank up the frequency.)

Thank you Rich.
First of all, I am using the two servos which are part of the pan/tilt elements.
Ok, for the frequency it is now clear, but why the lower limte is -200 and the uppper is 200?
what does this range means? what is the units of the scale.

Servos have different timings. Between 0.5ms and 1.5ms is pulse width “normal” timing for a servo. This corresponds to positions of 0 to 1000, or 1us per “tick”. So -200 will shorten the minimum width by 200us.

thanks!

i received my PIXy and i have the same issue. I have tried swapping the servo plug from tilt to pan and the pan to tilt. this still causes my demo to avoid rather than track. no arduino just a usb cable and the pixy and 2 servos

Hello Jesse,
Are you using the Pixy pan/tilt kit or your own servos?

If you are using your own servos, you might try making the proportional gains (P gain) negative to reverse the motion (if needed).

http://cmucam.org/projects/cmucam5/wiki/Pantilt_Demo_Pane

Edward