Need help getting PSC working
I ran the test program for a single pin connection, but it seems to get stuck when it tries to get a reply from the PSC. In addition, I can't get the servos to respond to any commands, they only jitter when I turn the power on. Here is my wiring diagram, and it says to connect like this:
(sorry, if you can't see, it says "pin 10" on the very left, "PSC" on the very right)
Did I connect it correctly? I used a 330 because I dont have another 220 right now. The 220 in the diagram is just a safety resistor I have on all my pins, and it shouldn't affect it, correct? I have the PSC's logic running off the javelin's regulated 5V, the servos running off a 6.0V battery pack (connected through the power terminals). Any help would be appreciated, thanks.
One pin: o---JavPin--------PscPin---o (this pin has 220E pullup resistor with LED)
(sorry, if you can't see, it says "pin 10" on the very left, "PSC" on the very right)
Did I connect it correctly? I used a 330 because I dont have another 220 right now. The 220 in the diagram is just a safety resistor I have on all my pins, and it shouldn't affect it, correct? I have the PSC's logic running off the javelin's regulated 5V, the servos running off a 6.0V battery pack (connected through the power terminals). Any help would be appreciated, thanks.
Comments
the psc board has two leds:
a red led to indicate board is powered
a green led with 220 ohm that connects between Serial In and +5V
So·you must not connect a led+resistor yourself to the psc datapin.
As I don't have a psc board, can you confirm those leds are there?
regards peter
I don't know what I'm doing wrong that's causing all these pins to die out. I think this is my 3rd one in 3 or 4 months. I have 220 ohm resistors on each pin, shouldn't that protect them? The strange thing is that these don't go out if I accidently incorrectly wire something. They just seem to go out randomly. Some while being used, others during durations where they weren't used. So, if I don't use a pin, does it matter what I do with it?
Also, is there an issue with changing your wiring and THEN programming the javelin? There is a fraction of the second from the time I hit the power switch to the time I click "program," and during this short time period, the javelin is already running the old program with the new wiring configuration. Likewise, if I download the new program and THEN change the wiring, there will be a short duration after programming when the javelin begins executing the new code on the old circuit. Is there a way round this? How is it supposed to be done?
Post Edited (bulkhead) : 3/18/2006 5:38:27 AM GMT
·* One pin:·· o---JavPin
PscPin---o (this pin has 220E pullup resistor with LED)
·*··········· In this case receive uart equals transmit uart
·*··········· static Uart pscIO = new Uart(Uart.dirReceive,CPU.pin0,Uart.dontInvert,Uart.speed2400,Uart.stop1);
·*··········· static psc myPsc = new psc(pscIO,pscIO,3); //single PSC board with 3 servos
·*
so the pins should connect directly (as you have now).
Glad to hear it does work. Too bad about your dead pin.
I think the weak pullups are enabled on the SX48 of the javelin,
but it is good practice to make unused pins a low or high output
instead of leaving them float.
But even then, unused pins don't get dead by themselves, even if floating.
You say you have 3 or 4 dead pins, all on the same javelin?
Changing the circuitry with an old program running, or downloading
a new program with an old circuitry, COULD cause damage, but your
220 ohm resistors should protect the pins. A way around is to first download
a 'clear javelin' program that leaves all pins inputs, then change the circuitry
and then reprogram with the new program.
regards peter
JavPin o---<220E>---<RES>---+----<220E>--<LED>---o +5V
············································ |
············································ +--o PscPin
RES is an optional additional resistor.
Treshold level is 2.5V
If JavPin is pulled low, the PscPin level must be < 2.5V
So RES has a upper limit value.
Normal leds have a 2V drop when lit (I am not sure about smd leds, could be < 2V)
so (220+res)/(220+res+220)*(5V-2V) < 2.5V
You can work out the maximum·value for res
With a single line, the Uart must change from transmit to receive.
If the PscPin changes direction faster than JavPin, then
JavPin could still be a high output, while PscPin becomes a low output.
This gives for a short time, a current of 5V/(220E+res)
(this also applies to the Javelin TX pin in the two pins setup)
The javelin should be able to handle this.
For extra protection you can connect res between JavPin and PscPin.
regards peter
because mostly the output driver circuitry is destroyed due to too high·current draw.
Worthwile checking I think.
regards peter
res < (Vled/(2.5-Vled))*220 ohm
For Vled=2V -> res < 880 ohm
For Vled=1.5V -> res < 330 ohm
For Vled=1V -> res < 147 ohm
A too high res value results in PscPin level never to go below treshold level.
I think res=150 ohm is a good extra safety precaution (I expect Vled ~ 1.5V)
Pin peak current is then limited to 5V/(220+150) = 13.5 mA
regards peter
·
It states
· //convert position to angle
· //default position range 1250-250=1000 equals 180 degrees, so angle resolution is 0.18 degrees
· //the conversion uses 0.1 degree resolution
· // A = (p-pmin)/(pmax-pmin)*1800
Default pmax=1250, pmin=250, center=750 -> 90 degrees (value 900)
pmax=2500, pmin=500, center=1500 -> 90 degrees
· //convert angle to position
· //default position range 1250-250=1000 equals 180 degrees, so angle resolution is 0.18 degrees
· //the conversion uses 0.1 degree resolution
· // P = (A/1800)*(pmax-pmin) + pmin
Default pmax=1250, pmin=250 90 degrees -> center=750
pmax=2500, pmin=500 90 degrees -> center=1500
The angle/position conversion works ok for your pmin and pmax values.
Just use your pmin and pmax values in the initChannel() method.
That should work.
If you use angles in your main code, then your main code is independant
from pmin and pmax values (and thus independant from any particular servo).
regards peter
·
Do the values pmin and pmax represent the pulse duration in milliseconds? How about the PSC software's numbers?
value 750 represents 50% pwm dutycycle.
Now I think of it, you must use pmin=250 and pmax=1250
in the initChannel method.
The numbers you mentioned are from the pc software fro the psc.
You can use these numbers in your javelin code,
just use
··setPosition(channel,ramp,position/2)
and
· position = 2*getPosition(channel)
and
· position = 2*position(channel,angle)
and
· angle =·angle(channel,position/2)
where position is 500 to 2500
regards peter
Post Edited (Peter Verkaik) : 3/19/2006 5:04:57 AM GMT
use pcvalue_pmax/2 and pcvalue_pmin/2 and pcvalue_home/2 in
initChannel() method.
So if your pc values are 523, 2460, 1480
use initChannel(channel,523/2,2460/2,1480/2,ramp)
regards peter
One other issue that I have come up upon while working on this is what is the proper way to turn on everything? Originally when I had servos controlled directly by PWM, I had 2 power switches, 1 for my javelin and 1 for the servos. I would turn on my javelin first, wait for it to start up, then turn on all my servos. This eliminated the potentionally disastrous random jerks of the servos that usually occur if I turn everything on at once.
However, I can't do that with the PSC. If I don't have the PSC's power switch turned on when I turn on my javelin, it won't be initialized properly and won't work. The PSC's logic is powered by the javelin's regulated 5V, so when I switch on my javelin the red LED turns on on my PSC. If I turn on my PSC after starting my javelin, the green LED flashes indicating the data transfer, but the servos won't go to their correct positions.
My guess is that the PSC's power switch is not JUST linked to the servo ports, but also to the logic somehow. The only way I can get it working now is if I turn on the javelin and the PSC at the same moment (the switch to my javelin is the "master switch", so to achieve this I just leave my PSC's switch on and hit this "master switch"). When I do this the servos do jerk for a second, but then they work fine afterward. How can I eliminate this jerk, and yet still have the PSC properly "initialized"?
Another bit of info, if I turn on my PSC and javelin at the same time and get them working, and then I turn off my PSC. When I turn the PSC back on it no longer works. Again, this seems to point to the PSC's switch being linked to it's logic.
the psc logic is powered by 5V. The servo power,
which MUST be a seperate power supply, is switched
on/off by the psc switch.
So the correct sequence must be:
psc switch to OFF
power the javelin (and thus psc logic)
psc switch to ON
You can call initChannel with a ramp parameter representing
a longer time to position the initial servo positions.
You can add a delay before initializing the servos
to allow you time to switch ON the servos.
regards peter
·
Thanks again for all the help.
I looked at the schematic for the PSC (serial version), and if it's anything like the USB version, it doesn't look like the PSC's power switch is connected in any way to it's logic. Shouldn't it generate the PWM signal on the pins even thought the servo's power switch is off, as long as the logic is recieving power? The only thing I can see that may cause this problem is if the baudrates for the javelin and the PSC are not equal and they are off-sync, but the manual says you can send it a byte to "elevate" it to 38k4, so that would imply the default baudrate on the PSC is 2400. If that's the case, then they should not be off-sync since nowhere in the PSC class does it change the baudrate to 38k4.
Again, the javelin's I/O line is connected directly through a 220 ohm resistor to the PSC. The PSC's logic is powered by the javelin's 5V. The servos are powered by the main 6.0V battery (which powers everything). I have already checked the voltage, and it stays constant at around 5.9 V and the javelin doesn't reset, so power usuage shouldn't be an issue.
import stamp.core.*;
static void initServos() { //move servos to home positions
· myPsc.initChannel(0,500/2,2500/2,1500/2,0);
· myPsc.initChannel(1,500/2,2500/2,1500/2,0);
· myPsc.initChannel(2,500/2,2500/2,1500/2,0);
· //etc.
}
static void main() {
· System.out.println("psc program version x\n");
· System.out.println("turn on psc and hit enter when servos ready\n"); //let psc move servos to midpoint
· int c = Terminal.getChar(); //wait for keypress
· initServos(); //move servos to home positions
· //insert·your maincode here
}
This allows you to figure out if a startup delay makes it possible
to power up the servos later than the javelin.
regards peter