How to interface LISY300 Gyroscope Module with arduino

I have LISY300 Gyroscope Module and I want to interface this module with arduino, but I cannot. Please I need help. This is the datasheet of the module.

I want to interface this module with arduino, but I cannot

Why not? What's the problem?

Why not? What's the problem?

I connect serial data output with analog pin Ao, but the reading isn't reliable. This is my code.

gyro sketch
displays the rotation rate on the Serial Monitor
const int inputPin = 0; // analog input 0

int rotationRate = 0;
void setup()
Serial.begin(9600); // sets the serial port to 9600
pinMode(powerDownPin, OUTPUT);
digitalWrite(powerDownPin, LOW); // gyro not in power down mode
void loop()
rotationRate = analogRead(inputPin); // read the gyro output
Serial.print("rotation rate is ");
delay(100); // wait 100ms for next reading
pinMode(powerDownPin, OUTPUT);

What's that?

Why are you doing analog read of the sensor?? It communicates with SPI

What’s that?

I modify it. if you have an idea about how to use this module please send it to me.

tobyb121: Why are you doing analog read of the sensor?? It communicates with SPI

Can you give an example about how to communicate this module with SPI ??

Have you looked in the Playground? Google searches?

Have you looked in the Playground?
Google searches?

Of course. i found a code but i can’t understand it.

' =========================================================================
'   File...... LISY300 Test V1.6.bs2
'   Purpose... Demo LISY300 Gyroscope Module
'   Author.... Daniel Harris, Parallax, Inc.
'   E-mail....
'   Started... 11-15-2009
'   Updated... 09-10-2010
'   {$STAMP BS2}
'   {$PBASIC 2.5}
' =========================================================================

' -----[ Program Description ]---------------------------------------------

' This program test the LISY300 Gyroscope Module (#27922) by returning the
' ADC value.  The ADC is 10 bits and returns a value from 0 - 1023 at max
' ranges.  Typically when the Gyroscope Module is sitting idle the return
' value should be close to 512 (+/- 24).  As the Gyroscope rotates in a
' clockwise manner the values go down relative to the speed at which the
' gyroscope is rotating.  Conversely when the gyroscope is rotating in a
' counter-clockwise manner the values go up relative to the speed at which
' the gyroscope is rotating.
' This demo calibrates the program and displays a graphical representation
' of the magnitude of rotation with a horizontal bar graph.  It reports an
' APPROXIMATION of how many degrees per second the module is rotating as
' well as which direction the module is rotating and the raw output.
' Please read the documentation to determine how to accurately calculate
' sensor yaw.

' -----[ Revision History ]------------------------------------------------

' V1.6 - 9/10/10 Spiced up the original test code to demo the gyroscope module.

' -----[ I/O Definitions ]-------------------------------------------------

Dout            PIN     0               ' P0 <-- Dout (LISY300.2)
SCLK            PIN     1               ' P1 --> SCLK (LISY300.4)
CSn             PIN     2               ' P2 --> /CS  (LISY300.5)

' -----[ Constants ]-------------------------------------------------------

CW              CON     1
CCW             CON     0

divisions       CON     64              ' Adjust this value to change the
                                        ' width of the horizontal bar graph.

' -----[ Variables ]-------------------------------------------------------

raw             VAR     Word            ' Raw ADC Result Value
delta           VAR     Word            ' Center calculated raw change
center          VAR     Word            ' Calibrated static rotation value
ticks           VAR     Byte            ' Number of tick marks to display
i               VAR     Byte            ' Loop counter variable
CWorCCW         VAR     Bit             ' Are we rotating CW (1) or CCW (0)?

' -----[ EEPROM Data ]-----------------------------------------------------

' -----[ Initialization ]--------------------------------------------------

  HIGH CSn              ' Disable communication with sensor (active low)
  PAUSE 250

  GOSUB Calibrate       ' Do an initial calibration to initialize the program.

  DEBUG REP "*"\38, CR, "Parallax LISY300 Gyroscope Module Demo", CR, REP "*"\38

' -----[ Program Code ]----------------------------------------------------


    GOSUB Read_Gyro
    GOSUB Do_Math

    ' Display our data
    DEBUG CRSRXY, 0, 4

    ticks = (delta * (divisions/2)) / center     'calculate the number of tick marks to display

    IF ticks > 0 THEN   'if we have tick marks to print, then print them

      IF CWorCCW = CCW THEN          'moving counter clockwise
        DEBUG CRSRX, (divisions / 2)-ticks, "<", REP "="\ticks-1, CR
        DEBUG "Rotating approx. ", DEC delta, " deg/sec COUNTER Clockwise", CLREOL, CR

      ELSE  'CWorCCW = CW             moving clockwise
        DEBUG CRSRX, (divisions / 2), REP "="\ticks-1, ">", CR
        DEBUG "Rotating approx. ", DEC delta, " deg/sec Clockwise", CLREOL, CR


      'not rotating fast enough to display ticks, so place a center line and print status
      DEBUG CRSRX, (divisions / 2), "|", CR
      DEBUG "Minimal Rotation.  Approx. ", DEC delta, " deg/sec rotation.", CLREOL, CR

    'print the raw value received from the ADC
    DEBUG CR, "Raw ADC Value:", DEC5 raw, CR



' -----[ Subroutines ]-----------------------------------------------------

' Read_Gyro communicates with the gyroscope module to retrieve the digitized sensor readings.
' Communicates via SPI protocol.  Stores result into 'raw'.
  LOW CSn          ' Enable communication with sensor (active low)
  SHIFTIN Dout, SCLK, MSBPOST, [raw\13]  ' Get the data
  HIGH CSn         ' Disable communication with sensor (active low)

' Due to manufacturing differences, reported static sensor values can vary.  The program
' should update 'center' to compensate.  Make sure that the module is still during calibration!
  center = 0

  FOR i = 1 TO 8   'quickly take 8 readings to average the static rotation value
    GOSUB Read_Gyro
    center = center + raw

  center = center >> 3         'Take the average of the readings, divide by 8 (= 2^3)

' Do_Math conditions the raw data a bit so that we can make use of that data.

  delta = (raw - center)  'find the magnitude of change from the center position.  (Can be negative!)
                          'One decimal change is roughly equivelant to one degree of rotation per second.

  CWorCCW = (($8000 & delta) >> 15) 'Saves the sign bit of delta to CWorCCW, this way we can
                                    '  determine if we are moving CW or CCW.
                                    'A negative delta (CWorCCW bit set) means we are moving CW.
                                    'A positive delta (CWorCCW bit cleared) means we are moving CCW.

    delta = -delta      'we cannot divide with a negative number, so negate the negative to make positive


i found a code but i can't understand it

No, me neither. You didn't find that in the Playground. Try Googling "lisy300 Arduino"

What module are you actually using. You can get an LISY300 which is just the chip broken out, giving you an analogue output, or you can have something like the link in your original post that uses SPI.