Controlling Servos and PicoSwitches via Command Line

Is there a way to control PicoSwitches and Servos via Windows Command Line (CMD). I want to write a small app that will control a animatronics project of mine. I intend it to work quite dynamically and interactively and need routines to be played depending on certain conditions being met.

Additionally, I don’t quite like the way VSA is set up. I can never get my PicoSwitches to work entirely correctly. They don’t work at all when using the Relay option and seem to work at random locations on the dial when using the servo options. Additionally, they tend to reset with inactivity and fail to come back on and I have to unplug the entire rig. I also need to play video at the same time. I was thinking of rigging a DVD player. But that is kind of unreliable since the DVD player does not always take the same amount of time to load chapters. Thats why I want to design a program that will fit my needs.

So what are the commands I would put into Command Line, a DLL I can use, or another program?

Do you want the PC to talk to a BB II (RS-232)?

You could write a DOS program (runs in command box) to send a string to the BB II.

A file with a string (or many) can be sent to the com port (assuming you still have one) with a DOS console command (copy).

If you need to send via USB dongle, then that’s going to take a little more work…

The parallel port and a DOS program could be written to send both switch commands and R/C servo commands, even more work.

VB programs can of course talk to a serial port.

Alan KM6VV

I am assuming by BB II (RS-232) you mean a serial port right? I am using a SC-32 by the way wanted to make sure thats clear. I don’t currently have it hooked up via serial but I could do that. My PC has a serial port. How would I get started with sending serial commands to move servos/toggle relays?

I developed an Excel spreadsheet that was used to create a Windows .CMD file to send commands to the serial port and run my animatronic. Later, I developed a DOS program to run my animatronic via the serial port. Perhaps this topic could also give you some ideas: Peter Penguin

You can send ASCII strings directly to the SSC-32, or send commands to a BB II and have it parse them, and send ASCII strings to the SSC-32.

DOS has a copy command, do a copy /? in a CMD window to get help.

copy com1: Servo1500.txt 

might do it.

You’ll also want to set up the com port to the correct baud.

mode COM1: 9600N81P

for example.

do

help /?

to get a list of commands.

Alan KM6VV[code]

[/code]

I’ve used a batch file below for tinkering and servo control.

@echo off
mode com8:9600,N,8,1 >nul

echo #0P2200 >com8
ping -n 2 127.0.0.1 >nul

echo #0P1500 t3000 >com8
ping -n 5 127.0.0.1 >nul

echo #0P2200 >com8
ping -n 2 127.0.0.1 >nul

echo #0P1500 t3000 >com8
ping -n 5 127.0.0.1 >nul

echo #0P2200 >com8
ping -n 2 127.0.0.1 >nul

exit

Thank you. :slight_smile: My friend tried the code and it does indeed send commands picked up by the SSC-32. But what are all the arguments? Like the channel, position, etc?

The commands like #0P1500 t3000 are explained in the ssc-32 online user’s manual. In this command servo 0 is commanded to move to position 1500 over a period of three seconds.

Okay I cant get Command Line to get the SSC-32 to do anything. I’ve tried changing jumpers for different BAUD rates, using echo soooo many times, I made sure I was echoing to the correct COM port which in my case is 45, this is what I typed:

echo #0P2200 >com45

nothing happens, then I read you have to include the carriage return… So I did this…

echo #0P2200 ♪ >com45

nothing… I really need help with this. Just tell me EVERYTHING I need to put into Command Line and I would appreciate it deeply.

Use com port 9 or less.

Thank you sooo much ZoomKat. It works. Now I just need to know what command PicoSwitches need to be toggled on and off. And then I can begin writing my show software. They don’t seem to work as a normal dimmer, or relay in VSA. I always have to treat them as a servo and point to a specific position.

iirc the pico switch changes state on pulses longer than or shorter than 1500uS. There is a small deadband, but I don’t remember what it is. I don’t know why they don’t publish this information.

Thanks for the answer. That points me in the right path. But I’m not really sure what that means? Does that mean I do something like #0P1600 to toggle them on and off? Like is shorter than 1500 off and longer on? Or is it a toggle? Sorry for all these questions you guys. As you can tell, I’m quite the newb.

I dunno, you’re going to have to test it. It is not a toggle, it is one state for above and another state for below.

Send switch 1000 uS, see what it does.

Send switch 2000 uS, see what it does.

By the way, you’ll need a BB II or an SSC-32 to receive your “DOS command lines” sent to a serial port.

[code]SSC-32
“# 00 P 1000 T180”,LF

for ON

or
“# 00 P 2000”,LF

for OFF

BBII
serout SSC32,I8N1_38400,"#",“00”,“P”,DEC 2000,13]

in response to ON command received by the BBII,

or

serout SSC32,I8N1_38400,"#",“00”,“P”,DEC 1000,13]

in response to OFF command received by the BBII.
[/code]

(might have on/off reversed).

Alan KM6VV