Category Archives: Uncategorized

Bailey: the almost-self balancing robot

They should have also added "...hope for the best"

They should have also added “… and hope for the best”

I decided to start building robots for several reasons, firstly I have always been keen on technology, when I was a kid I spent a lot of hours programming and hacking the Commodore 64. Secondly as designing and programming these things is not a trivial tasks, I hope this can teach me patience and tenacity.

My first design is a self-balancing robot; the idea is to have a system that can sense if it is falling and act consequently. Something like balancing a broom from the tip. I will describe the details of the physical model “inverted pendulum” and the construction of the robot in another post. There are various examples, the most known most-likely being the Segway personal transporter. Inverted pendulum concept

The robot utilizes fairly complex algorithms and hardware. The core is the microprocessor that fuses data from the Inertial Measurement Unit to evaluate the tilting angle in a similar set-up used for missile guidance systems: gyroscope, accelerometer and magnetometer. Once the data is available the next step is to translate the information into instructions for the motor: “we are falling forward, move the motor to catchup” and so on. This is done by a control method called proportional-integral-derivative (PID).

I started designing an building this about six months ago and made countless revision of the software and hardware: today, for the first time, I got something that works. Below the first video of my self balancing robot. Bailey makes a lot of efforts to balance but still seems a bit drunk (hence the name). I guess there is still much to do in terms of tuning the control mechanism (PID) as usually, after a while, it crashes full throttle against the nearest wall. You can see an hit of this self-destructive tendency at the end of this video…

Nevertheless I am very happy with these first results after so many attempts. The next steps will be to add some wireless communication facility so I can adjust the controller parameters remotely without resetting the robot.






How to master any recipe and cook delicious food with Design of Experiments (DoE)

I love to cook. It is a good way to relax and, at the same time, to know what you are going to eat… The technique explained below allows to create delicious recipes and master new culinary treats very quickly.

Many dishes I love are simple. The tricky part is that, unless you know the right proportions and the right cooking process, the outcome can go disastrously wrong, like rock solid or bound with the pan. The difficult part is to learn recipes quickly.

The Design of Experiments or DoE methodology is used in a vast array of applications ranging from drug and medical trials to virtually any engineering domain and… cooking.

A rather academic definition of DoE is “scientific approach to reach the target of a design in a multivariate problem achieved with the minimum number of trials“.

The informal definition is what happen when you are in front of a complex device like a audio mixer or a stereo and – not having read the manual – you want to achieve a specific result, say having the voice of the singer emphasized. People in these circumstances normally start experimenting with various settings by changing the configuration of knobs and button to achieve the target.

Another example is when trying to tune one of the old TV set with dipole antennas: the target is to be able to watch the desired channel and you do so by changing the variables (the tuning knob and the antenna) until you’re satisfied.

Process wise, DoE mostly about: a) what I want to achieve (target function), b) the variables under control,  c) experiments and d) measure and reiteration (ok, I night have oversimplified here).

So how this can help the cooking?

Let’s say that the target function is to do something delicious (needs to be tasteful, look and texture) and the variables are the ingredients. All you need to do is:

  1. Define factors (variables, inputs) and set the levels (a good staring is the original recipe)
  2. Experiment (cook)
  3. Examine the results
  4. Repeat the process until satisfied

A good graphical representation


Finally the trick is to record the experiment and its results in a simple way to link the variables with the result. See below an example recipe:

Recipe: Farinata Experiments
#1 #2 #3 #4
Chickpea flour [g] 130 110 180 130
Water [ml] 400 300 450 400
Oil [ml] 110 150 110 80
Oven [C] 230 250/3 250/2 250/2
#1 Oily and not crispy (more like pudding)
#2 Too dry, oily
#3 Too thick and oily
#4 Perfect! (500ml per pan)

This recipe is a good example as the basic ingredients are very simple but a slight variation will lead to a very different (and most-likely not tasteful) result.  One difficult parameter to control is the thickness of the farinata, that ultimately depends on the amount of ingredients poured in the pan (the recipe above is optimized for a pan diameter of 25cm).

All of this might seems complex, but it is really simple when applied practically, the only difficulty is to be diligent in logging the experiment.


Source of the DoE factors picture above:

For everything you will possibly need on statistics and much more try the National Institute of Standard and Technology (NIST) Handbook:

Farinata recipe