Caravan stabilizer

As soon as I bought a caravan, I started thinking on a way to make it safer and more ride-friendly. I found that a well known chassis manufacturer (ALKO) had thought on the same way as me but obviously a bunch of years earlier (and certainly with more dedication and resources).

I decided that I could make a device that continuously monitors the swinging angles of the caravan and if exceeding certain threshold, it could apply the brakes on the trailer for some time. This could be easily done with the help of an Arduino controller and an inertial measurement unit (IMU) such as a MPU-6050.


The operation fundamentals of the caravan brakes are pretty simple; it is applied when the car ahead slows down and the caravan starts pushing it ahead. In this situation, a mechanism pulls a cable (Bowden cable) that lies beneath the caravan applying the brakes on both wheels of the caravan thus reducing the pushing effect on the car.

Figure 1 Principle of operation of the inertial brake

So, by being able to pull the Bowden cable at our desire, we would be able to apply the brakes in the caravan whenever we consider.


To introduce a damping effect in the convoy (car+caravan), some means to apply certain braking effect on the caravan should be needed. This way, in case of a big sway, the caravan is pulled into line behind the towing car thus removing the risk of sway amplification.


In order to introduce said braking effect, an electromechanical device capable of pulling the Bowden cable in Figure 1 is required. Surfing the web, I found this type of linear actuator that could be adequate for the operation. It can push and pull with a force of up to 100 kg and is 12 Vdc operated (what else can I ask for!!). There are different models regarding the stroke, but I decided to go for the smallest one with 250 mm of travel (which should be enough for my purpose).

So then, the idea is to use this linear actuator to pull the Bowden cable whenever is required introducing then the desired braking effect. This could be done as in Figure 2, fixing the linear actuator to the front frame of the caravan and the other side to the Bowden cable (by means of a flexible coupling such as another Bowden cable). This way, the passive inertial braking of the caravan is kept fully operational (this was one of my principal design inputs).

Figure 2 Mechanical assembly of the actuator


Once again, some kind of controller is required to intelligently manage the operation of the stabilizer. And once again, I used an Arduino to provide said intelligence. The basic concept of the brain of this system consist on continuously monitor the sway angles of the caravan and introduce the braking effect when required. To monitor the sway angles of the caravan, a 6-dof IMU (such as MPU-6050) can be used. This device communicates with the Arduino by means of I2C serial protocol. A great Arduino tutorial on how to interface with the MPU-6050 can be found here.

Figure 3 MPU-6050 image

The main problem with MPU-6050 is that it gives instantaneous readings of its sensors (3x accelerometers and 3x gyroscopes) so they are prone to suffer from noise perturbations. Additionally, to calculate the positioning angles of the device from the readings of the sensors is not a direct issue. This is so because the accelerometers provide information about linear acceleration while gyroscopes do it about rotational acceleration.

With the accelerometer readings, one can calculate the positioning angles by considering that only the gravity acceleration is present in the system. With this, the roll and pitch angles can be calculated as follows to avoid numerical singularities (more info here):

But before doing this, the RAW values from the accelerometers need to be scaled to the proper units [m/s^2] by means of the following equation:

The main drawback of using the accelerometer readings is that these are extremely noisy per se, but additionally, as they catch any acceleration applied to the system (such as a bump, centrifugal forces, wind gusts, etc.) the resulting angles can differ from the actual ones on a great manner.

A lot has been written about calculating positioning angles (roll and pitch) from accelerometer and gyroscope’s readings [1,2, and 3]. The simplest way to obtain trustful readings of the sway angles is to combine the readings from accelerometers and gyroscopes in a so called complimentary filter.

Figure 5: Positioning angles

Another yet more complicated way is using the MPU-6050 built-in digital motion processor (DMP). This device allows the MPU to perform the calculations and provide the microcontroller with a kind of structure (quaternion) of filtered and compensated data regarding the orientation angles. In order to use this capability of the MPU, a complex configuration needs to be performed every time the device is powered on. Thankfully, this Arduino library does this work for you.


As usual, I designed a PCB board to assemble all the components on a netly manner. As it can be seen, the Arduino used in this case is a Mega 2560 for its increased program memory and I/Os.

Figure 6: Stabilizer PCB
Figure 6: Stabilizer PCB

Obviously this board includes much more features than those actually needed in this case, but as I have a minimum order quantity of 5 units on my PCB printer (, I try to make them as general as possible to use them on future projects.

Additionally to this board, an Ethernet shield is needed to connect the arduino to the world. Later, I will use a portable router with AP features to provide it with the wireless interface needed to be accessed by, for example, the mobile phone when driving.


In order to get to know what is happening in the caravan, I decided to integrate a web server in the Arduino so that I can connect it with any WI-FI enabled device (such as mobile phone or tablet). This will allow me to have the information about the angles of the caravan while I am inside the towing car. The following link takes you to a demonstration video of the first test I made after programming the webpage and the Arduino.

In the video, it can be seen the web interface that I programmed with HTML and Javascript. Basically it is a page where you can setup some configuration flags for the stabilizer such as:

  • Enabling or disabling it,
  • Start logging the angles and braking orders with 200 ms resolution (the logging is performed by the Arduino into a SD card an later on downloaded to the computer).
  • It can switch the operational mode from ROAD to CAMP mode. In ROAD mode the braking sequence is enabled while in CAMP mode is not.
  • Allow to automatically apply brakes when driving down a slope and the car brakes are applied (slope braking)
  • Modify the braking sequence duration; parameter braking ON time defines the duration of the braking stroke and braking REST time defines the time in which the maximum braking is applied.
  • Furthermore, the webpage includes a trend graph where the angles and the braking orders are plotted with a 1 sec resolution.
  • For levelling the caravan in the camping, I also included a second page (Camp Angles) that show the pitch and roll angles in simple but clear analog gauges.
  • Another option is the manual braking which can be activated in the page Road Web. This basically consists of a pushbutton that activates the braking sequence when pushed.


The sequence and state machine of the stabilizer is very simple. The following three states can happen:

  • Both relays de-energized: the actuator is releasing the brakes
  • Both relays are energized: the actuator is applying the brakes
  • Only one is energized: the actuator is holding the brakes


The wiring of the board is pretty simple since it is everything written on the silk layer of it.

Power supply

To start with, the power supply of the board should be connected to the pins labeled VCC_MAIN and GND_MAIN. At this point, it is important to note that the current required by the ethernet shield in combination with the MEGA and the IMU is around 200 mA @ 5V. The board is prepared to use a 5V regulator (LM7805) to power up everything but during my tests powering the board from 12 Vdc, it heated up so much it just enters thermal protection. In the car, the situation will be somehow worse since the voltages in the automotive industry can reach up to 15 V easily thus increasing the losses on the LM7805. In order to relieve it, I decided to include in between a step-down voltage regulator that reduces the board voltage to around 9 V as it can be seen in the following picture.

In order to use the voltage from the LM7805 (U7 in the board), the jumper JP2 should be shorted. This will override he MEGA’s built in regulator providing a better voltage waveform.


The wiring of the relays is pretty straighforward as seen on the next figure.

Leave a comment