Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

A Completed Radio Tracker Transmitter

DZone's Guide to

A Completed Radio Tracker Transmitter

A project long in the making finally comes together. See how one dev has put together a radio tracker transmitter, including tips on power management.

· IoT Zone
Free Resource

Address your IoT software testing needs – improve quality, security, safety, and compliance across the development lifecycle.

All very shiny and works well…

If you're just tuning in, I've been working for a few years on a radio tracker transmitter. You can take a look at my journey from the beginning here. I’ve now put a GP-635T, Arduino Pro Mini, and Zeta 433MHz SO and battery in my small-ish ABS housing. Here’s what it looks like on the inside:

Dremeled a hole in the side for the antenna. (My Dremel has changed my life! Amazing things. Totally get one.)

Still using a wire (waiting on the delivery of a couple of solderable SMA PCB connectors). Here’s the boxed and sealed final unit:

I’ve also range tested it in the house…

I got a grand total range with a wire antenna of…

Wait for it…

Drum roll please…

10cm.

Yes. 10 Centimetres.

To be fair, I’ve not tuned the radio settings or used my decent antenna assembly. Not even sure what power level the radio chip is set to. I’m using a piece of shielded wire from my electronics kit — how good was it really gonna be?

Decoding the signal is good though. At the moment, I’m sending over the lon and lat as a signed long (strangely how the MicroNMEA library works).

Translating that on the LCD looks like the below (the two digit number is RSSI signal strength):

(Exact co-ordinates redacted for privacy reasons).

Not too shabby at all.

Software Changes

Using the NMEA, SoftwareSerial, and ZetaRF libraries meant I had a low memory warning when uploading my code. This warned about stability issues.

Oh my word, was that warning not kidding! It kept calling functions instead of outputting variable values. All sorts of nastiness.

I changed to MicroNMEA, which removed a lot. Then I turned all these lines:

 Serial.println(“In setup()”); 

To this:

 Serial.println(F(“In setup()”)); 

That saved me a couple of hundred bytes instantly. This is a built-in macro to the Arduino libraries, a genius added a few years ago.

I also changed variables that never change like this:

int pinGpsSleep = 6; 

To this:

#define pinGpsSleep 6

Note the lack of = and ; on the #define – It’s a C thang. Preprocessor directives effectively do a String replacement rather than variable declaration, so it replaces this hard coded value in your code. Not an issue at all for integer types.

All these changes got me from 71% memory usage down to 51%. Phew. Then everything started working again!

Next Steps

Attach the SMA connectors when they arrive, and a proper antenna I already have. Then…

In order to conduct a very basic field range test, I’m going to get the LCD to show the most southerly latitude and most westerly longitude reading rather than the last full reading. This way, I can walk around with the transmitter and leave the breadboarded LCD unit in the car (and hope no-one calls the bomb squad! Wires poking out and things…).

I have code and hardware for a MicroSD card logger creating a GPX file on the fly, but that would add time and complexity, so I’ll settle for the basic test whilst dog walking first.

After this, I’ll tweak the radio settings to within an inch of their life (whilst staying legal in the UK with power ratings), and then re-test.

Leo will be pleased with all the extra long walks! Here he is:

 

Accelerate the delivery of high-quality software in the connected IoT era through an integrated analysis, testing, security, and analytics platform

Topics:
iot ,radio ,arduino ,string replacement ,power management ,tutorial

Published at DZone with permission of Adam Fowler, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}