Using the Accelerometer on the FRDM-KL25 Board in KDS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using the Accelerometer on the FRDM-KL25 Board in KDS

Using the Accelerometer on the FRDM-KL25 Board in KDS

Accelerometer in KDS

 

Description:

 

This is a small project made in KDS using the accelerometer on a FRDM-KL25Z128M4 board.

The program outputs the 3D position of the board to a terminal, such as Tera Term at 9600 baud.

PWMs are also used, their intensity is dependent on the offset from the zero position.

The red LED intensity increases with X offset.

The blue LED intensity increases with Y offset.

Simply press any key to begin data output.

 

Sections of code taken from http://mcuoneclipse.com/2012/09/21/tutorial-accelerating-the-kl25z-freedom-board/

 

Issues:

 

There seem to be 'dead zones' while the board is tilted towards a corner.

The terminal will not output anything while in a 'dead zone'.

 

There will be a constant flicker of the LED even when the board is flat.

This is due to the accelerometer occasionally outputting 1 even when the board is static.

Labels (1)
Attachments
%3CLINGO-SUB%20id%3D%22lingo-sub-1122302%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EUsing%20the%20Accelerometer%20on%20the%20FRDM-KL25%20Board%20in%20KDS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1122302%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EAccelerometer%20in%20KDS%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDescription%3A%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20a%20small%20project%20made%20in%20KDS%20using%20the%20accelerometer%20on%20a%20FRDM-KL25Z128M4%20board.%3C%2FP%3E%3CP%3EThe%20program%20outputs%20the%203D%20position%20of%20the%20board%20to%20a%20terminal%2C%20such%20as%20Tera%20Term%20at%209600%20baud.%3C%2FP%3E%3CP%3EPWMs%20are%20also%20used%2C%20their%20intensity%20is%20dependent%20on%20the%20offset%20from%20the%20zero%20position.%3C%2FP%3E%3CP%3EThe%20red%20LED%20intensity%20increases%20with%20X%20offset.%3C%2FP%3E%3CP%3EThe%20blue%20LED%20intensity%20increases%20with%20Y%20offset.%3C%2FP%3E%3CP%3ESimply%20press%20any%20key%20to%20begin%20data%20output.%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ESections%20of%20code%20taken%20from%20%3C%2FSPAN%3E%3CA%20class%3D%22jive-link-external-small%22%20href%3D%22http%3A%2F%2Fmcuoneclipse.com%2F2012%2F09%2F21%2Ftutorial-accelerating-the-kl25z-freedom-board%2F%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttp%3A%2F%2Fmcuoneclipse.com%2F2012%2F09%2F21%2Ftutorial-accelerating-the-kl25z-freedom-board%2F%3C%2FA%3E%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIssues%3A%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20seem%20to%20be%20'dead%20zones'%20while%20the%20board%20is%20tilted%20towards%20a%20corner.%3C%2FP%3E%3CP%3EThe%20terminal%20will%20not%20output%20anything%20while%20in%20a%20'dead%20zone'.%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20will%20be%20a%20constant%20flicker%20of%20the%20LED%20even%20when%20the%20board%20is%20flat.%3C%2FP%3E%3CP%3EThis%20is%20due%20to%20the%20accelerometer%20occasionally%20outputting%201%20even%20when%20the%20board%20is%20static.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1122302%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EAccelerometer%20in%20KDS%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDescription%3A%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20a%20small%20project%20made%20in%20KDS%20using%20the%20accelerometer%20on%20a%20FRDM-KL25Z128M4%20board.%3C%2FP%3E%3CP%3EThe%20program%20outputs%20the%203D%20position%20of%20the%20board%20to%20a%20terminal%2C%20such%20as%20Tera%20Term%20at%209600%20baud.%3C%2FP%3E%3CP%3EPWMs%20are%20also%20used%2C%20their%20intensity%20is%20dependent%20on%20the%20offset%20from%20the%20zero%20position.%3C%2FP%3E%3CP%3EThe%20red%20LED%20intensity%20increases%20with%20X%20offset.%3C%2FP%3E%3CP%3EThe%20blue%20LED%20intensity%20increases%20with%20Y%20offset.%3C%2FP%3E%3CP%3ESimply%20press%20any%20key%20to%20begin%20data%20output.%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ESections%20of%20code%20taken%20from%20%3C%2FSPAN%3E%3CA%20class%3D%22jive-link-external-small%22%20href%3D%22http%3A%2F%2Fmcuoneclipse.com%2F2012%2F09%2F21%2Ftutorial-accelerating-the-kl25z-freedom-board%2F%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttp%3A%2F%2Fmcuoneclipse.com%2F2012%2F09%2F21%2Ftutorial-accelerating-the-kl25z-freedom-board%2F%3C%2FA%3E%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIssues%3A%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20seem%20to%20be%20'dead%20zones'%20while%20the%20board%20is%20tilted%20towards%20a%20corner.%3C%2FP%3E%3CP%3EThe%20terminal%20will%20not%20output%20anything%20while%20in%20a%20'dead%20zone'.%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20will%20be%20a%20constant%20flicker%20of%20the%20LED%20even%20when%20the%20board%20is%20flat.%3C%2FP%3E%3CP%3EThis%20is%20due%20to%20the%20accelerometer%20occasionally%20outputting%201%20even%20when%20the%20board%20is%20static.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1122302%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EGeneral%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
No ratings
Version history
Last update:
‎06-26-2014 09:26 AM
Updated by: