3-axis Accelerometer - Processor Expert - FRDM - KL02Z

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

3-axis Accelerometer - Processor Expert - FRDM - KL02Z

934 Views
markadamson
Contributor II

Hello,

I have recently managed to toggle the RGB LEDs on and off through using Processor Expert. My next experiment is trying to interface with the 3-axis Accelerometer. From inspecting the user guide, I can see that the 3-axis Accelerometer is interfaced through an I2C bus and two GPIO signals.

From this information, I have manged to create the components.

I would like to store the values of the 3-axis Accelerometer and/or display these values on a Putty Terminal. I can interface with the Putty Terminal (already displayed Hello World message).

I would also like to control the RGB LEDs through the 3-axis Accelerometer.

How would I go about fulfilling these two experiments separately??

Labels (1)
2 Replies

504 Views
mjbcswitzerland
Specialist V

Hi

There is a discussion about using the 3-axis accelerometer here: FRDM-K20D50M-Accelerometer Interrupt issue

As reference I have attached a binary that can be loaded to the board that configures the accelerometer for 50Hz interrupt driven use and displays the results on the UART (on the virtual COM port enter the I2C menu and enable the messages with "acc_on").

By connecting an SD card to the SPI it is also possible to save the data to an SD card, although the KL02 has very little memory so there is a limit to how many features can be enabled together.

All code can be obtained from KINETIS Project Code

It uses port interrupt module and I2C driver(http://www.utasker.com/docs/uTasker/uTaskerIIC.PDF)

If you want to control the LEDs based on the 3 axis values you can use the PWM module to change the PWM settings at the LEDs accordingly (http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF)

Regards

Mark

P.S. The project doesn't use PE so if you need to use PE the first link may be more helpful, but I believe you need to add your own code to tie the parts together.

504 Views
mjbcswitzerland
Specialist V

Hi

The attached versions also controls three PWM outputs connected to the RGB LEDs so that the LED colour changes as the board's orientation is adjusted. This is practical on the FRDM-KL02Z since the LEDs are connected to TPM outputs (other boards need to use interrupt driven timer control to do the same since the processor connections don't {al}l support PWM).

Regards

Mark

0 Kudos