Main Site Documentation

Initial Success with Seeed OLED and Compass Modules


#1

Just wanted to share with any folks considering picking up some of the Seeed Studio modules, I got a bunch of them late last week, and finally had the chance to start doing some testing.

So far, I’ve played with only the GPS, OLED display, and Compass modules.

The OLED display works quite nicely, but at 128x128, it’s fairly limited in terms of text display. That’s the major downside of it, apart from it being quite small. On the plus side, it only uses a single socket (versus 3-4 for the T35 display), so if you’re using a lot of other modules, and don’t need a lot of display area (or touch), it might be just the ticket.

I have not had much luck with the GPS module yet. The code looks very straightforward, but I think the GPS module may require more power than can be supplied by USB alone, and I don’t yet have a power adapter to plug into the USB DP module (something I will remedy soon). When I tested a project using the GPS module, the Spider mainboard kept connecting and disconnecting, and the OLED display kept flashing, which is what leads me to believe its a power issue.

Since I couldn’t get the GPS running, I opted to test the Compass module next. This worked a treat, and the code was very straightforward to use, with APIs to either get a spot measurement, or to start receiving continuous measurements. The returned sensor data provides the current compass heading in degrees (though the Intellisense says radians), from 0 to 359. I don’t have a known good compass to compare to, but the values seemed reasonable (though I’m not sure what value corresponds to a given compass heading…seemed like 0 was pretty close to south).

I was able to display the compass data on the OLED display, which counts as a win in my book.

I’ll update this with example code when I’m back on my other PC where the code is. :slight_smile:

Here’s the code, as promised, in case anyone’s interested:

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;

using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
using Gadgeteer.Modules.Seeed;

namespace CompassOLEDTest
{
    public partial class Program
    {
        void ProgramStarted()
        {
            // Do one-time tasks here
            Debug.Print("Program Started");

            oledDisplay.SimpleGraphics.BackgroundColor = GT.Color.White;
            oledDisplay.SimpleGraphics.DisplayTextInRectangle("Now running!", 2, 2, 120, 20, GT.Color.Black, Resources.GetFont(Resources.FontResources.NinaB));

            compass.MeasurementComplete += new Compass.MeasurementCompleteEventHandler(compass_MeasurementComplete);

            compass.StartContinuousMeasurements();
        }

        void compass_MeasurementComplete(Compass sender, Compass.SensorData sensorData)
        {
            oledDisplay.SimpleGraphics.DisplayTextInRectangle("Current heading: ", 2, 25, 120, 20, GT.Color.Black, Resources.GetFont(Resources.FontResources.NinaB));
            int heading = (int)System.Math.Floor(sensorData.Angle);
            oledDisplay.SimpleGraphics.DisplayRectangle(GT.Color.White, 0, GT.Color.White, 2, 45, 120, 20);
            oledDisplay.SimpleGraphics.DisplayTextInRectangle(heading.ToString(), 2, 45, 120, 20, GT.Color.Black, Resources.GetFont(Resources.FontResources.NinaB));
        }
    }
}


#2

Fun, fun, fun… I’m wondering how well shielded the compass is from other magnetic interference or nearby metal objects. The GPS should give you a decent heading to compare against if you’re moving. The Boy Scout in me pines for the days of orienteering with a map and plain old “analog” compass, but the All Powerful Inner Geek quickly squashes this sentiment with gadget cravings.

It’s BS versus APIG ;D


#3

I never leave the trail w/o both. APIG is useless once his batteries die :wink:

@ devhammer Thanks for sharing! You might try the GPS w/o the OLED plugged in. It might have enough power that way. Of course you will not be able to show the data on the OLED then but you can work out your functions in the debugger until you get more power.


#4

@ ian

Thanks for the suggestion, but I’m done for tonight, and I’ll probably run out to Radio Shack tomorrow and grab an adapter. I’ve been living on borrowed time as it is, given the many modules I’ve had running at once. Better to give these poor critters the juice they crave rather than running them underpowered. :slight_smile:


#5

If you have Serial-USB Module and Extension module you can power it by wiring power on extension module. Just make sure not to plug red module and debug through Serial-USB module.


#6

OK, this is a bit weird.

It appears I was incorrect in my assumption about the GPS requiring too much juice for USB. After picking up both an AC/DC adapter (switchable voltage, from 3-12v, and 1A) as well as both 9v and 6v battery leads/packs, and soldering them up to connect to the USB Client DP module, now the GPS works only if I don’t have external power connected. If I have the USB cable connected to debug, along with any of the external power supplies, the GPS continually restarts, which also restarts the app.

Is there a configuration setting I’m missing somewhere for when you’re using external power with the USB Client DP module, or should it automatically switch where it’s pulling power from?

The good news is that I did manage to get the GPS working, and it is tracking location (though not super accurately, but that could have to do with the fact that I’m testing it indoors, so it may not be able to pick up many satellites).

Any tips on troubleshooting the GPS module restarting would be welcome.


#7

No,it is safe to use both connected.

Do any other modules work with external power supply and usb connected?


#8

My OLED left HK on the 8th so I’m hoping to have it by June :wink:

I think it’s great for small stuff like robot readouts or even a secondary minimap screen for games…hint, hint


#9

@ Architect,

Yes, the OLED module and compass module both seem to work fine with both USB and external power connected. I’ll have to check on others.


#10

@ devhammer, I’d be surprised if the GPS “restarted” and restarted your app unless there is actually an issue with the power draw and battery that’s not causing brown-out and the uC to reset. Can you confirm via debugging or displays that the app actually resets ? Also, do you have a multimeter? Preferably with a peak hold fuction? If so, can you watch the current draw as you start the device and as it resets?


#11

@ Brett,

Good suggestions…not sure if my DMM has a peak hold, but I can test the current draw anyway.

When the issue is occurring, what I get is the OLED display comes up, with the default text that I set, then the LED on the GPS blinks for a split-second, and my laptop makes the USB “unplugging” sound, then the OLED screen goes dark, comes back up, the laptop makes the USB “plugging in” sound, rinse and repeat.

I doubt now that it’s a power issue, however, given that it now works when connected to only USB, but does not work if I attach additional power, either via wall wart or battery pack.