Select Page

Accelerometer based Self Balanced Horizontal plateform

This page describes the project named Accelerometer Based Self balanced Horizontal Platform, which is a part of the Embedded Systems-1 course. The aim of this project is to build a Self balanced Horizontal Platform that makes always zero elevation angle irrespective to the elevation angle of the base.

 

Introduction

A vehicle moving on slop having a chance of falling the objects in it. Sometimes dedicated objects may damage or that may be damage or spoiled other items in the vehicle. In hospital when a person on wheel chair or stretcher moving on ramp, it feels problem or sometimes it may fallen. To avoid these circumstances this project “Self Balanced Horizontal Platform” has been designed. This project provide a platform that remains always horizontal irrespective to the elevation angle of the vehicle.

This project operate on the principle of detecting the elevation angle of the platform by using an accelerometer whose output goes to controller that drives the motor to reduce the elevation angle of the platform. Hence it is a closed loop system that gives a platform that makes always zero elevation angle.

 

Component

  1. STM32L Discovery Board Details
  2. LSM303DLM Accelerometer
  3. Motor driver
  4. DC gear motor

STM32L Discovery Board Details

The STM32L Discovery board is based on an STM32L152RBT6 and includes on-board ST-Link/V2 debug interface. The main features of the board which were used in this project are:

  1. The external 3V supply pin which can be used to provide power to Accelerometer add-on board.
  2. The GPIO ports brought out to sides of the board.
  3. Built-in I2C module

The programming of this board can be done on the open-source tool chain as described in the article – Getting Started with STM32L-Discovery Board.

LSM303DLM accelerometer Add-On board

Accelerometer Add-On board

The LSM303DLM is a system-in-package featuring a 3D digital linear acceleration sensor and a 3D digital magnetic sensor. Features Used

  1. Analog supply voltage: 2.16V to 3.6V
  2. One axis acceleration channel (X, Y or Z axis)
  3. ±2g/±4g/±8g dynamically selectable full-scale
  4. I2C serial interface. I2C is used in burst-read mode with STM32L as master and LSM303DLM as slave. Address for the accelerometer is 0x32h. Other register used are as follows:

 

 

 

Data sheets can be referred for detailed definitions of each register bit.[2]

The schematic of the add-on board can be found here : LSM303DLMTR

Motor driver L293D

It is a push-pull four channel driver with diodes.

Features

  1. 600mA output current capability per channel
  2. 1.2A peak output current (non repetitive) per channel
  3. Enable facility
  4. Internal clamp diodes

Description

The Device is a monolithic integrated high voltage, high current four channel driver , accept standard DTL or TTL logic levels and drive inductive loads (such as relays solenoids, DC and stepping motors) and switching power transistors. Datasheet can be found here ([4])

DC Geared Motor

Specification:

  1. RPM 100
  2. Torque: 1.5 kg.cm
  3. Shaft Diameter: 6mm

Interconnection Details

The following are the connections to be made between the STM32 Board, accelerometer and motor driver IC L293D:

 

Circuit diagram of the project is shown below.

 

 

 

 

 

 

 

 

 

Working description

Orientation of Axes of Sensitivity and Polarity of Rotation

As shown in figure above accelerometer LSM303DLMTR is mounted on the platform to read the gravitational acceleration value ‘g’. As platform rotate on any of its axis, accelerometer also rotate, that result in changes in its output respective to that axis. Here rotation with X axis has been taken. The output of the accelerometer is given to the STM32L Discovery board via I2C which calibrate this value. It compares the value with mean value and gives the control signals to the motor driver IC L293D that is a H-bridge motor driver. Motor rotates the platform in order to reduce the elevation angle of it. To control the speed of the motor, PWM signal is given to the enable pin of the L293D that is generated using internal timer-3 of the STM32 that is controlled by proportional controller.

Basic Algorithm

  1. After initialization, the system continuously receives x acceleration values from LSM303DLM accelerometer over I2C interface and calibrate the value.
  2. If X<(mean-error), controller generates the control signal to drive motor that rotate the platform to reduce the value (mean-error)-X. Error has been introduced to reduce oscillations due to back lash of motor gears.
  3. Motor speed is controlled by PWM signal generated using proportional controller generated by formula ((mean-error)-X)*K, where K is the proportionality constant.
  4. If X>(mean + error), controller generates the control signal to drive motor that rotate the platform to reduce the value X-(mean + error). Again motor speed is controlled by PWM signal.
  5. If X>(mean-error) or X<(mean + error) control signal make the motor in stationary position. System goes to first step to repeat the process continuously.

 

Flow Chart

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Power Supply Design

As shown in circuit diagram 5V power supply is given to the STM32 board that is generated by regulator power supply designed with IC 7805. For driving DC motor a regulated power supply designed with IC LM317. As shown in circuit diagram accelerometer Ad-on board get 3V supply from STM32 board.

Point to be noted

This Self balanced Horizontal Platform can be design with precise mechanism such as hydraulic or pneumatic pump or gear drive, to reduce the response time with minimum error and required load capacity.

Applications

This self balanced Horizontal Platform can be used-

  1. In cars to keep dedicated items or foods.
  2. In vehicle carrying chemicals of other sophisticated items.
  3. In wheelchair to make the person always comfort and avoid the condition of falling on ramp.
  4. In stretchers to make patient comfort while moving on ramp.

Video

Watch video here

Source Code

The source code can be found on moodle.

Prepared By:

Harish Kumar Sharma