Go Down

Topic: Balancing robot for dummies (Read 145 times) previous topic - next topic


@SnakeLT: Its ok. Thank you for your answer. Your robot is really awesome! ^^

@Patrik: I think that you shouldn't perform the data acquisition with a sample time of 10 (ms) in Windows (.NET), because Windows is not a real-time OS and 10 (ms) seems to be a little bit too fast.

@richiereynolds: When sending data to the GUI, You should encode your data using numbers in stead of characters. That way you will save a lot of bandwidth as well as processing time.


kas,thanks for your suggestion.it is the parmeter! After modifying them, the effect of kalmanfilter is much better.

;D ;D ;D ;D ;D


I have also ported the GUI to the .net platform but I'm not satisfied with the serial communication. Is there any one how has a good idea how to send the amount of data I'm doing in a better way

Hi Patrik
My first idea is to increase data speed transfer to 115200 bps
I went on your blog http://www.x-firm.com/?p=246
and checked BalancingBotGUI v1.2

- In BalancingBotGUI_v_1_2.pde,
Code: [Select]
 Version log:

   v1.2  ...
       Changed the serial speed to 115200 kb/s

- in serial_screen.pde,
Code: [Select]
void setupSerial()
 myPort = new Serial(this, portName, 19200);

I am confused, are you still transmitting @19200 bps ??  :-?
Please clarify



I have bean running it on 19200bps I tried with 115200 but I went back to 19200 and just sending data each 5 loops..

Is there any downside with using 115200?

What I saw when sending data each loop the arduino could not hold the loop time any more... But when I send it each 5 loops it seams to be ok running around 7-8ms before delay,,,

But maybe I'm fueling my self and each 5 loops the fixed loop time is of and maybe that will give faults in the regulation of the robot..

I want to find a way to be able to send the amount of data I'm sending now in each loop with out going over 10ms.. But still maybe only send It each 5 loops because I don't think the GUI will be able to read it faster..  

I have a idea of sending parts of the data under five loops and then start over like.
Code: [Select]

switch (loop_count){
 case 1:
    //send PID values
 case 2:
    //send PID parameter values
    //K value as float
    //[id byte][split][value][value][value][value][CR]
    //Kp value as int
    //[id byte][split][value][value][CR]
 case 3:
    //send Sensor values
    //send Angel values
 case 4:
    //send Torque values
 case 5:
    //send Settings values
   loop_count = 0;

What do you think about that? And in your opinion what baud rate should we use if possible?
The balancing robot for dummies guide


Jan 04, 2011, 10:53 am Last Edit: Jan 04, 2011, 10:55 am by kas Reason: 1

For my poor english, i do not understand clearly ACC and Gyro is in phase,

My English is not good either  ;)
I mean that the Gyro signal (angle variation, deg/s) can be seen as the first derivative of the ACC signal (deg)
Gyro signal should be zero when ACC signal is horizontal (dX/dt=0)
On the first diagram the red curve cross the zero axis when the black curve reaches a max or a min.

This is also noticiable on the left side of your second diagram.

Kalman parameters are specific to sensors type (noise)
Now your filtered angle is much better, but too much filtered  ;)


What do you think about that? And in your opinion what baud rate should we use if possible?

I will experiment and be back by the end of the week

Go Up