Hitec Servo HMI interface

Hi all.

Does anyone here have any experiance with the Hitec HMI? (Hitec Multi-protocol Interface)

From the details I can find it's a Atmel chpset with a serial interface running at 19200, 8 bit, 2 stop bit.
I've managed to get the servo to talk to a computer directly using the Hitec software. It does not give much in the way of programmable control though. I cant seem to get the Arduino to generate the correct interface.

The data is sent as 7 bytes (1 header, 1 command, 2 inputs, a checksum, and 2 dummy outputs that the servo pulls down to send)

I have the servo linked to pins 1 (via a 3.3k resistor) and 2 (direct)

pin 1 --3.3K--Servo--pin 2

Has anyone had any luck, or feel up for a challenge?

Cynar

I know I could go out and look for links to this stuff but it would be better if you would include them in your post. Saves us all time.

my appoligies, i'm currently at work and so dont have the actual links to hand. I'll update them later this evening when i can.

Does this help? http://robosavvy.com/Builders/i-Bot/HSR8498HB%20Servo.pdf

That's the main one I've been working from.
There's also a bit more info at:-

as well as a program that reads from the servo. (so the servo works, just cant command it :-S)

FYI, this is the servo I'm using:-
http://www.servocity.com/html/hsr-8498hb_hmi_robot_servo.html

By can't command it do you mean set the parameters or make it move? From what I read the HMI is to set up the servo and you use normal servo (600 to 2400 us for this one) with a 20ms pause between pulses.

The HMI protocol allows you to do a load of things that you cant do with a standard analog pulse. The main being the ability to control several servos with a single line, as well as control speed and read/write to the servo's internal memory.

The command set includes positions as well as speed settings, release and position read capabillity. as well as things like deadbands etc.

The most annoying thing is, I've had them all working from a PC, problem is getting the Arduino to generate the correct seral pulse.

I think the problem's with the 2 stop bits, as far as I am aware the Arduino Diecimila only uses 1 stop bit. I've tried a few commands to change it but they either do not work or change the serial connection is strange ways.

Right, I've managed to get the Servo to respond to commands using the following code.

    /* DEFINITIONS */
#define FOSC 16777216                           // Clock Speed
#define BAUD 19200                              // Serial Communication Speed
#define MYUBRR FOSC/16/BAUD-1                   // Time per Bit

    /* PROTOTYPES */
void CustomSerial(long ubrr);                    // Initialises the Serial Protocals on TX and RX with 2 stop, 8 bits
void dataSet(byte data1,byte data2,byte data3); // Sets Serial data to be written
void dataWrite(void);                           // Writes current data to the Servo via serial

void setup() 
{ 
  CustomSerial(MYUBRR);
} 
 
 byte data[7];

void loop() 
{ 
  // Servo ID set to 0x01
dataSet(0xE9,0x01,0x01);    //Sets Speed to min
dataWrite();

dataSet(0x01,0x03,0x03);    // Moves Servo to position 1
dataWrite();

delay(20000);            // Waits for servo to reposition, V.slow on min speed

dataSet(0xE9,0x01,0xFF);  // Sets Servo to max speed
dataWrite();
dataSet(0x01,0x06,0x06);  // Moves servo to position 2
dataWrite();
delay(1000);

} 

void CustomSerial(long ubrr)
{
  UBRR0H = (unsigned char) (ubrr>>8);
  UBRR0L = (unsigned char)(ubrr);
  //UCSR0B = (1<<RXEN0) | (1<<TXEN0);
  UCSR0B = 0x98; // Value to allow both RX and TX with servo
  UCSR0C = (1<<USBS0) | (3<<UCSZ00);
}  
  

void dataSet(byte data1,byte data2,byte data3)
{
  data[0]=0x80; // Command
  data[1]=data1; // Command type
  data[2]=data2; // Data 1
  data[3]=data3; // Data 2
  data[4]=256-((data[0]+data[1]+data[2]+data[3])%256); // Checksum
  data[5]=0x00; // Return 1
  data[6]=0x00; // Return 2
}

void dataWrite(void)
{
  Serial.write(data[0]);
  Serial.write(data[1]);
  Serial.write(data[2]);
  Serial.write(data[3]);
  Serial.write(data[4]);
  Serial.flush();
  Serial.write(data[5]);
  data[5]=Serial.read();
  Serial.flush();
  Serial.write(data[6]);
  data[6]=Serial.read();
}

Just a couple of problems still though.

First, I need to use a circuit to invert the outgoing data which isnt ideal. Is there a simple way to reverse the logic levels on the Serial connection.

Secondly, I cant seem to get RX to work at all. The servo pulls down on a null packet to transmit. however I cant even get the Arduino to read it's own output. I've tried connecting RX to TX directly, as well as via a resistor and/or via a transistor inverting the signal. I know the RX works since it can receive data from the computer.

It's fustrating to be so close and yet not be able to figure it out. Can anyone spot what I'm doing wrong. I'm guessing the problem's somewhere in the CustomSerial function, but I'm not sure.

Thanks for any more assistance.

Cynar

I have talked to these with the ATmega128.

I just wonder at first if your type "byte" is signed or unsigned.

I use an unsigned so that 256 - 0x** produces the correct result.

If you are still having problems let me know.

I have started to work on this project again...since Robogames is approaching fast!

Dan

I also try to do this, I'm interested in controlling Hitec servo mounted on Robonova.

So I've found the HMI interface circuit on this pdf
Sorry this is my first post anda theboard musten't allow me to post active link

this interface is working??

The HMI interface works with the pulse or serial modes. My posts on Robosavvy are fairly old and there is more docs and software published since by Hitec and others.
Let us know here or on robosavvy if you have specific problems.

I'm problem using HMI in serial mode, becaouse I've no idea how to biuld interface hardware between servo and tx/rx port on arduino

The circuit in the article should work for you.
Because the speed is 19200, you will have to use the UART, and not software serial.
The circuit simply inverts the TX and RX for interface to the servo.
The red wire on JP1 goes to the Arduino operating voltage.
Vbat is the servo power supply (6V).
Gnd needs connecting. TX and RX will swap over to connect to the arduino TX and RX.