Micro serial controller, Pololu Mode

We haven’t been able to fix our problem, regarding the java code for the micro serial-8 servo controller, in pololu mode

We are supposed to control a Lynx Robotic Arm with the help of a Modtronix SBC65EC and a Pololu Micro-8 servo controller, and we are supposed to use Muvium software (modified java code)

The blue jumper has been removed, and the servo controller is being powered up before the microcontroller. But still the only thing that happens is that the red light is glowing and the green light is flickering. Nothing more.

It started to move a little bit when there was a problem with the common ground a few days ago, but it was the wrong servos and movements. But it at least seemed like it was moving when it received commands from the controller. When we fixed the common ground again, we came back to the old problem with the red light etc.

Is there anyone that has an working java code example in java?

Here is a drawing of the wiring diagram:

CODE

import com.muvium.UVMRunnable;
import com.muvium.apt.*;

import java.io.*;


public class PololuTest extends UVMRunnable implements SerialPortListener
{
	SerialPort 		vcom0;


    
   
    OutputStream out1   ;
   

	/**
	 * Echo the input..!
	 */
	public void serialEvent(SerialPortEvent event){	}

	
	public void run(){
		System.out.println("Starting..");
	
		
	 
        /**
         * Setup COM0 (RB0)
         */
		 vcom0 = getPeripheralFactory().createSerialPort(
								this, 
                                PeripheralFactory.EVENT_PRIORITY_BACKGROUND,
								SerialPort.COM0 |
								SerialPort.IMPLEMENTATION_UART |  
								SerialPort.BAUD_2400);
		
	 
        
         vcom0.setOutputBufferSize( 50 );


		try{
		 	vcom0.start();
            
		}catch(PeripheralUnavailableException e){
			System.out.println("Err2");
		}	
		
       
          out1   = vcom0.getOutputStream();
          
          
		
    
		while(true){
            try{

//servo 0 Set speed command 50

		out1.flush();
		//sleep(50);
		out1.write(128);
		//sleep(50);
		out1.write(1);
		//sleep(50);
		out1.write(1);
		//sleep(50);
		out1.write(0);
		//sleep(50);
		out1.write(50);
		//sleep(50);
		System.out.println("Servo 0 speed set 50");
		out1.flush();

		sleep(100);
//servo 0 set position command 4000
		
        out1.write(128);
        //sleep(50);
		out1.write(1);
		//sleep(50);
		out1.write(4);
		//sleep(50);
		out1.write(0);
		//sleep(50);
		out1.write(3968);
		//sleep(50);
		out1.write(32);
		//sleep(50);
		System.out.println("Servo 0 postion set 4000");
		out1.flush();
		
		sleep(2000);
		
//servo 0 Set speed command 110

		out1.flush();
		out1.write(128);
		//sleep(50);
		out1.write(1);
		//sleep(50);
		out1.write(1);
		//sleep(50);
		out1.write(0);
		//sleep(50);
		out1.write(110);
		//sleep(50);
		System.out.println("Servo 0 speed set 110");
		out1.flush();
		
		sleep(100);
//servo 0 set position command zero
		
        out1.write(128);
        //sleep(50);
		out1.write(1);
		//sleep(50);
		out1.write(4);
		//sleep(50);
		out1.write(0);
		//sleep(50);
		out1.write(2944);
		//sleep(50);
		out1.write(56);
		//sleep(50);
		System.out.println("Servo 0 position set zero");
		out1.flush();
		
		sleep(2000);
		
                
            }
            
            catch(Exception e)
            {
			System.out.println("drittn verka no ikke en gang!");
			}
			doEvents();
		}


	}
	
}

Hello,

The error you are seeing is the servo controller thinking the serial data is too fast, which it determines based on the first pulse it gets. You should try sending just the first byte (0x80), which should look like a single low pulse 8 bits long (start bit plus low 7 bits). Can you look at the serial line with an oscilloscope or logic analyzer and see what the first byte looks like?

- Jan