The following article has been contributed by Jose Lausuch, Software Developer in Testing for Networking Subsystem at SUSE, and his brother Ivan Lausuch, OpenStack Cloud Developer at SUSE. For Hack Week 16, they worked on the creation of a robotic SUSE Plush Chameleon which can be moved with a common remote control. The purpose of their project was to learn how to program Arduino with servomotors, which they definitely managed very well. This article was originally published as a mini series on Ivan’s web site. But as this project is really cool AND valuable, we decided to make it available to a broader audience. And by the way, if you don’t know what Hack Week is, just have a look here.

In our Hackweek at SUSE we have time to develop our most crazy ideas and projects. My brother and I thought that it could be interesting to create a robotic SUSE pet.


Thus, the presentation of our proposal was as follows:

“The idea is to create a fantastic robotic SUSE mascot using cheap materials. It shall be controlled with you remote control of your TV. After building the prototype the schemes and Arduino code will be delivered for everyone to try building it at home.”

We thought of several movements:

  1. Tail movements, cause it has to be nice
  2. Head movement to be more realistic
  3. And the most difficult part, making it walk


We selected materials that are cheap and easy to obtain. This is what we used:

SUSE Mascot / Plush Chameleon. We used a bigger one in the end, since many things have to fit inside.

An Arduino micro. The Arduino is the brain of the robot. The Arduino Micro is a better option than the Arduino UNO since it’s smaller and it has the same specs.

Some micro-servos. The servos are the core of the movements. There are three sizes (nano, micro and normal).  We used micro because they are cheap, strong enough and don’t take too much space.

A battery. We tried with some 1 cell lipo (1s) of 3.7v but It wasn’t enough to  move all the servos at the same time with out a reset of the microprocessor.  We tried with 9v battery with the UBec which wasn’t enough either. Finally we chose a 2S lipo (7,4v) with a charger that costed around 11 EUR.

A voltage regulator (UBEC). The Arduino and the servos work with 5 volts. If you use batteries with higher voltage than 5 volts, you need to reduce it to not overpower the electronics. There are different solutions. We normally use a 7805 to the circuits but a UBEC is cheaper and supports more intensity (Amperage).

Tons of electric cable. We used individual wires of a UTP (internet) cable.  Everyone has an old UTP cable at home.

IR receptor. This small receptor allows Arduino to receive instructions from an any kind of  remote control via infrared.


Design & Skeleton


First, we did some brainstorming about how to make the mascot walk. We thought that the best option would be to build balanced hips. This means: the chameleon moves up one leg and rotates it forwards without friction. Then it moves it backward at the same time the other leg moves forward.

We needed 5 servos in total:

* Two servos for the legs
* One servo for the hips
* One servo for the head
* One servo for the tail

The number of servos was important because it did affect the battery needs.

First tests

First, we tested all the servos with a standard source code of Arduino that you can find in the examples later on.



Creating the Skeleton

We created the skeleton using 3mm medium-density fibreboard (MDF)

To glue the servos to the wood we used hot glue.

Then we divided the primary skeleton in two parts to create the hips and assemble all together


After that, we made the rear legs.



And then we created the head.


The final result of the skeleton looked already awesome!



The connection pin scheme for Arduino is detailed in the following graphic:

  • Left leg servo (9 pin)
  • Right leg servo (10 pin)
  • Hip servo (11 pin)
  • Head servo (6 pin)
  • Tail servo (5 pin)
  • Receiver IR (2 pin)
  • Testing led (13 pin)
  • 5 volts to (balanced voltage from voltage regulator and servos 5volts



Choosing the correct battery is important, because moving 5 servos comes with real power consumption. Servos are motors – and motors consume a lot of energy.

The problem is that, when a system requires more energy than the battery can serve (amperage of discharging), the voltage drops below the 5 volts that Arduino requires (specs) – and Ardunio resets itself. So, the basic requirement was to constantly maintain a voltage of 5 volts.

Our options were:

  • A small lithium battery (1S 3.7v): We could have converted it to 5 volts, but the energy the battery can provide is low, so it was not enough for our purpose.
  • A 9 volts alkaline battery + voltage regulator:  This worked fine and it did fit inside the body of the toy.  However, when the battery runs out of power, you need to extract the entire battery to replace it.
  • A 2S battery (2000mAh) + voltage regulator:  This also worked fine but was quite big. The solution is to leave the charger cable outside the body of the future robot to charge it.

Brain & Code

With Arduino it is really easy to move a servo to any position between 0 and 180 degrees. You only need to connect the input signal of the servo to a Pulse-width modulation (PWM) output of the Arduino. In fact, there is a library included to move servos.

On the other hand, a servo needs some time to move to the final position. Some servos are faster than others, but typically, 300 ms is a common value to move 180 degrees.  For that reason, you cannot program a servo to do two movements consecutively, because it will cancel the first one. Instead, you have to wait a long enough period of time to complete the first movement before you send the order to execute the second one. You could use a delay mechanism, but since Arduinos have only one thread of execution you can do anything but wait. This is the reason to use a timeout-driven solution (Arduino Timer library). The code is a little more complex, but all delays are removed.

An IR receiver is important, because it passes the orders to the robot. It is an easy way to “command” your robot – and cheap in comparison with Bluetooth, WiFi, or radio. Everyone has a TV remote control at home, with a lot of buttons. In addition, we don’t need to control the robot from another other room. There is a library available to easily send and receive using infra-red signals: IRremote. You can install it from the Arduino library manager.

The source code can be found here:

To compile the code and upload to the Arduino you will need the Arduino IDE.


A state is a loop that cares for doing something special. For instance, the state ‘walking’ keeps our mascot walking.

#define state_stop 0
#define state_walking 1
#define state_happy 2
#define state_moveHead 3
#define state_happy2 4
#define state_crazy 5

In a state, there might be some different steps needed to complete a sequence for the loop.

Structure of the Code

Each state has a setup and a sequence trigger. When the state is changed, setup moves the robot to a neutral position, initializes the variables and launches the first trigger.

This is the setup for walking

void walk(){
 if (state == state_walking)

 state = state_walking;

The trigger will execute the command defined in the current step, increase this step and prepare the next timeout.

This is the state sequence for walking

void walk_seq(){
 int delayTimeout = 100;

 if (state != state_walking)

 switch (state_step){
 // LEFT step
 // move the hip and head to stabilize
 case 0:

// up the left leg
 case 1:

// down the hip
 case 2:

case 3:

// RIGHT step
 // move the hip and head to stabilize
 case 4:

// up the left leg
 case 5:

// down the hip
 case 6:

case 7:

state_step = (state_step + 1) % 8;

 ilTimerControl.timeout(walk_seq, delayTimeout);

The main loop has two missions: it checks the timeouts and it checks the IR incoming messages.

void loop() {

 if (irrecv.decode(&results)) {
   if (results.decode_type == NEC) {
       case IR_up:
       case IR_5:
     case IR_ok:
     case IR_1:
     case IR_2:
     case IR_3:
     case IR_4:

Finally our mascot robot learned how to move – if you want to see the entire story of it’s life and how it is moving and walking, check out our VIDEO.

And now, what remains to be done? Just create your own robot with Arduino and have fun!

(Visited 1 times, 1 visits today)
Tags: , , , ,
Category: Technical Solutions
This entry was posted Monday, 20 November, 2017 at 9:08 am
You can follow any responses to this entry via RSS.

Leave a Reply

Your email address will not be published. Required fields are marked *

No comments yet