element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
WaRP7
  • Products
  • Dev Tools
  • Single-Board Computers
  • WaRP7
  • More
  • Cancel
WaRP7
Blog Warp7 Sensors FXOS8700CQ demo
  • Blog
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join WaRP7 to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: tusharp
  • Date Created: 17 Nov 2016 9:26 AM Date Created
  • Views 752 views
  • Likes 1 like
  • Comments 0 comments
  • tusharp
  • nxp-warp7
  • fxos8700cq
  • warp7-demo
  • warp7-sensor
Related
Recommended

Warp7 Sensors FXOS8700CQ demo

tusharp
tusharp
17 Nov 2016

Contents

1. Warp7 Yocto Part1

2. Warp7 Yocto Part2

3. Warp7 Sensors demo - mpl3115a2

4. Warp7 Sensors demo - fxos8700cq <-- You are here

5. Warp7 IoT demo

 

In this guide we will explore warp7 accelerometer and magnetometer functionality.

The write_register and read_register functions from the previous blog can remains same.

 

The FXOS8700CQFXOS8700CQ is small low-power sensor in warp7warp7  that integrates a 3-axis 14-bit accelerometer and a 3-axis 16-bit magnetometer in a single package.

 

Scenarios where FXOS8700CQ sensor can be used to monitor:

  1. orientation sensing.
  2. freefall detection.
  3. transient detection.
  4. motion inputs(ex: games and pedometers)
  5. magnetic pole detection
  6. underground exploration like drilling and mining.

 

fxos8700 is located at the i2c address 0x1E.

 

WHO_AM_I

Probing the WHO_AM_I register located at 0x0D gives a value hex value C7.

WHO_AM_I register is used to identify the type of sensor hardware.

 

$ i2cget -y 3 0x1E 0x0D

0xc7

 

reading WHO_AMI_I register programatically using the i2c functions.

read_register(file, 0x1E, 0x0D, <BUFFER_ADDRESS>)

 

 

Activating FXOS8700CQ

FXOS8700 needs to be set to active mode prior to using it.

The bit0 of register CTRL_REG1 sets the sensor to active mode.

So, we write 0x01 to the 0x2A(CTRL_REG1) register.

write_register(file, 0x1E, 0x2A, 0x01)

 

Fast Read Mode:

In some real time  scenarios you have to read data as an extremely fast rate.

Fortunately the sensor has a built in support for a Fast Read mode.

The bit1 needs to be activated alongwith bit0 by writing 0x03 to CTRL_REG1 .

Note: this mode will give you only the 8bit MSB data, so you might miss some exact precision here, a trade-off.

write_register(file, 0x1E, 0x2A, 0x03)

 

 

Enabling accelerometer & magnetometer

with FXOS8700 in active mode, we need to enable the accelerometer and magnetometer also.

The M_CTRL_REG1 register needs to be configured.

So, we write 0x03 to the 0x5B(M_CTRL_REG1) register.

write_register(file, 0x1E, 0x5B, 0x03)

 

 

Registers to read data from..

we are interested in below registers:

0x01 – read x-axis MSB data (8 bits 0:7) 

0x02 – read x-axis LSB data (6 bits 2:7)

0x03 – read y-axis MSB data (8 bits 0:7) 

0x04 – read y-axis LSB data (6 bits 2:7)

0x05 – read z-axis MSB data (8 bits 0:7) 

0x06 – read z-axis LSB data (6 bits 2:7)

 

we will read the LSB & MSB and store in two variables.

read_register(file, 0x1E, 0x01, &data1)

read_register(file, 0x1E, 0x02, &data2)

 

Next we need to convert the X,Y,Z axis readings to usable data by applying some changes.

for X axis:

 

val1 = (int)data1;

val1 <<=8;

val2 = (int)data2;

x_value = val1 | val2;

implementing the similar conversions for Y & Z axis.


Retrieving  sensor values from magnetometer

we are interested in below registers:

0x33 – read x-axis MSB data (16 bits) 

0x34 – read x-axis LSB data (16 bits)

0x35 – read y-axis MSB data (16 bits)

0x36 – read y-axis LSB data (16 bits)

0x37 – read z-axis MSB data (16 bits)

0x38 – read z-axis LSB data (16 bits)

 

Similarly we need to read the LSB & MSB and store in two variables later use.

read_register(file, 0x1E, 0x33, &data1)

read_register(file, 0x1E, 0x34, &data2)

 

Check in terminal the values of accelerometer while performing Pitch, Roll and Yaw.

24nptgy.jpg

 

In terminal the y-value of magnetometer will be zero while pointed to North.

xlb9y1.jpg

 

Oops 1 degree image.

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube