SCC-32

Hello, I am new to designing robots so please excuse any newbie questions :unamused:
Firstly I have all the components required for a hexapod (servos, bluetooth serial module - sena esd200), apart from the servo controller. I was wondering if the scc-32 would do what i required? i have 18 servos for the legs and will soon be adding a panning head attatchment.
However i also want to incorporate the SRF04 ultrasonic range finder into my hexapod, as well as a thermopile array sensor: the devantech TPA81. I want it to avoid objects in a room (from information read in from srf04) until it finds a heat source with the TPA81. Here is a link to the productā€™s data sheet:
robot-electronics.co.uk/htm/tpa81tech.htm
the problem with the TPa81 is that it only runs of an I2C configurationā€¦ would this be a problem? i think i could use the SRF04 with the i2c configuration too, but please correct me if iā€™m wrong. How would i be able to configure the tpa81 to communicate with the servo board? I just want to make sure that what iā€™m trying to acheive is possible before i buy this product.
Many thanks, Daniel

Hi.
As you are talking about the ssc-32 I am going to make an assumption that the servos you have are r/c hobby servos like for a model airplane or car. What youare talking about creating is frequently refered to as autonomous control where the robot is deciding its own course based upon sensor inputs and some programmed logic. To accomplish this you really need two pieces, a servo controller like the ssc-32 and a microcontroller such as the basic atom pro (for example, mostly because a great deal of the tutorials and projects for Lynxmotion are written using this device). The basic atom pro is a small IC pacakage with no easy way to connecto to its various pins so the common method is to use a break out or expansion board called the bot board II. The acronyms you will see people use are BAP and BB2 in general on the forum. So anyway the BAP can manage a few servos directly, maybe half a dozen, but not nearly enough to control a full 18-20 servo hex (with pan/tilt). The ssc-32 can control up to 32 servos and offers some higher level functions like group and timed movement that makes doing synchronized movement (like walking) much easier to code. The BAP mounted on a BB2 can read like 8 analog inputs and input or output up to 16 digital i/o lines. This makes it ideal for connecting sensors of many types which it can then process the outputs of and produce the commands necessary to drive the servos connected to the ssc-32. The BAP can implement many different communication protocols on its pins including I2C so that should meet your need for communicating with the TPA81 and any other sensors. It would not be uncommon to expect an autonomous robot to use an ultrasonic sensor for long range detection and route planning combined with one or more infrared range finders for near object collision avoidance. there are also folks working on processing leg pressure sensors for for terrain adaptation control. Most of these projects are relying on the aforementioned combination of an SSC32, BAP, and BB2 for electronics.

Som links and images to the items mentioned in my reply:
SSC-32

BAP

BB2

Thanks for the detailed response! And in answer to your assumption of which servos i have, sorry i forgot to mention: i have 12 x hitec -HS 645MG and 6 x HS-225 MG. i bought them from the micromagic website, along with the MSR-HO1 frame.

So you would reccommend purchasing the BB2 and the BAP? how easy are these to work with? i have some programming experience in C, C++ and ASM but i wouldnā€™t say that i am very good, although i do tend to pick things up quickly. is there some sort of graphical interface to help position the servos, i.e a slider bar? i have seen some controllers that work like this.
Where would the code sit for all the servos? on the servo controller? or would i have to code the movements onto the atom?

I was just planning on having the thing walk straight, until a signal is recieved from one of the sensors and then act upon thatā€¦

You mention that a lot of people use this configurationā€¦ i havenā€™t browsed the other threads to have a look but i suppose this means that there are others doing similar projects, and therefore i could find help if i get stuck?

Thanks again for the help.

Ah, I am guessing those are the servos micro magic recommends for use with their chassis.

You should examine the Phoenix tutorials and threads about programming same. It shares a common ancestry with an earlier micro magic chassis design, the msr h01 being their production model. I also seem to think I recall one other forum regular was doing something similar, using the lynxmotion controls (ssc-32+bap+bb2) with a msr-h01 chassis, and posting info about his progress. So maybe search for the msr-h01 on the forum and see if you can locate that thread. As the two products developed independantly I seriously doubt the angles and segment lengths are the same however I would imagine a lot of those parameters for the phoenix codes developed by Xan and Zenta are constants assigned at the beginning. Someone else more familliar with the Phoenix development should probably step in and help you on those types of details.

Using the configuration Iā€™ve suggested I donā€™t think you will have any difficulty getting people to chime in and help if you get stuck. I also think you have a couple hours of reading ahead in digesting all the development activity that has occurred with the phoenix over the last two years or soā€¦ one of those threads having the honor of being the largest single active thread on the forum. :wink:

hi Daniel.

i have the Msr-H01 and also running the ssc-32+bap+bb2. here is a link if you need some info.
viewtopic.php?f=20&t=5592
its now running using Xans phoenix code V2!!!

the only paramiters you will need to change is here.

;[SSC PIN NUMBERS]

;[MIN/MAX ANGLES] Mechanical limits of each Leg,

[code];[BODY DIMENSIONS]
cCoxaLength con 20 ;Length of the Coxa [mm]
cFemurLength con 80 ;Length of the Femur [mm]
cTibiaLength con 130 ;Lenght of the Tibia [mm]

cRRCoxaAngle1 con -600 ;Default Coxa setup angle, decimals = 1
cRMCoxaAngle1 con 0 ;Default Coxa setup angle, decimals = 1
cRFCoxaAngle1 con 600 ;Default Coxa setup angle, decimals = 1
cLRCoxaAngle1 con -600 ;Default Coxa setup angle, decimals = 1
cLMCoxaAngle1 con 0 ;Default Coxa setup angle, decimals = 1
cLFCoxaAngle1 con 600 ;Default Coxa setup angle, decimals = 1

cRROffsetX con -43 ;Distance X from center of the body to the Right Rear coxa
cRROffsetZ con 82 ;Distance Z from center of the body to the Right Rear coxa
cRMOffsetX con -63 ;Distance X from center of the body to the Right Middle coxa
cRMOffsetZ con 0 ;Distance Z from center of the body to the Right Middle coxa
cRFOffsetX con -43 ;Distance X from center of the body to the Right Front coxa
cRFOffsetZ con -82 ;Distance Z from center of the body to the Right Front coxa

cLROffsetX con 43 ;Distance X from center of the body to the Left Rear coxa
cLROffsetZ con 82 ;Distance Z from center of the body to the Left Rear coxa
cLMOffsetX con 63 ;Distance X from center of the body to the Left Middle coxa
cLMOffsetZ con 0 ;Distance Z from center of the body to the Left Middle coxa
cLFOffsetX con 43 ;Distance X from center of the body to the Left Front coxa
cLFOffsetZ con -82 ;Distance Z from center of the body to the Left Front coxa
;--------------------------------------------------------------------[/code]

[code];[START POSITIONS FEET]
cRRInitPosX con 78 ;Start positions of the Right Rear leg
cRRInitPosY con 0
cRRInitPosZ con 45

cRMInitPosX con 90 ;Start positions of the Right Middle leg
cRMInitPosY con 0
cRMInitPosZ con 0

cRFInitPosX con 78 ;Start positions of the Right Front leg
cRFInitPosY con 0
cRFInitPosZ con -45

cLRInitPosX con 78 ;Start positions of the Left Rear leg
cLRInitPosY con 0
cLRInitPosZ con 45

cLMInitPosX con 90 ;Start positions of the Left Middle leg
cLMInitPosY con 0
cLMInitPosZ con 0

cLFInitPosX con 78 ;Start positions of the Left Front leg
cLFInitPosY con 0
cLFInitPosZ con -45
;--------------------------------------------------------------------[/code]

correct for the Msr-h01

Thanks for the help guys!
Xanā€™s code looks amazing, i canā€™t wait to try it out. However it is branching off from my original plan: i want the hex to be autonomous. Do you know if anyone has achieved something similar?

Um, there are people working on this type of thing but if I may make a conservative suggestion: walk before you try to run?
Generally speaking autonomous replaces the parts of the code where command inputs are received from a controller with a state machine being updated with/from the results of different sensors. If you get the basic non-autonomous code working correctly with your platform it makes a stable point of reference to return to if (when) something just stops working or does something unpredicted. First steps into autonomous behavior would include introducing code to read the different sensors and using that code to interact with the controller commandsā€¦ such as obstable and collision avoidance over-riding command inputs.

eddyb is correct, it wouldnt take much to convert the code for Basic Obstacle Avoidance.
Here is one for Basic Obstacle Avoidance Using **SFR04 **to control **HexEngine **via BasicATOM Pro 28, BotBoardII
hexapodrobot.com/forum/viewtopic.php?f=5&t=361
HOPE THIS HELPS.

[code]; =========================================================================

; File: SRF04_OBSTACLE_AVOIDANCE_ATOM.BAS
; Purpose: Basic Obstacle Avoidance Using SFR04 to control HexEngine via BasicATOM Pro 28
; Author: Matt Denton (for BS2P MCU + SRF08 connected to p.Brain-SMB)
; Ported: 05/11/09 for BasicATOM Pro MCU + SRF04 Ultrasonic Sensor connected to BotBoardII
; Kevin Lincoln

; =========================================================================
; ----- Program Description ]---------------------------------------------

; This program demonstrates two way serial communications between the
; HexEngine and a BasicATOM Pro MCU using the SERIN and SEROUT
; commands. In order to get this to work when using SERIN, the maximum
; baud rate is 19200, and a delay is needed from when the HexEngine receives
; a packet request to when it returns it. This is because we are not using
; the hardware UART on the BAP. There is a setting on the HexEngine
; that will transmit a number of 0xff bytes to form a transmision delay
; before the actual reply packet. This setting also sets the UART STOP
; bits to two, which also helps slow down the comms data rate.
; Also, it is much easier to receive PIP packets in mode 0, with
; no Escape code checking, Therefore, before running this test, set the
; following in the HexEngine configuration menu:

; CBR=4
; TXD=3
; PIP=0

; This sets the baud rate to 19200, transmission delay on and PIP mode 0
; Donā€™t forget to exit config mode when you are done!

; Only 3 wires are needed for communication with the BAP28, which can be
; found on the p.Brain-SMB connector CN17.

; Pin 2 = U1RX
; Pin 4 = U1TX
; Pin 6 = GROUND

; U1RX needs to be connecteed to the BAP28 SER_OUT pin, U1TX to BAP28 SER_IN
; and GROUND to the BAP28 ground. If you are using the 5V regulator on the
; p.Brain-SMB, You can also take a fourth wire from Pin 9 on CN17 to
; supply the 5V power for the BAP28 device.

; HexEngine ] BAP
; U1TX ]----TX----> SER_IN
; U1RX ]<ā€”RX----- SER_OUT
; GROUND ]----GND---- GROUND

; ----- Revision History ]------------------------------------------------

; ----- Compilation Switches ]--------------------------------------------

PIP_MODE_1 CON 0 ; PIP MODE 1 FOR MORE ROBUST COMMS, 0 FOR SIMPLER COMMS

; ----- I/O Definitions ]-------------------------------------------------

Echo CON P0 ; echo input from SRF04
Trigger CON P1 ; trigger out to SRF04
SER_OUT CON P15 ; serial out to p.Brain-SMB U1RX
SER_IN CON P14 ; serial in from p.Brain-SMB U1TX

; ----- Constants ]-------------------------------------------------------

Trig10 CON 20 ; 10uS pulse in BAP 0.5uS units
ToCm CON 58 ; convert SRF04 raw reading (in uS) to CM

CMD_PIP_ESCAPE CON $7d ; PIP escape code
CMD_PIP_HEADER CON $7e ; PIP header byte
CMD_PIP_XOR CON $20 ; PIP XOR operator

HEAD_LOOK_SPEED CON 16
HEAD_LEFT CON 1900 ; P/T head sometimes hits left anterior femur at 2000uS
HEAD_RIGHT CON 1100 ; P/T head sometimes hits right anterior femur at 1000uS
HEAD_MID CON 1528 ; mid position of my pan servo
HEAD_OFFSET CON 30

FRONT_OBSTACLE_DISTANCE CON 20 ; CM
RIGHT_OBSTACLE_DISTANCE CON 28 ; CM
LEFT_OBSTACLE_DISTANCE CON 28 ; CM
RETREAT_DISTANCE CON 19 ; CM

Baud CON I19200 ; match HexEngine CBR

CR CON 13
LF CON 10

note1 CON 1000
note2 CON 2000
note3 CON 3000
dur CON 150

; ----- Variables ]-------------------------------------------------------

samples VAR Nib ; sensor loop counter
pWidth VAR Word ; pulse width from sensor
rawDist VAR Word ; filtered measurment
Dist_CM VAR Word ; Distance in centimeters

PIP_Byte VAR Byte
PIP_Len VAR Byte
PIP_Temp VAR Byte
PIP_Cs VAR Byte
PIP_Buff VAR Byte(17)
W_Temp VAR Word
Temp VAR Byte
RRange VAR Byte
FRange VAR Byte
LRange VAR Byte
Hex_Count VAR Byte
Hex_Dir VAR Byte
Hex_Mode VAR Byte

; ----- Initialization ]--------------------------------------------------
Setup:

HIGH SER_OUT
LOW Trigger
HIGH 12

; ----- Program Code ]----------------------------------------------------
Main:

LOW 13 ;Turn on the BBII green LED, we rollinā€™.
SOUND P9,[dur\note1,dur\note2,dur\note3]
; ALLOW THE HEXENGINE TO POWER UP
PAUSE 1500
; WAKE HEXAPOD
PIP_Buff(0) = ā€œ+ā€
PIP_len = 1
GOSUB Send_PIP_Packet
; RESET LEGS IF ALREADY POWERED UP
PIP_Buff(0) = ā€œrā€
PIP_len = 1
GOSUB Send_PIP_Packet
PAUSE 8000
; SET GAIT TO WAVE 3
PIP_Buff(0) = ā€œ3ā€
PIP_len = 1
GOSUB Send_PIP_Packet

Hex_Dir = ā€œwā€

DO

; MOVE HEAD LEFT
W_Temp = HEAD_LEFT + HEAD_OFFSET
GOSUB Move_Head_Position
GOSUB Get_Distance
LRange = Dist_CM
SEROUT S_OUT, Baud, "Left: ", sdec LRange, CR]

; MOVE HEAD CENTER
W_Temp = HEAD_MID + HEAD_OFFSET
GOSUB Move_Head_Position
GOSUB Get_Distance
FRange = Dist_CM
SEROUT S_OUT, Baud, "Front: ", sdec FRange, CR]

; SEND MOTION COMMAND
PIP_Buff(0) = Hex_Dir
PIP_len = 1
GOSUB Send_PIP_Packet

; MOVE HEAD RIGHT
W_Temp = HEAD_RIGHT + HEAD_OFFSET
GOSUB Move_Head_Position
GOSUB Get_Distance
RRange = Dist_CM
SEROUT S_OUT, Baud, "Right: ", sdec RRange, CR]

; MOVE HEAD CENTER
W_Temp = HEAD_MID + HEAD_OFFSET
GOSUB Move_Head_Position
GOSUB Get_Distance
FRange = Dist_CM

SEROUT S_OUT, Baud, "Mode: ", sdec Hex_Mode, " Dir: ", Hex_Dir, " Count: ", sdec Hex_Count, CR, LF]

; SEND MOTION COMMAND
PIP_Buff(0) = Hex_Dir
PIP_len = 1
GOSUB Send_PIP_Packet

IF Hex_Mode = 0 THEN
  Hex_Dir = "w"
  IF FRange < FRONT_OBSTACLE_DISTANCE THEN
    Hex_Mode = 10
    Hex_Count = 0
    GOSUB Hex_Stop
  ELSEIF RRange < RIGHT_OBSTACLE_DISTANCE
    Hex_Mode = 20
    GOSUB Hex_Stop
  ELSEIF LRange < LEFT_OBSTACLE_DISTANCE
    Hex_Mode = 30
    GOSUB Hex_Stop
  ENDIF


; BACKWARDS UNTIL DISTANCE > 20 OR COUNT > 3
ELSEIF Hex_Mode = 10
  Hex_Count = Hex_Count + 1
  Hex_Dir = "s"
  IF FRange > RETREAT_DISTANCE THEN
    GOSUB Hex_Stop
    IF( RRange < LRange ) THEN
      Hex_Dir = "a"
    ELSE
      Hex_Dir = "d"
    ENDIF
    Hex_Mode = 11
    Hex_Count = 4 ; Was 6 in BS2 code, BAP turned too long on object detection
  ENDIF
  IF Hex_Count > 3 THEN
    GOSUB Hex_Stop
    IF( RRange < LRange ) THEN
      Hex_Dir = "a"
    ELSE
      Hex_Dir = "d"
    ENDIF
    Hex_Mode = 11
    Hex_Count = 3 ; Was 5 in BS2 code, BAP turned too long on object detection
  ENDIF


; TURN
ELSEIF Hex_Mode = 11
  Hex_Count = Hex_Count - 1
  IF Hex_Count = 0 THEN
    Hex_Mode = 0
    GOSUB Hex_Stop
  ENDIF


; STOP & PAUSE
ELSEIF Hex_Mode = 20
  Hex_Mode = 21
  Hex_Count = 2
  Hex_Dir = "a"


; TURN LEFT
ELSEIF Hex_Mode = 21
  Hex_Count = Hex_Count - 1
  IF Hex_Count = 0 THEN
    Hex_Mode = 0
    GOSUB Hex_Stop
  ENDIF


; STOP & PAUSE
ELSEIF Hex_Mode = 30
  Hex_Mode = 31
  Hex_Count = 2
  Hex_Dir = "d"


; TURN LEFT
ELSEIF Hex_Mode = 31
  Hex_Count = Hex_Count - 1
  IF Hex_Count = 0 THEN
    Hex_Mode = 0
    GOSUB Hex_Stop
  ENDIF

ENDIF

WHILE 1

END

; ----- STOP ]----------------------------------------------------

Hex_Stop:
Hex_Dir = " "
PIP_Buff(0) = " "
PIP_len = 1
GOSUB Send_PIP_Packet
RETURN

; ----- ECHO ]----------------------------------------------------

Get_Distance:

rawDist = 0 ; clear measurement
FOR samples = 1 TO 5 ; take five samples
PULSOUT Trigger, Trig10 ; 10 uS trigger pulse
PULSIN Echo, 0, pWidth ; measure echo pulse width
rawDist = rawDist + (pWidth / 5) ; simple digital filter
PAUSE 10 ; minimum period between
NEXT

Dist_CM = rawDist / ToCM ; convert raw to centimeters

; Uncomment line below to confirm sensor function in IDE Terminal @ Baud N81
; SEROUT S_OUT, Baud, "Raw Value: ā€œ, sdec pWidth, " Distance: ā€œ, sdec Dist_CM,ā€ Centimetersā€, CR]

RETURN

; ----- PAN SERVO POS ]----------------------------------------------------

Move_Head_Position:
PIP_Buff(0) = ā€œNā€
PIP_Buff(1) = W_Temp >> 8
PIP_Buff(2) = W_Temp & $ff
PIP_Buff(3) = $5
PIP_Buff(4) = $dc
PIP_Buff(5) = $5
PIP_Buff(6) = $dc
PIP_Buff(7) = $5
PIP_Buff(8) = $dc
PIP_Buff(9) = $5
PIP_Buff(10) = $dc
PIP_Buff(11) = $5
PIP_Buff(12) = $dc
PIP_Buff(13) = $0 ; HI BYTE FRAMES FOR MOVE TO COMPLETE
PIP_Buff(14) = HEAD_LOOK_SPEED ; LO BYTE FRAMES FOR MOVE TO COMPLETE
PIP_len = 15
GOSUB Send_PIP_Packet
GOSUB Poll_Servos

RETURN

Poll_Servos:

; WAIT FOR MOVE TO COMPLETE
; SEND THE POLL SERVO MOVE COMMAND, AND WAIT FOR
; ACK RESPONSE ā€œkā€
LOW 12 ; Turn on BBII red LED when entering loop
PIP_Buff(0) = ā€œnā€
PIP_Len = 1
REPEAT
PAUSE 20
GOSUB Send_PIP_Packet
SERIN SER_IN, Baud, 600000, End_Head_Move, [WAIT($7E), PIP_Len, Temp] 'timeout resolution is now 0.5uS, not previous 1.0ms! 300=150uS!
UNTIL Temp = ā€œkā€
HIGH 12 ; Turn off BBII red LED when exitng loop

End_Head_Move: ; SERIN bail out after 300ms! Seems to get here alot!

RETURN

; ----- PIP Packet ]----------------------------------------------------
; SENDS PIP PACKET STORED IN PIP_BUFF OF PIP_LEN LENGTH
; MODE 1 or MODE 0, DEPENDS ON COMPILATION SWITCH ā€œPIP_MODE_1ā€

; SENDS PIP PACKET STORED IN PIP_BUFF OF PIP_LEN LENGTH

Send_PIP_Packet:
; SEND HEADER
SEROUT SER_OUT, Baud, [CMD_PIP_HEADER]
; SEND PIP LENGTH
PIP_Byte = PIP_Len
GOSUB Send_Byte_Check_Codes
; SETUP CHECK SUM
PIP_Cs = 0
; SEND PACKET
FOR PIP_Temp = 0 TO PIP_Len-1
PIP_Byte = PIP_Buff( PIP_Temp )
PIP_Cs = PIP_Cs + PIP_Byte
GOSUB Send_Byte_Check_Codes
NEXT
; SEND CHECK SUM
PIP_Byte = $ff - PIP_Cs
GOSUB Send_Byte_Check_Codes

RETURN

; SENDS PIP BYTE TO SERIAL PORT AND CHECKS PIP CODES

Send_Byte_Check_Codes:
#IF PIP_MODE_1=1
; CHECK CODE AGAINST ILLEGAL CODES
IF( PIP_Byte = CMD_PIP_HEADER | PIP_Byte = CMD_PIP_ESCAPE ) THEN
; SEND ESCAPED CODE
SEROUT SER_OUT, Baud, [CMD_PIP_ESCAPE, PIP_Byte ^ CMD_PIP_XOR]
ELSE
#ENDIF
; SEND NORMAL CODE
SEROUT SER_OUT, Baud, [PIP_Byte]

#IF PIP_MODE_1=1
ENDIF
#ENDIF

RETURN[/code]

I agree. Get the 'bot walking and responding to PS2 or serial commands first, and then add a ā€œNavigation layerā€ on top to send commands to the ā€œmotionā€ layer. Keep the layers separate.

Check out the CMUcam3! Now thatā€™s a way to navigate!

Alan KM6VV

Hi Daniel,

Phoenix code V2.0 has a separate file for the input commands as youā€™ve might have noticed. This not only makes it possible to easy switch between different remotes like the PS2 and DIY (or Wii) but it can also be replaced for some AI logic. The Autominous part can be as easy or as hard as you want it to be. Itā€™s just a matter of how much logic you want to put in there.

Off course it is easier to add an additional BAP to do the AI so it canā€™t mess up the walking logic. And the AI will have a separate processor to give it more speed.

I hope this helps.

Xan

Ummmmm :confused: What happened to this thread.