# Grim Outlook

A project log for Radiolocation using Pocket Size Transceiver

Let your home automation know which room you're in, your car to know if you're nearby or any other need to detect proximity over a range.

Eric Herbers 12/08/2014 at 19:312 Comments

I've finally got my components, but between trying to sort out the logic for the software and getting ready for my wedding next weekend (I swear to god if someone says the word "excited" again I'm going to snap) I haven't gotten around to wiring anything together or trying more code.

So far I've been simulating the rough logic in Excel and coming to the conclusion that this is going to be a bit more work than I imagined. Once you begin considering that any action taking place outside the microcontroller still has to wait for a clock cycle, many of the proposed ideas for how this could work likely won't.

It's two the point where I either need to start slinging code just to verify something isn't going to work (as opposed to dismissing it) or come up with some other, more hack-worthy, solutions.

One of those solutions is to change the clock speed of one of the microcontrollers. You see, right now everything divides well into 1 (16 Mhz has a clock tick of 62.5 ns, 12 mhz is 83.333~). If I could fudge one to say, 15.8 mhz I could rely on an interesting phenomenon to make this work.

I won't go into the gory details because any attempt to explain them so far have turned into a mess, but by having the transponder operate at a slightly different frequency than the receiver, we can essentially make a vernier scale that can be used to measure time in a very precise manner.

The challenge is that this is only possible by either replacing the crystal with something very non-standard, or relying on the internal oscillator and changing the OSCCAL (Oscillator Calibration) value to shift the frequency. The question is whether the internal oscillator can be stable enough to use and how to apply a calibration procedure intermittently to it to account for temperature changes.

## Discussions

Eric Herbers wrote 12/09/2014 at 15:25 point
That does look feasible, thanks! I think right now that is option C or D... I'm definitely going to try and first find a solution that doesn't involve hardware modifications.

Reading some white papers, it appears that I'm being a little too critical of how I think timing will play into everything. I've got more than a couple sources now that indicate just averaging a number of measurements produced good results and that a common trick was also performing measurements over several different frequency channels to reduce error.

So it looks like it's certainly worth the effort to go ahead and get the software roughed out so I can begin transmitting some signals.

Are you sure? yes | no

PointyOintment wrote 12/09/2014 at 11:10 point
Have a look at this list: https://en.wikipedia.org/wiki/Crystal_oscillator_frequencies
You may be able to find a crystal oscillator near 16 MHz in some old equipment.

Are you sure? yes | no