Wiring the LSM303 is easy - like most sensors, it uses I2C - so you just need to wire up:
- 3.3V to 3.3V
- GND to GND
- SDA to SDA
- SCL to SCL
pretty easy!
Start by hot gluing the LSM303 to the back of the Circuit Playground Express such that the boards are back to back. Be sure to position the LSM303 in the center of the Circuit Playground Express with the X axis running between the USB and power connections.
Once the glue cools, you can wire the breakout. The arrangement of power, ground and I2C matches up with that of the Circuit Playground Express neatly.
While that's really all that's needed to make a working compass, we can go the next step and package it nicely.
Start with a case. This is a good one: it provides space for a small LiPo battery and an on-off switch, as well as access to the USB connector.
To connect the battery you will need male and female JST cables and a slide switch. Cut the wires on the JST connectors to fit neatly in the case, under the Circuit Playground Express. Connect the black wires together and connect the red wires to two adjacent connections of the switch. Using a bit of heat shrink on each of the connections is almost always a good idea: it helps avoid accidental shorts.
Next, secure the switch to the case with a little hot glue. Once it cools, connect the battery and Circuit Playground Express and tuck everything into place.
Secure the board as appropriate for the case you're using.
All that's left is to snap the cover into place and load up the software.
Text editor powered by tinymce.