HexEngine 2 BS2p Tutorial 01
Locomotion Control

Updated: 24-Feb-2010

mms_logo
 
Description

One of the easiest micro controllers to program is the basic stamp range. For this reason I have chosen the BS2p stamp to demonstrate how easy it is to communicate with the HexEngine via the serial control port.

This programme demonstrates HexEngine locomotion control with a one way serial link from the BS2p to the HexEngine. To do this we are using a PS2 style dual shock controller. This code has been successfully tested up to 115200 baud, using a Joytech PS2 clone controller.

Note: If you are using a p.Brain-µ24, 5 Volts is not available from the board.

 
Equipment Used
  • MSR-H01 Hexapod
  • p.Brain-SMB + HexEngine or p.Brain-µ24 HexEngine
  • BS2p24 + Carrier Board
  • PS2 Gamepad Extension Cable
  • Joytech PS2 Dualshock Gamepad Clone
 
HexEngine Configuration

CN18 Jumpers Off Terminal port = RS232 (UART2) , Control port = TTL (UART1).
CBR=4 Control baud rate = 19200
PIP=0 PIP Packet mode = 0
TXD=3 Transmission delay = 3
   
 
PS2 Gamepad Functions

PS2 Button Hexapod Function
START Power Up
CROSS Power Down
L THUMB FOR Walk Forward
L THUMB BACK Walk backwards
L THUMB LEFT Turn Left
L THUMB RIGHT Turn Right
SQUARE Crab Left
CIRCLE Crab Right
TRIANGLE Reset legs
RIGHT STICK PRESS Gait Up (Moves up through the 4 gaits)
LEFT STICK PRESS Gait Down (Moves down through the 4 gaits)
WHILE HOLDING R2  
RIGHT STICK Body Rotate X & Z
RIGHT STICK + R1 Body Rotate X & Y
LEFT STICK Body Translate X & Y
LEFT STICK + R1 Body Translate X & Z
WHILE HOLDING L2  
RIGHT STICK Proportional Walk Forward/Backward & Turn
LEFT STICK Proportional Crab
   
 
Connection

Only 2 wires are necessary for communication with the BS2p, which can be found on the p.Brain-SMB connector CN17.

Pin 2 = U1RX
Pin 6 = GROUND

U1RX needs to be connected to the BS2p SER_OUT pin and GROUND to the BS2P ground. IF you are using the 5V regulator ON the p.Brain-SMB, You CAN also take a third wire from PIN 9 ON CN17 TO supply the 5V power to the BS2p

p.Brain-SMB
CN17
p.Brain-µ24
CN1
Description BS2p
Pin 2 Pin 2 Data Pin 5 (Can be user configured )
Pin 6 Pin 6 Ground Pin 4
Pin 9 N/A 5 Volts ( Optional ) Pin 21
 
BS2p Code

HE_BS2_COMS_1.zip Contains HE_BS2_COMS_1.bs2
 
Useful Links & Documents

HexEngine Configuration Guide (PDF)  
HexEngine PIP protocol Guide (PDF)  
p.Brain-SMB user Guide (PDF)  
BS2p24 Schematic (PDF)  
BS2p24 Information (Link)  
   
 
HE+BS2
Image 01 - Basic Stamp Carrier attached to MSR-H01 Hexapod, HexEngine is mounted on underside of top body plate.
 

Video 01 - Video demonstrating hexapod control as described in this tutorial.