I used a header board for an STM MEMS evaluation kit in order to take a look at some common MEMS sensors:
- LPS301: Pressure and temperature sensor
- LG3D20: Gyroscope
- LSM303DLHC: Accelerometer and magnetometer
The header was an STEVAL-MKI124V1 which is designed to work with an STM motherboard evaluation system. I took a shortcut and used it with an ARM MBED board featuring an NXP LPC1768 MBED.
Hook-up using I2C was trivial:
The schematic for the evaluation board is here:
The orientation of the sensors on the board is like this:
MBED-based code I write to drive the I2C is on the MBED website here
The code sets up each of the sensors and then provides a continuous output of temperature, pressure and orientation. Rather than optimize for performance or efficiency, the code here is intended to show clearly how to access the sensors.
An interesting twist was to use the linear accelerometer to find the vector of the earth’s gravitational field (i.e. down) and to use that to make a tilt-adjusted compass. Algorithm
I was looking for a way to test the frequency response of a new oscilloscope.
Analog Devices has a nice IC that can produce a digitally synthesized sine wave of frequency between 0 and about 70 MHz. AD9850 link is here.
The quickest way to throw together a prototype was using an MBED platform. My code is here
What made things even easier was the availability of ready-to-go evaluation boards from China on Ebay for less than $5. This is the one I used.
This design is limited to about 40MHz if you want a clean signal without aliasing.
Frequency and phase are set by a 40-bit command that has:
- 32-bit frequency setting
- 5-bit phase setting
- 1-bit power up/down
- 2-bits factory debug access
Output frequency is given by: fOUT = (frq × CLKIN)/(2^32)
where frq is the 32-bit frequency and CLKIN is the frequency of the on-board crystal (125MHz in this case) So, for example 0x147AE148 is 10MHz.
Frequency resolution has a step size of 29KHz with the 125MHz clock.
You can also change phase in increments of 180°, 90°, 45°, 22.5°, 11.25° or any combination thereof using