Introduction: TinyCompass

Picture of TinyCompass

In this Instructable, we will be building a compass using the TinyShield Compass as well as the Circle Edge Led shield. Before starting, the proper drivers must be installed to detect the COM ports. These drivers must be installed before downloading any codes from the codebender plugin. The drivers needed can be found here.

Step 1: Materials

Picture of Materials

Lucky for us there are no downloads for this project, we can simply use the codebender plugin to directly program our TinyDuino.

Materials

  • TinyDuino Processor w/Battery Holder : link
  • TinyShield USB: link
  • TinyShield Compass : link
  • TinyShield Circle Edge LEDs: link
  • CR1632 3V coin cell battery

Step 2: Programming the Tiny Duino

Picture of Programming the Tiny Duino

The code below was used for the TinyCompass and has comments throughout to help explain what is going on. The magnetometer used for our compass board is the HoneywellHMC5883L 3-axis compass. This code can be downloaded to your computer or directly uploaded to your TinyDuino processor board.

Step 3: Calibration

Picture of Calibration

After your TinyDuino has been programmed you can remove the USB Shield. Each time you turn on or restart the processor, you will need to calibrate it. To calibrate, simply rotate it 360 degrees on each axis (the gifs above show exactly what to do). We now have fully functional compass that takes up less than a cubic inch of space! Because of how sensitive the HCM5883L chip is, ferromagnetic materials, magnetized or not, within a 2 inch radius of the chip will cause disturbances.

Comments

Reza Azar made it! (author)2016-06-08

works great!

PowellMade (author)2015-01-29

I reckon thats a sweet idea! Do you know if you can get rechargeable batteries that small? That way it could be linked into a car stereo and charge. Nice work.

rusty0101 (author)PowellMade2015-02-01

I don't know about rechargable batteries, I suspect that there are some available, however you might also look for supercapacitors as an alternative as well. The battery series that the tinyduino uses is the cr16xx series, no larger than the cr1632. The dimensions for this series are a cylinder 16 mm in diameter, and no more than 3.2 mm top to bottom. You can use smaller batteries or supercaps, but not larger. Voltage of 3-3.3v, even up to 5.5v should work. The processor board does _not_ have a voltage regulator on it though, so don't put two 3v batteries back to back in the slot (otherwise a pair of cr1616 or smaller batteries might work) or you will exceed the recommendations of the component manufacturers. (I'm not saying that it _won't_ work, or that it _will_ destroy your board, just that the manufacturer would consider this a bad idea.)

PowellMade (author)rusty01012015-02-03

Thanks for the reply very helpful. Seems you know a lot about electronics wish I knew more.

rusty0101 (author)PowellMade2015-02-03

I've been playing around in the field, and working in related fields for most of my life. That said, I've learned one thing through the years, if you are interested in a topic, the tools needed to learn more are out there. (Exceptions are mostly found in the doctorate level work where you end up creating the tools needed to expand human knowledge in some way or another.) What works for one person learning isn't necessarily going to work for anyone else though, so if I were to recommend one engineer's course, or another, it may help, but it may also drive you away from the field. The most important element I think is curiosity, and recognizing that there is only one person responsible for you learning any field, and that's you. Others may encourage you, stoke your curiosity, or help you get there, but only you can recognize that you have something to learn, and make the effort to learn it.

robotobor (author)rusty01012015-05-13

With over 25 years in IT and only recently earning my degree, I agree with you 100% when you say:

"The most important element I think is curiosity, and recognizing that there is only one person responsible for you learning any field, and that's you. Others may encourage you, stoke your curiosity, or help you get there, but only you can recognize that you have something to learn, and make the effort to learn it."

sarahhanahghan (author)2015-02-23

what a clever little device

hornbadoing (author)2015-01-28

Are there any cheaper options? I know you can get knockoff arduinos for a couple bucks so if you could with these boards too that would be great. I cant justify spending $68 on something so useless. Its cool don't get me wrong but its utterly useless.

TaitS1 (author)hornbadoing2015-01-31

This instructable was made by the company Tinyduino to showcase one of their produces. As with many makerstuff suppliers, Tinyduino's wares (like Adafruit's and Sparkfun's) are way more expensive than buying the components off of eBay from Hong Kong. I just saw a HMC5883L breakout board on eBay for $1. However, forget about customer service, and maybe I'm the only one who feels a twinge when I pull a great project tutorial from one of these suppliers, and then look for all of the parts elsewhere. Then again, you can do a lot more tinkering when they are 90% cheaper!

hornbadoing (author)TaitS12015-02-20

Thanks. My thoughts exactly on the last part. Cheaper parts = more tinkering. And i'm really not going to spend $70 on a compass that isn't water proof, Only works after you take time to calibrate it, Only works in a civilized area with batteries, and is missing a ton of functionality. If you have the parts on hand though i suppose it could be a fun build to help you learn to code, and i'm not a coder, just a builder. =P

rusty0101 (author)hornbadoing2015-02-20

You're welcome to use a digital compass without calibrating it. Pretty much every digital compass I've seen includes the recommendation that it be calibrated, but you're welcome to use one without doing that. I understand it's a good way to become lost. (Note that compass directions provided by GPS units in cars are usually derived from your motion as detected by the GPS monitoring satellites for position information. It doesn't require calibrating, but is also not using a magnetic compass. The digital compass in your phone very likely does include a setup step to calibrate it.

As for battery life, yes you will need batteries or a 3.3-5v power supply of some sort. That's true for pretty much any digital device. But you should also keep in mind that also includes the computer you're using, in as far as you're still going to need a supply of power sufficient to operate that computer. And unless you've built a computer out of scrounged parts and a Raspberry Pi, you've likely spent (or someone has spent) significantly more than $70 for what you're using.

If you are thinking that switching to a magnetic needle compass and avoiding the digital realm entirely, remember that there is only a limited part of the US where magnetic North has any real relationship to true north. I happen to live close enough to that zone not to make a lot of difference, but I wouldn't suggest that anyone disregard knowing what the magnetic declination of their location is. This is true of digital magnetic compasses as well, and it bother's me a little bit that most digital compasses and compass apps on phones don't have a way for you to enter a magnetic declination correction.

As to waterproof, no argument, though I know a lot of digital devices that are not waterproof, including most phones, tablets, PCs, and so on. You can work around the issue to some degree with a ziplock bag, or building a waterproof housing. But I realize it's a lot easier to dis the people interested in seeing what they can do that's interesting to them with off the shelf or newly created tools. Keep it up.

TaitS1 (author)rusty01012015-02-21

Your points about calibration and declination are well taken. I don't think anyone on this thread was trying to discourage anyone from trying this project or "dissing" people interested in it. Sounds like hornbadoing is simply not one of those people.

rusty0101 (author)TaitS12015-02-22

Could be. I've run into some odd attitudes over the past few years.

From my perspective, I have to admit that yes, this can be done for less by buying the components, and building everything yourself. that said, I'm not really interested in building an led ring. I've worked with compass breakouts, and rtc breakouts, and the like. Having what I'm interested in working on all in small boards that I can put together, potentially mount into a box or in this case hang on a zipper fob of a jacket, has some appeal to me. As noted elsewhere, I'm using the basic ible here as a starting point to stretch what's provided a bit. And I have some other ideas that using this as a starting point may help me pull together some other idea on down the line. All without having to do any soldering. (Which is not to say that I can't do the soldering, just saying that with this, I can play with ideas that otherwise would require me to break out the soldering iron and build.)

TaitS1 (author)rusty01012015-02-22

Build on, Rusty!

diy_bloke (author)hornbadoing2015-01-30

compass module 1 euro : http://www.aliexpress.com/item/3V-5V-HMC5883L-Trip...
Pro mini Arduino: 1.60 euro (also check alieexpress)

Here is the compass $7 chip on Sparkfun https://www.sparkfun.com/products/10494 but you can find it cheaper elsewhere. What Sparkfun is good for is breakout boards like the $15 https://www.sparkfun.com/products/10530 You can learn more via the always excellent Adafruit https://learn.adafruit.com/adafruit-hmc5883l-breakout-triple-axis-magnetometer-compass-sensor/overview and her breakout board is $10 http://www.adafruit.com/product/1746

xepherys (author)hornbadoing2015-01-29

That's the beauty of arduino, though. Build the project, write the code, test and play. Then disassemble and use the parts for something new. It's like expensive Legos. Actually, it might be cheaper than Legos these days...

Geraldes (author)2015-01-30

How long does the battery last?

Thank you.

rusty0101 (author)Geraldes2015-02-17

Testing with a couple of changes to the code.

First up I added the Prescaler library, changed calls to 'delay' to 'trueDelay', and switched the cpu to 500 khz from 8 mhz. From some of the information out there, this should double the battery lifetime for the processor. However that's not everything by any means.

Next up I commented out all calls to serial. They are debuging calls, and since I've neither included the USB board, nor am I using a uart serial link to a computer, the calls are not going to help the program function, or the battery life.

Finally I modified the program to add a ledsOff function, after what you see in the code as a 40 ms delay, and add another 100 ms delay with the leds off. Presuming that most of the power usage is the led, this alone may double the battery life. All the ledsOff() function does is set all of the led leads to LOW which turns them off. It now blinks about 9 times a second, which is enough to give the user an idea of what direction North is.

We'll see how long a battery goes with this setup.

rusty0101 (author)rusty01012015-02-20

Not sure if it's the commenting out of the serial commands, or just that I"m getting expected results that I wasn't expecting. I implemented the above on Monday before a meeting that I went to. Since then every so often, about 20-24 hours at a shot, I'm performing a reset with the reset button on the controller board. It's still going strong. So a single cr1632 will keep this going for at least over a weekend. I'll let it continue to run and see how long it ends up lasting, but I think the next two steps are to figure out how to 'normalize' the magnetic readings over a second or two to get the compass pointing more accurately to north.

Then I start working on getting the package to do something else entirely, namely working as an optical radio compass. The idea being that you have the device flash in some way to uniquely identify it, so that you can place it on the ground, or in a space, then it blinks a start of process pattern so that someone has a starting point for a timer, then you blink each led in sequence with a known/predictable time between each pulse, starting at the LED pointing north. The idea being that multiple people can make use of the compass, they know what direction they are from that compass on the ground, and with a couple (or three) compases you can figure out where you are on the ground.

You can do this in a somewhat more manual process with simple beacons, where you have a good reference for where the beacon is on the ground, know how to identify that beacon, and can measure, or estimate, the angle from you between pairs of four beacons. (Possibly 3 if they are diversely enough located, though even 4 in a line will still give you two possible locations.)

rusty0101 (author)Geraldes2015-02-03

Having all of the parts, I built one yesterday morning, and picked up a battery for it yesterday afternoon. It's been running now for over 24 hours. I can leave it running and "report back" at some point, but I'll probably forget. You can look at the specs of the components involved, and get some idea of the lifetime for a given battery, or you can put an amp meter in the system and calculate battery life based on the testing conditions, but if "over a day" isn't sufficiently long, I suspect you would do better to set up your own test situation.

Cheney Cheung (author)rusty01012015-02-13

Why not use the Li-ion Battery?

Geraldes (author)rusty01012015-02-03

Thanks rusty0101, I am surprise it hold up for so long on a CR1632.

That is great.

rusty0101 (author)Geraldes2015-02-03

Just picked it up and noticed that the LED was dim, and wasn't moving to point north. did a reset, and nothing, so a cr1632 gives you a little over 24 hours of life with the software that was listed in the instructable. So don't plan on using this for your next week long trek into the deep woods, unless you're bringing along spare batteries. For that matter, I'd suggest a different solution anyway.

Something to keep in mind is that there is a solder point for Gnd and + on the main controller board, so if you want to build something like this, then add in a pair of AA batteries in a holder that you can connect to this, that may give you a longer life solution. I've several AA holders for 2 cells that have a 9v style clip on them that might work with this and a 9v clip lead set. Just remember to not plug an actual 9v battery into it.

rusty0101 (author)Geraldes2015-02-01

Battery life will depend a lot on the battery you select. The controller board uses the cr16xx series of batteries up to a cr1632. I don't recall the smallest battery they support, but you should expect more lifetime out of a cr1632 than a cr1608. Additionally it's not specified here, but you can have the controller power down between cycles and only cycle enough to keep the indicator pointing reasonably real time. say every 1/100th of a second, or once a millisecond, and significantly increase the life expectancy of even a lower capacity battery.

Cheney Cheung (author)2015-02-13

It's so funny,i love it.

Eric Brouwer (author)2015-02-04

Nice project

jproffer (author)2015-02-03

it doesnt seem very accurate, you can see it change its mind about which direction is which by up to 50 degrees in some of those pics

aniketkatkar (author)2015-01-30

Awesome, but materials hard to find. Want to make :(

rusty0101 (author)aniketkatkar2015-02-01

You can find the specified components through Amazon, though if you have an electronics/computer superstore in your area you may also find them there. MicroCenter carries everything in the component list except the batteries. (at least I wasn't able to find the batteries in my local MicroCenter, that may be store dependent.) I suspect Fry's carries them as well. If you have a RadioShack in the area, you might be able to find some of this there as well. Amazon themselves does not carry them, you get fulfilment from Jamco, so you may be able to get a better deal directly there. In time these boards are likely to be available through Chinese distributors for further savings.

As I've mentioned earlier, you could build this onto an Arduino Uno platform as well. It just won't be as small.

LaserByte (author)2015-01-31

Could you simply wire up a compass sensor to a few LEDs?

rusty0101 (author)LaserByte2015-02-01

Yes, though you might have trouble getting a package this small that way. The led circle they are using has 22 leds on it, and they are turned on/off via charliepixeling to reduce the number of control pins from the processor. A side effect is that you can't turn them all on at the same time, but you can flash them faster than 50 hz and it will look like they are all on. The compass sensor would not be an issue for size, but you may need a board with one of the smc controller on it to get close to this size, unless you want to make a custom board, and even there you would need an smc controller to get down to this size.

That said, if size is not important, you could simply take an arduino uno, a 9v battery to power it, and a breadboard shield, drop a sensor in the middle of the shield, wire up 22 leds pointing away from the center to 5 or 6 leads from the Uno, and you would have a compass you could hold in your hand.

ibenkos (author)2015-01-31

Awesome project! :) thanks for shearinga

ktron500 (author)2015-01-30

WOW this site and its followers never cease to amaze me maybe its just that my life is so busy that i don't have the time to invest to do the research needed on line, however the posts contained here have given me more information and resources than any I've visited in recent history its because of people like Mr. Bronosky and the links he shared that places like this are so addictive and such a great resource for tinkerers and for lack of a better word nerds like me i place this site among the best sites I've ever found for mental stimulation and believe it or not relaxation so thank you all for the wonderful brain candy!!

Lingfeng_Sun (author)2015-01-30

Really nice design! Usual tools like compasses just become fun by relating it to Arduino.

By the way, have you tested how long can it continuously work with one 3V coin cell battery?

Pfarmkid (author)2015-01-29

Heads up, your gif isn't working. Might just be me...

xepherys (author)Pfarmkid2015-01-29

It took a minute to load on my work network, but it's there and working.

Pfarmkid (author)xepherys2015-01-29

Must have been Chrome because it works in mozilla... Oh well...

DIY-Guy (author)2015-01-29

Beautiful, tiny, functional!
And oh so useful! My wife would never carry or use a full size compass and she won't wait for it to stabilize. She looks at the wrong end of the needle because colored ends don't mean much to her. But the LED always pointing in the northerly direction is a sweet no-brainer! (She's smart, just in other ways.)

Our child wants to mount this right in front and below the cam on the remote control dune buggy. This will help us "find home" when the remote vehicle is out snooping around for animals and/or intruders in the brush, especially at night.

This is also useful for mobile units that have tracking heliostats for their solar photovoltaic panels. The compass with LED (or digital signal) outputs allows the heliostat to align itself according to the cardinal points before deplying the solar tracker with solar panels.

And on the roof, with a weathervane rotating around, this helps display the direction of the wind. It spins, but displays the angle in relation to the "north" LED. super cool!

DIY-Guy (author)2015-01-29

Beautiful, tiny, functional!
And oh so useful! My wife would never carry or use a full size compass and she won't wait for it to stabilize. She looks at the wrong end of the needle because colored ends don't mean much to her. But the LED always pointing in the northerly direction is a sweet no-brainer! (She's smart, just in other ways.)

Our child wants to mount this right in front and below the cam on the remote control dune buggy. This will help us "find home" when the remote vehicle is out snooping around for animals and/or intruders in the brush, especially at night.

This is also useful for mobile units that have tracking heliostats for their solar photovoltaic panels. The compass with LED (or digital signal) outputs allows the heliostat to align itself according to the cardinal points before deplying the solar tracker with solar panels.

And on the roof, with a weathervane rotating around, this helps display the direction of the wind. It spins, but displays the angle in relation to the "north" LED. super cool!

RichardBronosky (author)2015-01-29

Pretty sad that on the day this is featured, the whole site is down. http://tiny-circuits.com/

Ouch! You're right - Dreamhost just moved our server and the DNS hasn't updated yet. It should be back up in the next hour.

anbusv (author)RichardBronosky2015-01-29

Nice work! You should post it on http://www.hackster.io/tinyduino.

xepherys (author)anbusv2015-01-29

He did: http://www.hackster.io/tbatey_tiny-circuits/tinycompass

xepherys (author)RichardBronosky2015-01-29

Glad it wasn't just me. I was getting peer suddenly disconnected errors. :(

xepherys (author)2015-01-29

This is VERY cool! A good geeky project for scouting, I think.

wobbler (author)2015-01-29

Brilliant design!

Zappzipper (author)2015-01-27

swag

Sam777777 (author)2015-01-27

Awesome!!!!!!

About This Instructable

37,566views

648favorites

License:

More by TinyCircuits:Tiny GPS TrackerTinyFanBoatTinyHoverCraft
Add instructable to: