How to control PSC from PC?
Hi!
Just read that parallax are working on some software on controlling the PSC from a PC. I have built a 6-legged robot similar to the HexCrawler and I want to evolve some sort of walking gait using for example evolutionary algorithms. In order to do this I need to control the PSX from something more powerful than a Stamp, for example a PC.
My question is: Haven't anyone already managed to control the PSC from a PC? My impression is that whatever you want or need to do, somebody has already done this but still I cant find any info on it... As I see it, it should be a matter of figuring out the format of the serial message required by the PSC.
Regards Niklas
Just read that parallax are working on some software on controlling the PSC from a PC. I have built a 6-legged robot similar to the HexCrawler and I want to evolve some sort of walking gait using for example evolutionary algorithms. In order to do this I need to control the PSX from something more powerful than a Stamp, for example a PC.
My question is: Haven't anyone already managed to control the PSC from a PC? My impression is that whatever you want or need to do, somebody has already done this but still I cant find any info on it... As I see it, it should be a matter of figuring out the format of the serial message required by the PSC.
Regards Niklas
Comments
·· As a workaround you could control the PSC from your PC through the BS2.· Simply send your commands via serial to the BS2 and have it pass them to the PSC.· But as a side-note, a stock BS2 can control a Hex Crawler just fine with 12 servos, so I'm not sure where you got the idea that a BS2 wasn't capable.· In fact many have 2 to 4 extra servos for scanning.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae
Tech Support
dandreae@parallax.com
www.parallax.com
·
Controlling the servos from a PC via·a Stamp could be worth trying. I'll look into that.
Thanks!
·· Check this out...· http://www.parallax.com/sx/contest/contest_SX_creeper.asp
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
When interfaced to my basic stamp the green light on the PSC was normally off except for when receiving data. When I connected it to my serial port on my PC it was constantly on, which tipped me off that the signal may need to be inverted.
I used a transistor and 2 resistors to invert the signal, and convert it to 5V at the same time, and it seems to be working fine. It communicates only one way for now (send only) which is all I need, works great.
I know this is the dirtiest way of doing it, but I dont have a RS232 chip handy.
/Niklas
We have tried something similar but the servos just won't move! We have the same problem with green light being constantly on, we tried a circuit that 'should' work but it doesn't (the led does only light when we transmit so that is correct at least). So either our circuit is wrong, or the command we are sending is wrong. We made a small program just to test it out, basically we open up the serial device, set the correct (we think) settings and write to it.
int fd = open("/dev/ttyS0", O_WRONLY);
termios t;
tcgetattr(fd, &t);
// set baudrate 2400, 8N2
cfsetospeed (&t, B2400);
t.c_oflag |= CSTOPB;
t.c_oflag |= CS8;
t.c_oflag &= ~PARENB;
t.c_oflag &= ~PARODD;
tcsetattr(fd, TCSANOW, &t);
// send command
char command[noparse][[/noparse]8];
sprintf(command, "!SC%c%c%c%c%c", 0, 0, 250, 0, 0x0d);
write(fd, command, 8);
close(fd);
Any ides anyone?
I have the exact same problem. The green light is constantly on and no servo is moving. Could you please provide the schematics of the PC Interface. I'm stuck with it.
Thank you,
Gerhard
Parad and Gerhard, if a thread is more than a few weeks old (since the last time anyone posted to it), it is better to start a new thread. People who recognize it as an old thread will be less likely to read it, and wouldn't notice that you have a new question. A good rule of thumb is: go ahead and search the last 1-3 months of posts to see if your question has already been asked. If it has and the question was answered, you're done. If it has been asked, but you want more info or it is the same topic but not the exact same question, and the post is on the first or second page, attach a post to the thread with your question. If the post is quite old, start a new thread and include a link to the old post in your message; that way those of us answering questions will know its a new question. Neither of you have done anything wrong, this is just a suggestion to help·you guys to get quick and full answers.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Post Edited (Paul Baker) : 8/12/2005 12:01:27 PM GMT
·· Here (attached) is a schematic for the PC to PSC interface for those using Serial Versions of the PSC.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Thank's for the schematics. I got mine now talking to the PC. Green light only comes on when communicatiing. With Hyperterm I couls also request the Version. It replyed wit 1.4. Still having trouble to get any servo moving. So I still need some help on programming a Sequence in C or C++ under Linux. If anyone knows how that works, it would be appreciated.
Regards,
Gerhard
If you get a servo to respond through hyperterm, copy and paste it to a post would you?
thanks,
Nick
haha, I believe I might break my fingers before that could work. But if I it happens I promise to post it
Cheers,
Gerhard
I know this is probaly a longshot but if i connected·a LED to pin 1 and 2 of the PSC end of the circuit and got a VB6 program to continusley send &hff to the com1 port would the LED light up??
I know this is a dumb question but·I recon it was probaly worth asking.
Why would you like to do that? On the PSC Board is a LED that gives you a clear indication if there is any traffic that moves via the serial line from the PC to the PSC.
Cheers,
Gerhard
As it appears to me, you need to apply power between Pin 2 (+5V) and 3 (GND) in order to see anything at all. on Pin 1 should be an action of some kind as soon you put something from the PC towards the interface. Since the circuit echoes (or should at least) the incoming traffic, you might get some characters sent back to the PC. But that is dependend on the chip on your PC, since the voltages are differnt on RS232C (+/- 12V) than on TTL(+5/0V). But it's worth a try.
Hope I could help a little,
Gerhard
Thanks
No for requesting the version number that is not needed. You need power on these terminals as soon as you want to move or hold the servos. By the way does the interface work for you? I am courious, because I set up a small PCB with a MAX232 and 5V Power Supply to make sure that the communication works correctly.
Regards,
Gerhard
Jeez - I hope i havent damaged anything.
Thanks
BTW - Whats a MAX232??
Post Edited (cjnewbs) : 8/28/2005 9:41:12 PM GMT
Sorry to hear about that. To make sure that your RS232 TX/RX works correct, maybe you should get one of these testers with LED's. there you can see if you get any action when you type something in Hyperterm. If you want just an echo, short out Line 3 and 2 temporarely on a separate connector. If you see anything on the terminal, your computer is fine. Another thing is, do you know if the Computer is wired as DTE or DTS? to find out maybe·switch line 3 and 2 on your end (had that happen many times...).· If that all does not help, you will need to get a voltage level converter like the MAX232. With that my stuff works like a charm. Well and the question if you have damaged anything, I don't know but it is not very likely.
I get my PCB's this week. If everything checks out fine I will give you the schematics and the Layout. The headaches will be over with that;-)
Best Regards,
Gerhard
Open source project that seems to offer exactly what you need.
-Terry
Thanks for pointing me there. Looks like very interesting site.
By the way, the PCB I designed checked out perfectly. When I get to my Computer I will post the schematics and the PCB design. Maybe I pack also the Linux Software for testing the servos into that too.
Cheers,
Gerhard
As promised attached the Files regarding the RS232 converter and the software I'm using for testing. Please note there are no warranties whatsoever. I's your responsibility if you use it...... (It works for me...)
Best Regards,
Gerhard
Unfortunately there is more involved. First you have to set up the flow control properties. You could try to set them up for 'none', that might help to get over the first hump.·If that does not help, the DTR (Data Terminal Ready) and DSR (Data Set Ready) lines (have the pin numberd not handy at the moment) need to be wired. If theses lines are not set up properly the computer thinks there is noone on the other line and ignores incomind signals and refuses to send anything. When I get home I will look the pin numbers up and post them to you.
Have fun,
Gerhard
I did manage to get an echo by shorting pins 2-3, and setting flow control to None.
I did manage to get some garbled text while i was typing !SCVER - but this only happened twice, im guessing it could have been interferance.
Thanks.
Well, that is good news! You don't even need to bother with the DTR and DSR lines. Downside ist, now you need to get the signals right from and to the PSC. Further up in this thread there is a schematic with two transistors. Maybe that helps. But I suggest using the MAX232 chip in order to get a proper communication. Only a few electronic parts are needed. You can see a few posts up also a schematic, PCB design and a C program that I am using. No problems since then.
Cheers,
Gerhard