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.
There are a couple of chips that you can hook up to the EZ-B through the i2c comm and they'll also extend the amount of i/o all you need to do is wire up the address. Then it's just scripting in EZ-B.
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.
Avoid the I2C ones, or at least the Adafruit one. I've not had success with it yet and have already spent far too long attempting to decipher the datasheet for it.
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
Since I am trying to get this robot up and running on wifi multiple EZ-Bs is not feasible at this time; maybe the new version at X-mas if you can indeed daisy chain them as the hints imply. I have the pololu up and running and can move servos and blink LEDs with it as an experiment. The pololu has some features that look interesting I have not tried. It not only has a servo speed setting, but an acceleration setting. The acceleration setting supposedly has the servo move slowly at first the speed up and slow down again as it approaches its final position. Says it mimics a morenatural motion. Sound intriguing. I have not played with servo speed or acceleration yet or scripting. Haven't tried kicking off Maestro scripts either. You can start and stop scripts. Maestro scripting language looks really awkward. Perhaps for simple reptitive things and use ARC for the complicated stuff.
My EZ-B is connected to my Pololu Mini Maestro on Port D17. The EZ-B D17 Gnd connects to the GND Pin of the Pololu Mini Maestro serial connector Ground Pin and the EZ-B D17 SIG connects to the RX Pin of the Pololu Mini Maestro serial connector Ground Pin. Picture is below.
The Pololu Serial Setting to Allow the EZ-B to control the Mini Maestro are:
At the current Time my Pololu Channel Settings are as follows:
I wrote a simple Script to test servo functionality on ports 0 and 1.
#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()
And I wrote a simple script to blink an LED set up on Channel 6 which is configured as a digital output on the pololu mini Maestro.
#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 ()
I am not sure it is worth doing or not ( I will have to think about it some more) but I think it would be possible to write an EZ-B script to monitor a Virtual servo port and make the Pololu servo match the operation of an ARC servo Control that is set up for the Virtual servo Port. This would provide direct on screen control of the Pololu Servos from the ARC user interface. Of course there would be some lag between moving the control of the virtual servo and the actual operation of the servo on the Pololu Mini Maestro as the script would have to periodically check the value of the Virtual servo and send any change in position to the Pololu.
Both of the scripts I have posted function with ARC controlling Servos and Digital Outputs on the Pololu Mini Maestro. I may play with doing some subroutine scripts in the Pololu controller and trying to execute them from the ARC next.
Nice work.
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.
@Rich from an earlier comment >>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.<<
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.
I am going to put two RGB LED eyes on my robot. This would use up 6 ports. So I thought they would work decent on the Pololu controller if I could write a pololu script to break up a parameter sent by the ARC script into individual LED on/off codes. I also decided to move the ez-robot kit camera on/off push button over to the pololu and did a second pololu script to push the camera power on button. So here is the pololu script. It takes a value sent by ex-builder (0-63) and breaks it down to turn on and off the 6 LED outputs.
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
The ARC script I use to change the eye color is:
#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.
Turning the camera on does not require a parameter. So it uses a slightly different script.
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.