Progress Bar

Skip to main content

Jaycar
...

Portable Digital Compass

Portable Digital Compass

Difficulty
Test & Tools

Summary

Not just a great project for the coming holiday break, this compass can be used to find your way home. The addition of a functional USB output will ensure if you're still lost, you can always charge your phone and call for help.

Materials Required

1Arduino Compatible Monochrome OLED Display ModuleXC4384
1Arduino Compatible Nano BoardXC4414
1Arduino Compatible 3 Axis Compass Magnetometer ModuleXC4496
1150mm Socket to Socket Jumper Leads - 40 PieceWC6026
17805 +5V 1A Voltage Regulator TO-220 caseZV1505
1Battery Bank 4 x AA USB A SKT with Switch BlackMP3083
114500 Rechargeable Li-Ion Battery 800mAh 3.7V NippleSB2300

Library

Author

Version

Adafruit_GFX

Adafruit

1.0.2

Adafruit_SSD1306

Adafruit

1.1.2

I2C-Sensor_Lib

Ingmar Splitt

0.8.2

Connection table

Nano

Compass Module

OLED Screen

3v3

VCC

VCC

A4

SDA

SDA

A5

SCL

SCL

GND

GND

GND

//32 x 32 is what we'd use for the rotating compass
//draw a circle starting at 16,16    and with a radius of 16 (32 dia.)
int Cx = 16;
int Cy = 16;
screen.drawCircle(Cx,Cy, circle_radius, WHITE);
//center of the circle is at 16,16

int ax = sin(rad)   * circle_radius;
int ay = cos(rad)  * circle_radius;
int bx = sin(rad+half_pi)   * half_radius;
int by = cos(rad+half_pi)  * half_radius;
int cx = sin(rad-half_pi)    * half_radius;
int cy = cos(rad-half_pi)   * half_radius;

//north facing triangle is filled in
screen.fillTriangle(
        Cx + ax, Cy + ay,
        Cx + bx, Cy + by,
        Cx + cx, Cy + cy, WHITE);
screen.drawTriangle(
        Cx - ax, Cy - ay,       //reverse the outlined
        Cx + bx, Cy + by,
        Cx + cx, Cy + cy, WHITE);

Library

Author

Version

Adafruit_GFX

Adafruit

1.0.2

Adafruit_SSD1306

Adafruit

1.1.2

I2C-Sensor_Lib

Ingmar Splitt

0.8.2

Connection table

Nano

Compass Module

OLED Screen

3v3

VCC

VCC

A4

SDA

SDA

A5

SCL

SCL

GND

GND

GND

Similar projects you may be interested in

Test & Tools
Symbol Keyboard
Difficulty

Test & Tools
ATtiny Programmer Shield
Difficulty

Test & Tools
Revive your Arduino - ISP Programming
Difficulty

digital-compass-thumbnail.jpg
Test & Tools
Digital Compass
Difficulty