maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   DIY digital compass: electronics experts needed! (https://talk.maemo.org/showthread.php?t=31861)

kwantam 2009-11-03 16:48

Re: DIY digital compass: electronics experts needed!
 
Quote:

Originally Posted by sarahn (Post 364224)
In theory nothing. In practice, do you know if you can buy less than a few thousand?

This is a good point. Some research on whether this device is obtainable is clearly in order.

Quote:

It is also extremely unlikely that chip will not also require glue logic.
All it takes is an I2C interface and you're in business. You can find the AK8973 datasheet on the web, e.g.,
http://www.datasheetarchive.com/pdf-.../DSA-37871.pdf
It's pretty clear from this that the interface portion is trivial.

Quote:

I picked parts based on what was available for easy prototyping and what was available in quantities of 1 on digikey.
I assume you went with the Honeywell 3-axis magnetometer? I'm fairly confident the N900's tilt sensors can be used to do the tilt compensation, so the much more expensive tilt compensated one shouldn't be necessary.

In my mind, the question of AK8973 vs. HMC5843 isn't a useful one because they are substantially the same. Ideally, we'd be able to tap into an existing i2c bus and be done with it---we just need the IC and some bypass caps. Going through USB (assuming OTG support becomes available) will probably require a microcontroller and will be bulkier and uglier.

By the way, as nice as the SDIO idea sounds, it's probably no better than doing a USB interface, since SDIO<->I2C will still take a microcontroller, and the issue of mechanically supporting the compass module protruding from an SD slot is not one I want to tackle. USB seems better suited to this. (I say protruding with fair certainty having played around with the HMC5843 enough to ascertain that it is too thick to go inside said slot. The AK8973 is somewhat thinner, but is still too thick when you consider that you need to mount it on a PCB.)

wickeddeus 2009-11-03 17:37

Re: DIY digital compass: electronics experts needed!
 
I wish I could find an actual picture of the AK8973 because in my imagination it would look something like the chip in this article: Atheros's AR6003 chip bring 802.11n to cellphones

qole 2009-11-03 18:44

Re: DIY digital compass: electronics experts needed!
 
kwantam: The person who builds a working USB interface for the N900 will be a Hacker Hero.

So maybe the first thing to do is build an SDIO->USB host adapter for the N900, and then all sorts of new gadgets are available...

kwantam 2009-11-03 19:01

Re: DIY digital compass: electronics experts needed!
 
Quote:

Originally Posted by wickeddeus (Post 364652)
I wish I could find an actual picture of the AK8973 because in my imagination it would look something like the chip in this article: Atheros's AR6003 chip bring 802.11n to cellphones

It's a 4mm x 4mm x 0.7mm rectangular prism. It has no leads, just 16 metal pads on the bottom. Google for "16 qfn" and you'll find images of one.

sarahn 2009-11-04 04:45

Re: DIY digital compass: electronics experts needed!
 
Quote:

Originally Posted by kwantam (Post 364615)

I assume you went with the Honeywell 3-axis magnetometer? I'm fairly confident the N900's tilt sensors can be used to do the tilt compensation, so the much more expensive tilt compensated one shouldn't be necessary.

Yes on honeywell, because again it's available in units of 1 and you can get a module at sparkfun for prototyping. I'm also told you can theoretically hand solder it.

Quote:

Originally Posted by kwantam (Post 364615)
Ideally, we'd be able to tap into an existing i2c bus and be done with it---we just need the IC and some bypass caps. Going through USB (assuming OTG support becomes available) will probably require a microcontroller and will be bulkier and uglier.

While I'm often willing to void warranties that goes a tad over my comfort level.

What's your target price point, and what volumes are you guessing?

Otaku 2009-11-04 13:17

Re: DIY digital compass: electronics experts needed!
 
Quote:

Originally Posted by qole (Post 364710)
So maybe the first thing to do is build an SDIO->USB host adapter for the N900, and then all sorts of new gadgets are available...

Do we know that the N900's MicroSD slot supports SDIO? And if it does, are drivers available? I seem to recall that licensing problems prevented open source projects from making free SDIO implementations (which is why the Zaurus C-series, which supported SDIO in hardware, had hardly any actual SDIO products they could use).

The N900's MicroSD slot placement (inside the device) is also rather sub-optimal for attaching external USB gadgets. Maybe a hardhack could add a new MicroSD slot into the case (would require cutting a hole in the case) and connect it to the original slot with a ribbon cable. That might then allow you to connect various oddly-sized SDIO devices without needing to pop the N900's lid every time. Not sure if it would be worth doing, though, since the risk of permanently marring the case is pretty high.

sirflyalot 2009-11-04 13:26

Re: DIY digital compass: electronics experts needed!
 
Go up to 10 people and ask them for directions to their house. I doubt that 3 of them will use the words, "North, South, East or West". Then ask each of them if they have ever used a compasss. 0 of 10 will have used a compass.

I would love to have a compass in the N900, but for most people it isn't necessary. Only people that were Boy Scouts actually care about this.

Ok, flame me now.

darethehair 2009-11-04 14:18

Re: DIY digital compass: electronics experts needed!
 
Quote:

Originally Posted by sirflyalot (Post 365366)
Ok, flame me now.

I have no intentions of 'flaming' you :)

However, I personally would love to use a digital compass with the N900 so that I could add 'automatic directionality' (or whatever you want to call it) to the astronomy program(s) I have written. Similar to the Celestron 'SkyScout', I would like the directional orientation of the N900 to be reflected in the portion of the sky being shown to the user.

In my case, it has nothing to do with giving 'walking directions' to anybody :)

kevloral 2009-11-05 09:24

Re: DIY digital compass: electronics experts needed!
 
Quote:

Originally Posted by sirflyalot (Post 365366)
Go up to 10 people and ask them for directions to their house. I doubt that 3 of them will use the words, "North, South, East or West". Then ask each of them if they have ever used a compasss. 0 of 10 will have used a compass.

I would love to have a compass in the N900, but for most people it isn't necessary. Only people that were Boy Scouts actually care about this.

Ok, flame me now.

A digital compass is not for the user to know there the North is (well, it also enables that, but it is not its main point), it is for the applications that are running on the device to know it. That is a pretty significant difference, as it enables augmented reality applications.

For instance, have a look at this: http://layar.com/

0Dark Knight0 2009-11-05 09:27

Re: DIY digital compass: electronics experts needed!
 
me too,
i want it badly,,,:(

gidyn 2009-11-05 09:42

Re: DIY digital compass: electronics experts needed!
 
Quote:

Originally Posted by sirflyalot (Post 365366)
Go up to 10 people and ask them for directions to their house. I doubt that 3 of them will use the words, "North, South, East or West". Then ask each of them if they have ever used a compasss. 0 of 10 will have used a compass.

I would love to have a compass in the N900, but for most people it isn't necessary. Only people that were Boy Scouts actually care about this.

A compass isn't just for the user to know which way they're facing; it's so that the GPS can tell you which way to turn before you set off in the wrong direction.

bocaJ 2009-11-05 09:51

Re: DIY digital compass: electronics experts needed!
 
I'm just wondering if the accelerometer+GPS is good enough to fake a compass through dead reckoning. You turn on dead-reckoning mode, get a GPS fix, walk 20ft or so in a straight line holding the device in some predefined position and now the device knows what direction its facing. Or alternatively, you point the device north, tell it to sync, and it does.

Granted, last time I did anything with dead reckoning was a FIRST robotics competition 6 years ago and I remember that just failing horribly, but maybe things have gotten better since then?

attila77 2009-11-05 09:57

Re: DIY digital compass: electronics experts needed!
 
1. Dead reckoning with a single accelerometer is trouble. You'd really need a gyro, accelerometers will give you onyl translation, but not rotation.

2. If you walked 20ft with GPS on, you'd have a direction anyway :) There is just one assumption to make - that the device was in front of you.

jjx 2009-11-06 03:17

Re: DIY digital compass: electronics experts needed!
 
Quote:

Originally Posted by attila77 (Post 366121)
1. Dead reckoning with a single accelerometer is trouble. You'd really need a gyro, accelerometers will give you onyl translation, but not rotation.

2. If you walked 20ft with GPS on, you'd have a direction anyway :) There is just one assumption to make - that the device was in front of you.

Or two accelerometers as far apart as possible in the phone. A magnetic bearing gyro sounds like it would give better results though. But then again, silicon accelerometer == no separate moving parts to fail.

You'd need to integrate the accelerometer measurements, which I'd think would have to be done continuously by the electronics to have a chance at being accurate.

tz1 2009-11-06 05:21

Re: DIY digital compass: electronics experts needed!
 
i2c would be easiest to access using some microprocessor with a similar interface (Atmel has TWI or USI depending on model). I don't know if you can bit-bang the SDIO in the microSD, or if there would be a driver for the UART interface, though there is a NXP/Philips UART to I2C chip that might work.

mannakiosk 2009-11-24 09:33

Re: DIY digital compass: electronics experts needed!
 
I'd be really happy with an integrated bluetooth compass/headset. Or even just a BT compass.

It would mean that I'd have to keep the N900 aligned correctly, but I don't think holding the phone straight in front of me would be any kind of herculean task.

Otaku 2010-01-03 03:07

Photo of bluetooth compass prototype
 
Looks like someone named "HapticGuide" is working on a bluetooth compass prototype for the N900:

http://www.flickr.com/photos/hapticguide/4206070945/
http://www.flickr.com/photos/hapticguide/4164852805/

AFAICT there is no user on t.m.o. with that username.

Anyone know more information about this project, or care to comment on the visible electronics in the photo?

EDIT: better photo added
EDIT: Found the project home page here; it's a PUSH project. Looks like it's intended for walking navigation, not for AR. I wonder if the compass circuit returns full 360 degree information or just 8 directions.

lcuk 2010-01-03 04:15

Re: DIY digital compass: electronics experts needed!
 
there is a strange blanking plate type thing inside the n900
go have a look at some disassembly videos, would a honeywell i2c unit fit in that space?

lardman 2010-01-03 11:08

Re: DIY digital compass: electronics experts needed!
 
Shame this isn't available anymore:

http://www.wintec.com.tw/GPS/bluetoothgps/WBT100.htm
http://www.pocketgpsworld.com/wintec-data-logger.php

It actually spits out an NMEA HDG message, just what we could do with: http://www.gpspassion.com/forumsen/t...88&whichpage=5

Otaku 2010-01-03 12:41

Re: DIY digital compass: electronics experts needed!
 
That Wintec device does indeed look like it would fit the bill surprisingly nicely: small, battery-powered, and bluetooth! Looks like it was pricey when it was available ($150)... wonder if there's a similar product available today.

EDIT: Is this the successor? Seems like it's still available. Looks like you'd be paying for a lot of stuff you don't need though if all you need is a compass.

I seem to recall someone in this thread said (s)he had contacts to a Chinese manufacturer who might be willing to take up a compass project. I wonder if the Wintec might be able to serve as a useful example for said manufacturer when considering development of a similar device.

lardman 2010-01-03 12:47

Re: DIY digital compass: electronics experts needed!
 
I've just read back through the thread, and I saw the mention of SDIO. It does apparently work, have a chat to Crashanddie who happened to have a suitable card and it was recognised.

lardman 2010-01-03 12:50

Re: DIY digital compass: electronics experts needed!
 
And while I'm waffling, though slightly OT now, has anyone actually tried forcing the USB chipset to host mode using the same trick that was necessary for the N800 and N810 (if you used a gender changer as you didn't want to buy an extra usb cable with the right wire crossed over in it)?

tz1 2010-01-03 14:38

Re: DIY digital compass: electronics experts needed!
 
One of the things I'm working on involves adding a magnetometer (HMC5843 - http://talk.maemo.org/showthread.php...739#post450739) to my stack with a Venus 10Hz GPS (with WAAS and AGPS!), reading J1850 from my harley, my radar detector. I'm also adding baro and temp (and maybe humidity if I can find the right sensor).

The HMC is more than sensitive enough to give a heading reading - I was surprised. It is I2C so just needs to be turned into serial for bluetooth.

lardman 2010-01-03 16:15

Re: DIY digital compass: electronics experts needed!
 
Quote:

EDIT: Is this the successor? Seems like it's still available. Looks like you'd be paying for a lot of stuff you don't need though if all you need is a compass.
Good find, apparently it does spit out the compass reading along with the barometric data in a proprietary sentence.

http://www.gpspassion.com/forumsen/t...OPIC_ID=117303

Otaku 2010-01-04 04:10

Re: DIY digital compass: electronics experts needed!
 
Looks like there's another product in the category of GPS logger + compass + bluetooth: the MN500 from "Themap", a Korean company. Can't find any pricing info yet though, not even on their home page... the product was only recently launched.

http://www.ceatec.com/2009/en/news/e...press_id=00041

specs - Touch_Panel, 3.5"Transflective LCD, Bluetooth, Compass, Altimetric Barometer, 2.4GHz Bike_Sensor(ANT+), CPU ARM9_2442 @ 400 Mhz - you could probably run Linux on this thing, if it's not running Linux already.

I suspect again though it will be rather pricey.

edit: added specs link

lardman 2010-01-04 10:35

Re: DIY digital compass: electronics experts needed!
 
Yeah, if we're going to go that large and pricey it would make more sense to just buy one of the Android devices which comes with GPS + compass and do VR work on there.

That Wintec device isn't available in the UK afaict, so it looks like it will unfortunately be a case of doing some soldering and making up a BT link for the 3-axis i2c accelerometer *grumble*.

sarahn 2010-01-05 04:59

Re: DIY digital compass: electronics experts needed!
 
Quote:

Originally Posted by lardman (Post 451082)
And while I'm waffling, though slightly OT now, has anyone actually tried forcing the USB chipset to host mode using the same trick that was necessary for the N800 and N810 (if you used a gender changer as you didn't want to buy an extra usb cable with the right wire crossed over in it)?

http://talk.maemo.org/showthread.php?t=31921

iamNarada 2010-01-05 20:42

Re: DIY digital compass: electronics experts needed!
 
I've been lurking following the progress of this thread. I have a question. What height (thickness) of chip can the microSD card slot accommodate? Would it be possible to custom fab a magnetometer microSDIO card. The 3 axis magnetometer chip from Honeywell are a bit thicker (1.3mm) than the official microSD card spec (1mm), but they are substantially smaller in the other dimensions (3x3mm vs 11x15mm) so there should be ample real estate for whatever other electronics (i.e. flexPCB). Just wondering!

tz1 2010-01-05 23:12

Re: DIY digital compass: electronics experts needed!
 
I don't think it would fit on an SD card without sticking out (at least on the 900). You might be able to do something via bluetooth (or even flash an IR LED at the camera).

I don't think the Honeywells do SPI (which would make it easy), but do I2C - I have the HMC5843 talking to various Atmel chips (the new attiny45 in tssop might fit in the uSD slot though). It could go via bluetooth as well though it would probably be a bit big.

Jack6428 2010-01-05 23:22

Re: DIY digital compass: electronics experts needed!
 
I wanted to ask... i thought the N900 does have a digital compass actually? When i use Ovi Maps and the A-GPS, and set a route and drive by car... the map is turning by itself as i drive, targeting always north. For ex. when i turn right, the map turns with me. I though that can be done only with a digital compass? Or am i wrong?

noobmonkey 2010-01-05 23:32

Re: DIY digital compass: electronics experts needed!
 
Quote:

Originally Posted by Jack6428 (Post 454842)
I wanted to ask... i thought the N900 does have a digital compass actually? When i use Ovi Maps and the A-GPS, and set a route and drive by car... the map is turning by itself as i drive, targeting always north. For ex. when i turn right, the map turns with me. I though that can be done only with a digital compass? Or am i wrong?

I'm pretty sure it's just able to tell the direction you are going in by gaps in the gps, (ie you getting closer and farther away from them)...

If you face the other way in a taxi etc, it does the same as facing forward. So i don't think it uses a compass unfortunately :(

lardman 2010-01-06 01:13

Re: DIY digital compass: electronics experts needed!
 
If you've moving the GPS can tell your track, which is probably also your heading assuming you're driving.

When you're stationary it can't tell which way you're pointing

Otaku 2010-01-16 04:23

Re: Photo of bluetooth compass prototype
 
Quote:

Originally Posted by Otaku (Post 450695)
Looks like someone named "HapticGuide" is working on a bluetooth compass prototype for the N900:

Unfortunately, reading the latest update to the project, it seems it's using GPS and movement to determine your direction, not an actual magnetic compass (though the project is advertised as a "wearable compass").

Anyone in this thread constructed a working compass prototype yet?

tz1 2010-01-16 18:10

Re: DIY digital compass: electronics experts needed!
 
Not for the N900 since I don't have one, but I have an HMC5843 breakout, arduino, and bluetooth talking together sending X,Y,Z. I'm working on adding barometric pressure.

sarahn 2010-01-18 16:18

Re: DIY digital compass: electronics experts needed!
 
tz1, can you post how you did that? I'm guessing it works for any bluetooth device which handles serial ports. Thanks!

tz1 2010-01-18 16:57

Re: DIY digital compass: electronics experts needed!
 
I2C Magnetometer:

http://www.sparkfun.com/commerce/pro...oducts_id=9371

First, you might need to fix the capacitor, see the comments.

On the page is some sample code for an ATmega328p. I basically use that merged with an improved I2C driver on my 3.3v Arduino Pro.

http://www.sparkfun.com/commerce/pro...oducts_id=9220

Normally to an FTDI 3.3v breakout to /dev/ttyUSB0, but it is just TTL serial UART levels.

I have a Parani bluetooth module from sena.com that just takes 3.3v, ground, tx, and if you need rx, or you could also use the bluetooth mate:

http://www.sparkfun.com/commerce/pro...oducts_id=9358

The HMC I have runs at around 70Hz and returns 13-14 bits for each axis so even 9600 baud should work but I usually set things faster.

tz1 2010-01-18 20:12

Re: DIY digital compass: electronics experts needed!
 
It produces output like:

472, -9, -687
465, -4, -685
474, -4, -692
471, -8, -683
467, 1, -694
471, -5, -688
475, -11, -691
471, 2, -698
473, 8, -685
474, -3, -685
466, 0, -686
479, -1, -698
469, -7, -694
469, 1, -687
471, 2, -688
472, 5, -690
477, -2, -688

Read the datasheet for details.

Code:

#include <avr/io.h>

#define ENABTW ((1<<TWINT)|(1<<TWEN)|(0<<TWIE))  // 0x80 4 1
#define START TWCR = (ENABTW|(1<<TWSTA))  // 0x20
#define STOP TWCR = (ENABTW|(1<<TWSTO))  // 0x10
#define SEND(x)  TWDR = x;  TWCR = ENABTW;
#define RECV(ack) TWCR = ENABTW | (ack? (1<<TWEA) : 0 );
unsigned char twista;
unsigned twitmo;
#define WAIT twitmo=0; while (!((twista = TWCR) & (1 << TWINT)) && ++twitmo);

/////===================================////////////////////
void TWIinit(void)
{
    DDRC &= ~0x30;              // pullup
    PORTC |= 0x30;              // pullup
    TWBR = 2;                  // 400 khz
    TWCR |= (1 << TWEN);
}

void TWIdocmd(unsigned char *msg)
{
    unsigned int mlen, rdwrf;

    while ((mlen = *msg++)) {
        rdwrf = *msg & 1;
        START;
        WAIT;
        do {
            SEND(*msg++);
            WAIT;
            // should check for ACK - twista == SAWA or SDWA
        } while (--mlen && !rdwrf);
        // read
        while (mlen--) {
            RECV(mlen);
            WAIT;
            *msg++ = TWDR;
        }
    }
    STOP;
}

#ifndef F_CPU
#define F_CPU 8000000
#endif
#include <util/delay.h>
#include <stdio.h>

static int serout(char c, FILE * stream)
{
    if (c == '\n') {
        while( !(UCSR0A & 0x20) );
        UDR0 = '\r';
    }
    while( !(UCSR0A & 0x20) );
    UDR0 = c;
    return 0;
}
static FILE fpuart = FDEV_SETUP_STREAM(serout, NULL, _FDEV_SETUP_WRITE);

void UART_Init(unsigned centibaud) {
    unsigned acc,count;
    // we don't do this often, and it should be more accurate than divides
#define BCLK (F_CPU/800)
    acc = 0;
    count = 0;
    while( acc < BCLK )
        acc += centibaud, count++;
    if( acc - BCLK > centibaud >> 1 )
        count--;
    UBRR0 = count - 1;

    UCSR0C = 0x06;              //8N1 (should be this from reset)
    UCSR0A = 0xE0 | 2;          // clear Interrupts, UART at 2x (xtal/8)
    UCSR0B = 0x18;              // oring in 0x80 would enable rx interrupt
    stdout = &fpuart;        //Required for printf init
}

unsigned char sendhmci[] = {
    5, 0x3c, 0, 0x18, 0, 0,
    0
};
unsigned char sendhmcpr[] = {
    2, 0x3c, 9,
    0
};
unsigned char sendhmcrd1[] = {
    2, 0x3d, 0,
    0
};
unsigned char sendhmcrd2[] = {
    7, 0x3d, 0, 0, 0, 0, 0, 0,
    0
};

int main(void)
{
    unsigned char cnt, sta;
    int xo, yo, zo;

#define BAUD 57600
    UART_Init(BAUD/10);

    for (;;) {
        TWIinit();
        printf("HMC5843\n");
        TWIdocmd(sendhmci);
        printf("Init2\n");
        TWIdocmd(sendhmci);
        printf("Ready\n");
        cnt = 0;
        while (cnt++ < 20) {
            TWIdocmd(sendhmcpr);
            TWIdocmd(sendhmcrd1);
            sta = sendhmcrd1[2];
            if (sta != 5)
                continue;
            cnt = 0;
            TWIdocmd(sendhmcrd2);
            xo = sendhmcrd2[3] | (sendhmcrd2[2] << 8);
            yo = sendhmcrd2[5] | (sendhmcrd2[4] << 8);
            zo = sendhmcrd2[7] | (sendhmcrd2[6] << 8);
            printf("%5d,%5d,%5d\n", xo, yo, zo);
            _delay_ms(12);
        }
    }
}


stefanmohl 2010-02-09 03:54

Re: DIY digital compass: electronics experts needed!
 
Have a look at:

Using PS3 SixAxis controller with N900

http://talk.maemo.org/showthread.php?t=41693

blackbird 2010-02-09 11:09

Re: DIY digital compass: electronics experts needed!
 
Make that i2c magnetometer small enough to fit in the microsd card bay ;)

edgarsz 2010-06-29 11:56

Re: DIY digital compass: electronics experts needed!
 
Hi!

I am also trying to get some sort of digital compass for my N900, and as far as I checked the price and shipping costs for all the parts necessary for simple IC2 -> Bluetooth digital compass, for me it is cheaper, faster and easier to just buy used Android phone (G1/Dream or Tattoo), attach it to the back of N900 with two elastic bands, and create a simple App that transmits compass coordinates from Android phone via Bluetooth/WiFi. I know it sounds completely stupid, but it solves all the battery/circuitry/soldering/etc problems for the same price or cheaper, AND I get an additional phone. Mind if I include this as one of the options in the Digital Compass wiki section?

Edgars


All times are GMT. The time now is 05:38.

vBulletin® Version 3.8.8