Servotor32 2.0 Firmware


I’ve been working like crazy for the last week to package the firmware all nice and tidy, as well as write a new backend engine for servo update that doesn’t require any manual updating by the users’ code. What this really means is:

Hexy is now way easier to code for!

[ul]- The mess is all hidden, its now all in an easy library we’re now writing docs for

  • New backend that doesn’t require manual updating. Tell a servo to move, it moves! You don’t even need to know its there anymore.
  • A driver is now included for the ultrasonic module, as easy as calling
  • The board now automatically configures the bluetooth module once plugged in
  • Debug printouts for those so inclined on knowing more how the code works
  • Way more commenting to make it easier to understand the code, and to make your own[/ul]

I’m still working on adding arduino move-generation to PoMoCo, but progress is going well. I can now generate moves with python code that you can copy-paste into the arduino code. One step easier in making Hexy more autonomous.

You can get it here

Hexy connected, but servos don't move

If you connect a smartphone with bluetooth the following lines in Servotor32.cpp hang the phone :astonished: . (mine is HTC Desire)

Serial1.begin(115200); // Changed from 9600 baud Serial1.print("AT+BAUD4"); // Tell the module to change the baud rate to 9600

Don’t know why bluetooth module is forwarding that AT command.


What baud rate is your phone connecting at?


Don’t know if this is the right space to put up feature requests, but I’ve been thinking about complex movements and the Servotor32 firmware. Currently if I want to move a foot through space along an arbitrary path (using inverse-kinematics to determine joint angles), I have to send these discrete positions of the joints down the serial line at a particular rate. Of course, I could just send the final demanded joint position, but this is likely to cause everything to move at once, potentially going through some undesired leg positions.

Could a future firmware support messages that describe paths as well as the current points for the robot? This will add some processing overhead to the firmware, which might be asking too much. Or should we just be judicious with our use of the serial messages through current communication methods?


For my part, I’m looking forward to timed moves. :slight_smile:


Well im doing something close to timed moves right now, the thing is you need to put a time.sleep command after every move you write. Imo working on a 1 leg at a time gait currently.


I’ve been working on timed moves in PoMoCo for my custom electronics and I’ve run into the problem that the loop itself doesn’t execute in zero time, so the time.sleep() has to be dynamically adjust each loop. That still doesn’t work 100% since python may sleep a thread a bit longer when processing the others.

You can fix my hacks at … ne-hexapod

The electronics I’m using are a beaglebone board with 2 16 channel i2c PWM controllers, no communication overhead with 9600 baud there, only slow python on the 700MHz cpu.


Im really thinking about getting a normal arduino controller for hexy, like a mega or spider controler. PoMoCo and the servator is just not worth the time for the 40$ a new board would cost that i can write arduino code for.


It would be incredibly difficult to write moves for Hexy without having some sort of software to generate those complex moves. Namely, PoMoCo. You can also just write arduino code for Servotor if that’s your wish.



I looked at the interrupt routine (Timer1 callback). The main ansatz is
the check “(timer == servo_timings[counter])” every 10μs to find the desired moment for the servo signal update. (timer cycles between 0 and 2000).
The interruption will be triggered by some cycle counting ( see pwmPeriod variable).

Couldn’t the check ever 10μs replaced by a check at the right moment? (Change of the interruption period on every call.)
This would reduce the interruption calls by a factor >30. I’ve already implement this change, but my version did not work until now and I want ask if I overlook some insolvable problems.


The problem with that is, setting up a timer takes time, throwing off the accuracy of the timing by a factor correlated to how many updates you need to do (between 0 and 40 times per 20ms). Its not just an error amount, its variable error.


But isn’t the setup of the of the timer just one operation?
Something like that:

(servo_cycles is computed in update_registers_fast).


It is, but it also makes it much more fault-intolerant. If it misses just one interrupt firing (like say, if the USB interrupt triggers), then everything down the line is messed up and the servo motion locks up.


Ok, that’s true.
Did you know how many cycles/overhead the call of an interruption costs? I’m interested in the general load percentage of the Servotor32.


I have been having trouble loading the Servotor32 firmware. I am using a Dell Latitude D430 small laptop running Windows 7 Home Premium. I get no ports in Device Manager when I plug in the cable to the computer. I managed to get a port to show up doing a driver update, but it was not functional. I tried to plug in an Arduino Uno with no resulting port either. So, I took the laptop to my local PC shop. Now, when I plug in the Arduino Uno, the computer beeps and displays the Uno port in Device Manager. But, when I plug in the Hexy board, nothing! One time only, when I plugged in the cable, all the legs adjusted position very briefly. I have tried an alternative cable I had. No result. It is as if the board logic is dead – except, when I plug in the 5 battery pack NiMH pack, I can occasionally get all the legs to adjust themselves to approximately stand up position. Since I can’t upload the Servotor software without an active port, I can’t get HEXY to do anything, much to the disapointment of my 6 year old grandson and me. Any thoughts I could try would help. Hope the board is not dead!


Were the drivers installed from the website? … 20v1.1.exe

If so, does a com port come up in the arduino software?

If so, are you able to get the board to respond to commands?

If so, does PoMoCo work at all when connected? Can you press buttons and have it move?


I have uninstalled servotor and reinstalled. When I plug in the board with the USB cable, there is no response, no ports show up, no beep indicating a new device was plugged in. If I unplug the Hexy and plug in the Arduino Uno, it beeps and serial port COM5 appears in the Device Manager.
It looks like there is at least one LED just to the left of the reset button. Should I see any action on that LED when I plug in the HEXY board? I don’t see anything happen.


That light is the power light, and should light up green. If you plug it in and it doesn’t light up, the USB cable might be bad (which would be weird, we hand-test each cable before shipping them out). Does it light up when you plug in the battery pack?


I have tried two different USB cables. Each one works with the Arduino Uno, neither powers the LED or HEXY. I tried the four battery pack in the 5V-10V input. Meter says I am supplying 6.5v with new batteries. The power LED does not light up.
I probed several spots on the board but could not read voltage (I can detect mV levels with the meter) but found no responses. OK, I thought, what if one of the 19 servors is somehow shorting out the boards ability to function. I unplugged all the servos (yuk) and plugged in the batter pack again. No power LED light. I checked the solder joints where the power is plugged in, the board is getting the voltage, the female socket is working. I checked the other socket (with no servo power pack plugged in) while the logic power was still plugged in. It showed -6.5 volts, so some voltage is getting to the board.
To be thorough I decided to check again with the USB cable. Wow, the green light came on and Arduino Leonardo showed up in the Device Manager under Other Devices. However I got an error related to the driver. Out of curiosity, I plugged in the infrared detector and lo and behold, the green light went out. So, I reverse it and the light stayed on. So, now I have hope of working out the problem. However, the logic batter back still will not light the power LED.
I have a project that will sap all my time for the next week or more, so won’t get back to this for a while.
I hope this information is useful to someone else as well.


Can you email We’ll go ahead and replace the board, and see if that helps.