Monday, June 2, 2008

Wireless Accelerometer Based Mouse

we are using CYWM6935 Wireless integrated module with antennas using DSSS technique over 2.4 GHz ISM band. It can work as ‘TRANSCEIVER’ at same time. With BLUETOOTH STACK it can be made to communicate with any Bluetooth enabled Mobile Phone. Below are the features of wireless radio module.

CYPRESS Wireless Radio module: Features

  • The CYWM6935 LR 2.4-GHz DSSS Radio SoC Module includes radio (CYWUSB6935) , antenna, and all external components
  • Operates in the unlicensed Industrial, Scientific, Medical (ISM) band (2.4 GHz–2.483 GHz).
  • -95-dBm receive sensitivity.
  • Up to 0dBm output power.
  • Complete Radio Module with Dual PCB Trace Antennas.
  • Range of up to 50 meters or more.
  • Data throughput of up to 62.5 Kbits/sec.
  • SPI microcontroller interface (up to 2 MHz data rate)
  • Operating voltage from 2.7V to 3.6V.
  • Dual DSSS reconfigurable baseband correlators
  • 13-MHz input clock operation
  • Low standby current
  • Integrated 30-bit Manufacturing ID

Functional Description:

The CYWM6935 Wireless USB LRTM Radio Module offers a complete radio module solution for integration into existing or new 2.4-GHz products.
The CYWUSB6935 transceiver is a single-chip 2.4-GHz Direct Sequence Spread Spectrum (DSSS) Gaussian Frequency Shift Keying (GFSK) base band modem radio that connects directly to a microcontroller via a simple serial peripheral interface (SPI).
  • It supports up to 78 channels of 1MHz each with 49 Golden Codes in each channel with Direct Sequence Spread Spectrum a theoretical capacity of 3822 channels.
  • Thus it can be used for both Point to Point & Multipoint communication.
  • Normal or double data rate with 32chips / 2 bit.
  • There are 64 Configurable Registers for various Settings & Adjustments.
  • No. of chips per bit can be selected as 32 chips/bit or 64 chips/bit by REG_DATA_RATE Register.
  • Power levels can be set from 0 to 30 DBm with REG_PA Register.
  • Dual base band correlate Receiver with data registers as REG_RX_DATA_A & REG_RX_DATA_B Registers.
  • EOF, Overflow & Underflow indication of received data for reliable communication.

Serial Peripheral Interface:
The SPI allows high-speed synchronous data transfer between the Microcontroller and peripheral devices. The SPI consists of four different signal lines. These lines are the shift clock (SCK), the Master Out Slave In line (MOSI), the Master In Slave Out line (MISO) and the active low Slave Select line (SS). When the SPI is enabled, the data direction of the MOSI, MISO, SCK and SS pins are overridden according to the following table.
The SS pin in slave mode is always an input pin. A low level activates the SPI of the device while a high level causes its deactivation. The master is the active part in this system and has to provide the clock signal a serial data transmission is based on. The slave is not capable of generating the clock signal and thus can not get active on its own. The slave just sends and receives data if the master generates the necessary clock signal. The master however generates the clock signal only while sending data. That means that the master has to send data to the slave to read data from the slave.
The system is single buffered in the transmit direction and double buffered in the receive direction. This influences the data handling in the following ways:
  1. New bytes to be sent can not be written to the data register (SPDR) / shift register before the entire shift cycle is completed.
  2. Received bytes are written to the Receive Buffer immediately after the transmission is completed.
  3. The Receive Buffer has to be read before the next transmission is completed or data will be lost.
  4. Reading the SPDR will return the data of the Receive Buffer.
The ability to connect several devices to the same SPI-bus is based on the fact that only one master and only one slave is active at the same time. The MISO, MOSI and SCK lines of all the other slaves are tristated (configured as input pins of high impedance with no pull-up resistors enabled). A false implementation (e.g. if two slaves are activated at the same time) can cause a driver contention which can lead to a CMOS latch up state and must be avoided. Resistances of 1 to 10 k ohms in series with the pins of the SPI can be used to prevent the system from latching up. However this affects the maximum usable data rate, depending on the loading capacitance on the SPI pins.
A write collision occurs if the SPDR is written while a transfer is in progress. Since this register is just single buffered in the transmit direction, writing to SPDR causes data to be written directly into the SPI shift register. Because this write operation would corrupt the data of the current transfer, a write-collision error in generated by setting the WCOL bit in the SPSR. The write operation will not be executed in this case and the transfer continues undisturbed.
A write collision is generally a slave error because a slave has no control over when a master will initiate a transfer. A master, however, knows when a transfer is in progress. Thus a master should not generate write collision errors, although the SPI logic can detect these errors in a master as well as in a slave mode.

As stated in previous part, data received to wireless radio module is send on serial port of PC. This is done using ATMEGA AVR controller. In PC VB-program accepts data on serial port as input for processing.

VB commands for handling Serial Port:
Inserting the object:
For serial communication we have to add MsComm object. The image of this object looks like this:
Sets and returns the state of the communications port (open or closed).
object.PortOpen [ = value ]
Setting the PortOpen property to True opens the port. Setting it to False closes the port and clears the receive and transmit buffers. The MSComm control automatically closes the serial port when your application is terminated.
Sets and returns the baud rate, parity, data bit, and stop bit parameters.
object.Settings [ = value ]
If value is not valid when the port is opened, the MSComm control generates error 380 (Invalid property value).
Value is composed of four settings and has the following format:
Where BBBB is the baud rate, P is the parity, D is the number of data bits, and S is the number of stop bits. The default value of value is:
To get data on port to program following command is used:
Data = object.Input
OutbufferCount, Inbuffercount:
Returns the number of characters waiting in the transmit buffer. You can also use it to clear the transmit buffer. This property is not available at design time.
object.OutBufferCount [ = value ]


Praveen said...

Hi do you still have this project with you?

If yes are you ready to sell this project to us?

udayanu said...

Nice write up. Neatly documented. I am working on double integration based mouse and I have achieved significant amount of progress. Once its done I will send you guys a video.