Sunday, May 12, 2013

Additional external devices


Hello. Today I’ll describe an additional devices, which could be useful during quadrocopter’s flight.

             1)      Accelerometer/Gyroscope
Nowadays, there’s increasing amount of both devices “hidden” in one package, so I’ll describe it together.
Accelerometer is a kind of devices, which measure the acceleration in different directions. The main force, which act on us every time is gravity, but by moving something we can produce acceleration. This force is visible for example during moving by cars or other means of communication, and physics have described it well for hundred year. Accelerometer can measure force acts on different directions, but most common type is three-axis device. It measures acceleration like in Cartesian coordinate system (z axis corresponds to gravity force). Also, if accelerometer rest relative to the Earth's surface, it will indicate approximately 1 g force.
There’s a few kind of electrical accelerometers: piezoelectric, piezoresistive, capacitance, and MEMS (micro electro-mechanical systems), and all of devices acts in different way. In piezoelectric accelerometers every change of acceleration change a charge of piezoelectric crystal. Changes can be observed by an implemented circuit and then transmitted to the user. Piezoresistive devices change its resistivity due to outer forces, and the Wheatstone bridge implemented in core helps to detect it. Capacitance devices act by changing a capacitance of built-in sensitive capacitor. It’s changing its charge depending on accelerate force. Then, the very precise analog-to-digital converter reads this value (after an amplification) and sends it to user. MEMS sensors works in the other idea. It contains a small heater at the bottom of a very small dome, which heats the air inside the dome to cause it to rise. A thermocouple on the dome determines the levels of signal - temperature (like ADC before) and in this way the acceleration is detected.
Accelerometers can be used to measure vibration on cars, machines, buildings, process control systems and safety installations. They can also be used to measure gravity, seismic activity, inclination, machine vibration, dynamic distance and speed with or without the influence of gravity. Nowadays, accelerometers are more and more popular in smartphones, tablets and other kind of electronic amusement, where movement has a significant influence of contest. There is a lot of software applications which react on move of user (and there are usually connected with some gyroscope). Nevertheless, now almost every new phone, tablet has accelerometer (it has also gyroscope, which is described below).
Gyroscopes measure angle of rotation or movement.  Mathematically, it is easier to works with accelerometer in Cartesian coordinates. Using gyroscope, it is easier to use cylindrical coordinate system. Gyroscope is more complicated than accelerometer, so if anyone is interested in: how it exactly works, please refer into some more specialist literature. Electronic devices are usually based on similar constructions like those mentioned earlier. Applications also are similar.
 Gyroscope also can act in three dimensions (due to different coordinate system, there are not similar to accelerometer’s one, but the main rule is exactly the same). And if our device has three axis accelerometer and three axis gyroscope, we can call it 6-axis motion device.
Why am I describing accelerometer and gyroscope? Because it is most important external device, which we will use in our quadrocopter project. Now I can tell that it is important to build reliable PID controller, and it is necessary during flight. We are using MPU-9150 from Invensense. It is MEMS sensor, including accelerometer, gyroscope and accelerometer and also can measure temperature . It is 9-axis motion device (3 axis for accelerometer, 3 axis for gyroscope and 3 axis for magnetometer); it is very precise low-power sensor with changeable ranges. It could communicate by I2C serial bus (100kHz and 400kHz). The most important thing is, that it has implemented DMP (Digital Motion Processor) with FIFO buffer and possibility of data fusion in few ways (for example: raw data, quaternions, Euler angles etc.) and sending it. It is very interesting device. 

             2)      GPS Tracking
GPS (Global Positioning System) is well known now, cause its popularity. It can be found in mobile phones, tablets, navigation devices, buses and trams – it is everywhere! The main rule of working such a system is comparing times of propagating and phases of electromagnetic waves transmitted from space satellites. Then, some complicated algorithms are able to determine the exact position. If anyone is interested how it exactly works – please refer to some special literature.
Why could it be useful in quadrocopter? To determine the position of vehicle in any time of flight (but please still remember that GPS device cannot refresh with higher frequency than 10 Hz), and then for example save it in memory (SD or MMC card) and display coordinates as a points on map on personal computer. 

             3)      Altitude meter
Altitude meter, or altimeter, is useful device to determine approximately altitude of flight. In some cases, it depends of Above Mean Sea Level, but not always. The most reliable way to determine altitude in quad is to measure air pressure differences (higher altitude=lower pressure) during the flight. The simplest way to obtain this is using some barometer or other sensor which can measure air pressure. Producers sometimes gives an equations to determine exact altitude while pressure is changing. Approximately, air pressure decreases with an increase of altitude—100 hectopascals per 800 meters. If we had respectively sense device, we can achieve even less than 1 meter accuracy of changing the altitude! I will not describe how barometer works, I can add that in some cases GPS can determine altitude (if 4 or more satellites are reachable in our reception, but it is not very precise way).
It is everything for today, in nearest future we will show our progresses with more detail. We will publish some schematics, PCB projects, how PS2 controller works and more details about PID controller implemented in microcontroller. Stay tuned with us!

References:
             1.       http://en.wikipedia.org/wiki/Accelerometer
             2.       http://www.sensr.com/pdf/practical-guide-to-accelerometers.pdf
             4.       http://en.wikipedia.org/wiki/Gyroscope
             5.       http://www.invensense.com/mems/gyro/mpu9150.html
             6.       http://en.wikipedia.org/wiki/GPS
             8.       http://en.wikipedia.org/wiki/Altimeter

More sophisticated links:
             1.       http://www.memsuniverse.com/1548-2
             2.       http://www.pcb.com/TechSupport/Tech_Accel.aspx#.UY-bUsrg2So
             3.       http://www.astrise.com/research/library/memsgyro.pdf
             4.       http://rhp.detmich.com/gps.html
             5.       http://www.hills-database.co.uk/altim.html
             6.       http://www.dutchops.com/Plane_Tech/Instruments/Altimeter.html

Thursday, May 2, 2013

Remote controller - part 2.



Welcome everybody :)

Today I would like to briefly describe how our remote controller will work. As you already know, we decided to use game controller from Play Station 2. The idea how to use PS2 pad in the right way for this type of application is quite well known and described. I think it is not necessary to rewrite everything from our main source, which has been used by us during works, so if anyone would like to find out something more about it, please refer to our 1st source in references. 

To build wireless PS2 pad we need to have 4 main components. First one is PS2 pad (we bought it for 20 zł), the second one is wireless module. We decided to use HMTRP module working on 868 MHz frequency. Datasheet to this module can be found
at number 4 in references. The 3rd one part which is necessary to build our pad is battery, and the fourth one is microcontroller (uC). We will probably work on single-cell LiPo (lithium polymer)battery with capacity of 400 mAh.  To control and to communicate whit pad we need microcontroller. We chose, dedicated to low power applications, MSP430G2553 microcontroller from TI (Texas Instruments). It is small and also has enough outputs to connect everything what is necessary to it. We chose it also because we have so-called Lunch Pad with  this processor, so it was easier to learn how to communicate with pad, without having to do our own experimental board at first. The idea of our remote controller is quite simple. We want to read if any button is pressed or not, and send this information to another uC (which is steering quadro) using wireless module. To communicate with pad it is necessary to use SPI interface (Serial Peripheral Interface).  In this case our uC is master, and pad is slave. So we are starting communication and if we want, we can stop it – pad only responds to our request. To use pad we need only few lines connected to our board. Of course we need power and ground (3.3V and GND). Lines corresponding to SPI interface are:

  • MISO (Master Input Slave Output) 
  • MOSI (Master Output Slave Input) 
  • CLK (Clock) 
  • MSC or SS (Master Select or Slave Select)

First line is the DATA line, because this line is used to send the data about buttons from pad to uC. Second line is COMMAND line (it is used to send configuration commands from uC to pad). The 3rd line is clock line, used to synchronized communication. MSC line is used to select master (device which is initiating communication and generates clock). Additional lines available in pad are: ATTENTION, and vibration motors power line. ATT line is used to confirm the correct receipt of data. This line may be unused  (always in high state). Last line serves to supply voltage to vibration motors (7.2 – 9V) – we are not using this line.
As I mentioned, all information about way of communication with pad, it’s configuration and also about meaning of received data are presented very well on the website from 1st reference. After appropriate pad configuration we achieved a reading of the relevant parameters of buttons. Now we know which button was pressed and with what force.  After one reading we have data about all of the buttons and we can send all of data (or only some of the data) to quadrocopter using wireless module. Having this data it is only necessary to take the appropriate action corresponding to the pressed button.

To send data using wireless module it is necessary to use UART (Universal Asynchronous Receiver and Transmitter). It is second (after SPI) communication interface of our uC. It is the primary interface occurring in almost every uC. HMTRP works in such a way, that sends using radio everything what we send to it using UART. It is also possible to configure wireless module in proper way. This module retrieves the most current of all parts of remote controller. Because of this, we are putting it to sleep every time when it is not needed.
We also decided to applied ability to measure battery voltage in our wireless controller. It is useful to have knowledge about power level. It is simple mechanism which measures voltage using 10-bit ADC (Analog to Digital Converter) and when this voltage is too low, status LED will turn on. Than we now that we need to charge the battery in a short time.

We are currently at the stage of making dedicated PCB (Printed Circuit Board).  We will share with you with results of our work, as soon as we finished. 
That’s it for today:).
Have a nice long weekend :).

References: 

  1.  http://store.curiousinventor.com/guides/PS2/
  2.  http://pl.scribd.com/doc/86204752/Decoding-PS2-Wired-and-Wireless-Controller-for-Interfacing-With-PIC-Micro-Controller
  3.  http://www.lynxmotion.com/images/jpg/wire08s.gif
  4.  http://www.hoperf.com/upload/rf_app/HM-TRP.pdf


Sunday, April 21, 2013

First flight and first blood



Hi :) Finally, we achieve such a configuration that our frame could raise for a few centimeters above floor. We have check additional battery and bought another couples of propellers. It was caused by not enough thrust – it was too low. We could achieve only ~300 g max thrust. We were using 2Cell battery and 9x4.7 props (CW and CCW). So we decided to do some changes ;) we decided to try recommended by producer both battery and props: 3Cell battery and 10x4.7 propellers. They promised to obtain over 700 g of thrust. In best ways we achieve ~550g, which is not close to that promises, but also good enough :) From simple calculations followed that theoretically we should flight:
4*550g = 2200g > 1000 g
Our frame weights below 1000g, but the propellers weren’t achieve exactly 550g, so approximately it looks fine. We didn’t want to wait, so we mounted our frame immediately:




We did two tests. At first time we used cable-communication, at second – wireless communication. The very good news is, that we have enough thrust to flight :) on above ~40% of full power quad  started to increase its altitude. But second start was not so fortunately and I have to visit surgeon:
Warning! Photos are not for sensitive persons


We have to be more careful in next tests ;) Stay tuned with us!

Saturday, April 13, 2013

Steering Motor



Hello :). Today I’ll try to describe how brushless direct current motor (BLDC motor) works, and how to steer it. At the end I’ll show our movie how its rotating :)
Such a motors contains of some coils, which are connected to each other in star interconnection. Basically, there’s only 3 coils which are immovable - in opposition to a magnetos. A drive shaft could rotate because it is attached to a  movable case. Due to low friction it can rotates freely. If we want to rotate the shaft, we have to deliver current to a single coil, and it have to leave circuit by another coil (third one should be Hi-Z, and it doesn’t conduct current). In this situation some magnetic field is inducing, and it acting with magnetos in nearest area – it moves them. Next, the current is conducted by another couple of coils. It is shown at below figure.


Figure 1. Coils

BLDCs are kind of actuators which haven’t got any commutator. It is very helpful, and it’s caused by fact that it works as current inverter from DC to (approximately) AC. It is not sinusoidal current. Next figure presents some BLDC actuators. To our quadrocopter we are using out-runner type.
Figure 2. Types of BLDC motors
There’s still a question – how to steer such a motor? We have to use some equipment, which acts like inverter – it converts direct current into alternate current. We are using some Electronic Speed Control (ESC). It delivers current in some triangle/trapezoid shape. It is shown at next picture.
Figure 3. Plot of currents
That shapes are a bit complicated, so I decided to not describe them ;) In fact, such a steering is good enough to force motor to rotate. But, ESC would not act as it wants; we have to use some microcontroller. On below figure is shown, how to connect uC with ESC, and generally how ESC looks like inside.
Figure 4. How to connect uC and ESC to BLDC motor

As you can see, inside the ESC are some kind of bridge (build from MOSFET transistors with diodes). It provides properly shift phases and thanks to that, current looks like in the upper figure. Of course, there’s also some protection circuits, feedback signals and current measuring. And I have to add, that how fast the motor is rotating (angular velocity) depends directly by us. We could steer ESC by PWM signals, and it is translated by some control circuit in ESC to proper motor steering. In most cases, it looks like on below figure:

 
Figure 5. PWM steering signal
Our microcontroller send PWM signals with ~50 Hz frequency (every 20 ms). The angular velocity of BLDC motor depends of pulse width. The lowest case (lowest rotates) are if pulse is 1 ms width, the greatest – 2 ms. If our ESC provides rotation in both directions (clockwise and counterclockwise) there we could divide our pulse range into a two areas – the first 0.5 ms (form 1.0 to 1.5 ms) our motor will rotate clockwise, in second part (from 1.5 to 2.0 ms) it will rotate in opposite direction. If we have ECS which provide rotates only in one direction, we are forced to use pulses in range only 1ms – 1.5 ms. But, direction of rotate depends on how we connect motor – changing two cables we could obtain rotating in opposite direction.
And there’s a movie which shows how our motor rotates :) please watch it only in high quality ;)

References:
(Sorry for mainly polish references)

Friday, April 5, 2013

The parts have come!

Hi everyone ! :)
Today we collected almost all of needed parts. Here is some photos of them:

Parts needed to build a frame

Motor on single arm of frame




A PS2 Pad, which will be used to control Quad



PS2 Pad connected to MSP430 (top) and RF transceiver (on the left)

Screws, bolts and spacers

Motor with fitted propeller (bottom) and ESC (top)

All needed ESCs

Propellers - 4 pair of clockwise and counterclockwise

Our battery - LiPo, 2100 mAh, 2 cells (7.4V) maximum discharge - over 60 A!

Battery and charger

Connectors


 Till the end of this week, I try to add a photo of properly motor during working :) I can't wait to run all of this!