
RobertL184
I am experimenting with expanding the number of servo ports I have available to the EZ -B with a Pololu Mini Maestro 24 channel USB servo controller. The Mini Maestro is normally used to provide servo control to a PC but it has a TTL serial interface which easily interfaces with a micro controller. So I am playing with the EZ-B's send serial command to get more digital and servo ports. The Mini Maestro even has some scripting capabilities. According to documentation the Mini Maestro script subroutines can be started from the serial port so the EZ-B should be able to kick off the Mini Maestro scripts. I haven't got the subroutines working yet, but I have played with controlling a servo and outputting to a digital port to blink an led from an EZ -Builder script.
Mini Maestro scripts are more complicated to write than EZ builder scripts but appear they could be useful for fixed activities like making antennas move back and forth and blinking LEDs. Perhaps even a fixed response to a switch or button.
The SendSerial command is the key.
24 more ports under ARC control. I will post more info as I get time.
This just my 2 bits from the little I know, it is easier then two scripting languages. I think anyway. But still a nice little challenge you have to make it work. Let us know how it goes.
To be honest, it's much easier to use multiple EZ-Bs than use these expansion boards that aren't supported by the native controls, require scripting to use, etc. etc. etc.
If you can program the one via serial and then trigger the programs by serial (or I2C) commands then it does have uses but I'd keep it simple and basic i.e. turning LEDs on and off etc.
Let us know how it goes
#Port_Num = Port on Pololu Board servo is on
#ServoPos = Position for servo to be set to in uSec
$Port_Num=0
$ServoPos=500
Goto(SendPololu)
Sleep(1000)
$ServoPos=2500
Goto(SendPololu)
$Port_Num=1
$ServoPos=500
Goto(SendPololu)
Sleep(1000)
$ServoPos=2500
Goto(SendPololu)
Halt
:SendPololu
$ServoValue=$ServoPos * 4
$LowByte=$ServoValue & 0x7F
$HighByte=($ServoValue >> 7 )& 0x7F
SendSerial(D17,9600,0x84,$Port_Num,$LowByte,$HighByte)
Return()
#Port_Num = Port on Pololu Board LED is on
#ON_OFF = state of LED to be set 0=Off 1=ON
$Port_Num=6
$ON_OFF=1
Goto(SendPololu)
sleep(5000)
$ON_OFF=0
Goto(SendPololu)
sleep(5000)
$ON_OFF=1
Goto(SendPololu)
sleep(5000)
$ON_OFF=0
Goto(SendPololu)
Halt
:SendPololu
If ($ON_OFF == 0)
$LowByte=0x00
$HighByte=0x2D
ELSE
$LowByte=0x71
$HighByte=0x2E
Endif
SendSerial(D17,9600,0x84,$Port_Num,$LowByte,$HighByte)
Return ()
You can use a script to monitor virtual ports by using the $virtualservo0 = GetServo(V0) command and use this to move the servos on the expansion. But, make sure you use a sleep in the script to avoid using too much processing power and saturation of the comms. Response will suffer a little though.
You make a very good point. When you consider the Pololu Mini Maestro gives you 24ch for servo or general I/o for about $50 and the EZ-B has (had) a cost of about $70 with more over all I/o and interfacing options along with native software support it makes the choice pretty hard in my mind.
@DJSures what might be neat to ponder is native support for i2c interface between EZ-B boards.
@RobertL184 thanks for sharing your experience with this board and your scripts. I hope your success continues. You are making me want to purchase one to experiment with.
camera
quit
sub eyes
dup
1
BITWISE_AND
NONZERO
IF
6001 6 servo
else
1500 6 servo
endif
dup
2
BITWISE_AND
NONZERO
IF
6001 7 servo
else
1500 7 servo
endif
dup
4
BITWISE_AND
NONZERO
IF
6001 8 servo
else
1500 8 servo
endif
dup
8
BITWISE_AND
NONZERO
IF
6001 9 servo
else
1500 9 servo
endif
dup
16
BITWISE_AND
NONZERO
IF
6001 10 servo
else
1500 10 servo
endif
32
BITWISE_AND
NONZERO
IF
6001 11 servo
else
1500 11 servo
endif
quit
sub camera
1500 12 servo
1000 delay
6001 12 servo
quit
#Start a Pololu Script (Subroutine) and Pass a parameter
#Pololu_Sub=Pololu Subroutine Number
#Pololu_Value=Value to Pass to Subroutine
$Pololu_Sub=0
$Pololu_Value=9
$LowByte=$Pololu_Value & 0x7F
$HighByte=($Pololu_Value >> 7 )& 0x7F
SendSerial(D17,9600,0xA8,$Pololu_Sub,$LowByte,$HighByte)
Halt
The pololu compiled subroutine address the the eye subroutine is 0. And I am passing a value of 9 to make the both eyes red. Port 6 is left red, port 7 is left green, port 8 is left blue. Port 9 is right red, port 10 is right green, and port 11 is right blue.
The subroutine in the pololu makes sure the button is in the off position for 1 second the puts the button in the on position.
#Starts a Pololu Script (Subroutine) without a value
#Pololu_Sub=Pololu Subroutine Number
$Pololu_Sub=1
SendSerial(D17,9600,0xA7,$Pololu_Sub)
Halt
The pololu subroutine number for the camera script is 1.
I have the pololu script set up so it would turn the camera on automatically at pololu power up. The pololu has the ability to run a script on startup. In the script I posted earlier it would automatically power on the camera if the run script on startup were enabled.