Daily Archives: 5/26/2015

Teensy LC hooked to an Adafruit Ultimate GPS…

One of the things that I really like about the Teensy LC (besides its low price) is that it has three hardware serial ports. Hardware serial ports are just nicer than the SoftwareSerial ports that you see on the ordinary Arduino platform. While the latest support for SoftwareSerial ports on digital pins work reasonably well at low baud rates, they aren’t especially good or reliable at higher baud rates. The Adafruit UltimateGPS I have supports data output at 10Hz, which requires serial rates of 115200, which isn’t especially reliable.

But I’m still inexperienced with the Teensy. To test my understanding, I wrote this little program for the Teensy LC, after hooking my GPS up to pins 0/1 as RX/TX. Note: the Serial object does not route to any of these three outputs: the Serial object is a distinct USB object that is not mapped directly to digital pins.

This was also an attempt to test the TinyGPS library with the Teensy LC. It worked the very first time I got it to compile.

I’m definitely leaning toward using the Teensy (either the cheaper LC version, or the more expensive but more faster/more capable 3.1, which includes FIFOs for serial ports) on my WSPR project.

[sourcecode lang=”cpp”]
// __
// / /____ ___ ___ ___ __ _________ ____ ___
// / __/ -_) -_) _ \(_-</ // /___/ _ `/ _ \(_-<
// \__/\__/\__/_//_/___/\_, / \_, / .__/___/
// /___/ /___/_/
//
// On the Teensy LC, there are three hardware supported serial ports.
//
// Port Rx Tx
// ——-+–+–+
// Serial1| 0| 1|
// ——-+–+–+
// Serial2| 9|10|
// ——-+–+–+
// Serial3| 7| 8|
// ——-+–+–+
//
// It appears (as yet unverified) that these are distinct from the serial
// port which is connected to the Serial object. This program is designed
// to test that theory.

#include <TinyGPS.h>

TinyGPS gps;

void
setup()
{
Serial.begin(9600);
Serial1.begin(9600);
}

void
loop()
{
unsigned long date, time, age;
long lat, lng ;
for (;;) {
while (Serial1.available()) {
char c = Serial1.read();
if (gps.encode(c)) {
gps.get_datetime(&date, &time, &age);
Serial.print("Date: ");
Serial.println(date);
Serial.print("Time: ");
Serial.println(time);
gps.get_position(&lat, &lng) ;
Serial.print("LAT: ");
Serial.println(lat);
Serial.print("LNG: ");
Serial.println(lng);
Serial.println();
}
}
}
}
[/sourcecode]

Phantom Bad Boys…

I mentioned that during yesterday’s aborted attempt to fly quadcopters from a regional park resulted in a visit from the “Can’t Possibly Have Fun Police”, informing us that short sighted regulations against flying had been enacted in Eastbay Regional Parks. The entire incident was recorded remotely from Joachim’s Phantom 2. With soundtrack! (This is what footage from my copter should look like when the gimbal is working properly).