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


No comments:

Post a Comment