Shop OBEX P1 Docs P2 Docs Learn Events
L3G4200D Gyroscope — Parallax Forums

L3G4200D Gyroscope

uosamor007uosamor007 Posts: 21
edited 2012-03-17 14:37 in Accessories
i am having trouble finding any working code for the Parallax L3G4200D gyroscope. does any one have any i could please use?

thanks

Comments

  • PublisonPublison Posts: 12,366
    edited 2012-03-15 15:43
    uosamor007 wrote: »
    i am having trouble finding any working code for the Parallax L3G4200D gyroscope. does any one have any i could please use?

    thanks

    There is code for the BS2 and Propeller at the right bottom of the product page. Download and Resources.

    http://www.parallax.com/Store/Sensors/AccelerationTilt/tabid/172/ProductID/778/List/0/Default.aspx?SortField=ProductName,ProductName

    There is also another page with some code:

    https://sites.google.com/site/parallaxinretailstores/home/gyroscope-module-l3g4200d

    Which Parallax Processor are you using?
  • uosamor007uosamor007 Posts: 21
    edited 2012-03-17 09:02
    P8X32A microcontroller
  • PublisonPublison Posts: 12,366
    edited 2012-03-17 09:08
    uosamor007 wrote: »
    P8X32A microcontroller

    Did either of the linked codes work for you? I have used the spin code from the product page an it woks fine.

    Are you running in I2C or SPI mode. What voltage are you supplying to the module?

    Jim
  • uosamor007uosamor007 Posts: 21
    edited 2012-03-17 12:01
    I am trying to use the I2C mode. my question is in that mode do we leave the cs pin floating or do we connect it to high which in my case is 3.3 V

    thanks
  • uosamor007uosamor007 Posts: 21
    edited 2012-03-17 12:23
    yea i am using the spin code from the product page as well i guess my issue is how to connect this device to the P8X32A uC
  • PublisonPublison Posts: 12,366
    edited 2012-03-17 13:08
    The demo code shows that the CS is left floating according to the schematic in the code:
    {{
    
    ┌─────────────────────────────────────┬────────────────────────┬──────┬────────┐
    │ L3G4200D_Example_Code.spin          │ (C)2011 Parallax, Inc. │ V1.0 │ Jul 25 │
    ├─────────────────────────────────────┴────────────────────────┴──────┴────────┤
    │ Demonstrates X,Y,Z output to a serial terminal. Uses default (I²C) interface │
    │ on the Gyroscope module.                                                     │
    │ This program is for example purposes only for RAW data from the Gyroscope    │
    │ Module. The calculations provided are for example only and should not be     │
    │ relied on for accuracy. For details about calculating Gyroscope values and   │
    │ other important information on functionality, please see the documents on our│
    │ product page. Our Forums also have very useful information on this topic.    │
    │                                                                              │
    └──────────────────────────────────────────────────────────────────────────────┘
    
    
       ┌─────────────────┐
       │   L        INT2 ┣───   Data ready/FIFO interrupt
       │   3        INT1 ┣───   Programmable interrupt
       │   G         SDO ┣───   SPI serial data output -- I²C LSB of the device address (SA0)
       │   4 SDA/SDI/SDO ┣───   I²C serial data (SDA) -- SPI serial data input (SDI) -- 3-wire SPI data output (SDO)
       │   2         SCL ┣───   I²C & SPI clock
       │   0         CS  ┣───   I²C/SPI mode selection (defaulted to I²C) pull low for SPI mode
       │   0         VIN ┣───   2.7 - 6.5VDC (module is regulated to 2.5VDC)
    


    You only have to pull CS LOW for SPI.

    Jim
  • uosamor007uosamor007 Posts: 21
    edited 2012-03-17 13:23
    ok thanks that is what i was thinking but my other question is for the scl pin and the sda pin...are there any pull up resistors needed?
  • PublisonPublison Posts: 12,366
    edited 2012-03-17 13:43
    uosamor007 wrote: »
    ok thanks that is what i was thinking but my other question is for the scl pin and the sda pin...are there any pull up resistors needed?

    You can refer to the Quickstart Post:

    https://sites.google.com/site/parallaxinretailstores/home/gyroscope-module-l3g4200d

    No pull ups needed. Have you tried it with either yet?

    Jim
  • uosamor007uosamor007 Posts: 21
    edited 2012-03-17 14:37
    i have tried the readings i get for X, Y, and Z is 0 and no matter how much i move the gyroscope around these readings don't change
Sign In or Register to comment.