GPS NMEA antenna aiming tracker.

Thread Starter

camerart

Joined Feb 25, 2013
3,730
What do you mean by as small as possible?
Number of pins or something else.
Don't you use LCD anymore.

Did you update Oshonsoft to PIC18 IDE ?
I don't know if Oshonsoft Basic uses the hardware multiplier, but at least you get 2x speedup.
JJW,

Yes I mean number of pins. I think as this is quite a big project for me, I won't need any more pins than necessary.

Yes, thanks for reminding me, I will be using an LCD, so that plus 7 = 16ish.

I've had pointed out that look-up tables are on 18 series (Yes I've updated to PIC18 IDE) I want to be sure I've chosen the correct PIC before I go too far. For me it's better I use the same PIC over and over, and not change about.

Camerart
 

THE_RB

Joined Feb 11, 2008
5,438
...
Just updated to 18series PICs.
Congrats, you will have an easier time now.


...For this sort of application, I count signal UART-1 pin, motors -2, feedback-2, leds-2, and keyboard, I'm not sure how many, maybe USB-2. There may be more, I'm sure there will be, but so far 9 ish. So can you recommend which PIC you would choose. As small as possible please.
...
Your 2 motors will require 2 pins EACH. Step and Dir.

Also, how are you going to index the motor home position? You might want to allow 2 input pins as well, to be used as the two axis homing position sensors.

And as JJW said; what about a display? Surely you want some readout showing some GPS stats or what it is doing at the time.

Regarding PIC pin count, I suggest you go for as many as possible! It's not harder going to a 40 pin PIC, it is actually easier, because when you realise you forgot something there are lots of handy spare pins waiting for you. :D

I'm not sure what is the popular PIC 18F 40pin these days, I use 18F452 which were very popular in the day and have lots of ROM to fit big math functions. I would suggest a 5v PIC, not a 3.3v part.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
PINS: Your correct Motors-4 and LCD-7

Eric suggests not to use my sugestion of USB keyboard, instead a 4X4Keyboard -9. So if the USB could be programmed, then -2

The count so far with 4X4 keyboard: LCD-7, Uart-1, Leds-2, motors-4, feedback-2, keyboard-9. Total=25

Eric gave me a possibility of 18F2520 -28 or easily switch to 40PIN if I get stuck.

I'll bear in mind 5V.

My indexing will be opto disks and feedback is Dc motors.

Camerart.






Congrats, you will have an easier time now.

Your 2 motors will require 2 pins EACH. Step and Dir.

Also, how are you going to index the motor home position? You might want to allow 2 input pins as well, to be used as the two axis homing position sensors.

And as JJW said; what about a display? Surely you want some readout showing some GPS stats or what it is doing at the time.

Regarding PIC pin count, I suggest you go for as many as possible! It's not harder going to a 40 pin PIC, it is actually easier, because when you realise you forgot something there are lots of handy spare pins waiting for you. :D

I'm not sure what is the popular PIC 18F 40pin these days, I use 18F452 which were very popular in the day and have lots of ROM to fit big math functions. I would suggest a 5v PIC, not a 3.3v part.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
The RB, or anyone who has experience of trig based projects.

Will you check 18F4520 PIC please? This has been suggested, and if you think it will be ok for this project, from your experience of Trig, calculation programming etc, is it what you might choose?

Cheers, Camerart.
 
Last edited:

jjw

Joined Dec 24, 2013
823
You said that you will use Oshonsoft Basic, it has sin & cos functions, arctan
is missing, but can be done in many ways depending on needed accuracy or speed.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
You said that you will use Oshonsoft Basic, it has sin & cos functions, arctan
is missing, but can be done in many ways depending on needed accuracy or speed.
JJW,
True, I can only program in Basic, Oshonsoft being one of them. It has been suggested (Correct me if I've got it wrong) that if the trigonometry is done in 'C' (which has Arctan), and used inside a basic program, this might work. I don't need to see the calculation, as I might only need to change peripheral stuff. Does this sound feasible?

I've never done maths with it, I'm just about to have a go at Arctan, on paper as an exercise. As for the calculation I end up with, whatever is possible will just have to suit me.

Camerart.
 

jjw

Joined Dec 24, 2013
823
Why it should be done in C when it can be done in Basic?
You can do arctan with tables + interpolation if needed for more accuracy or with some approximation function.

I found in the net a simple approximation for arctan.
Accuracy is better than 0.3 degrees.

First quadrant (0<= x <= 1 ) arctan(x) = x/(1+0.28125*x^2) radians
second quadrant ( x > 1) arctan(x) = pi/2-x/(x^2+0.28125)

Other quadrants by symmetry.
 

THE_RB

Joined Feb 11, 2008
5,438
The RB, or anyone who has experience of trig based projects.

Will you check 18F4520 PIC please? This has been suggested, and if you think it will be ok for this project, from your experience of Trig, calculation programming etc, is it what you might choose?
...
Well the first thing would be to go to 18F4620, it is the same part but with double the RAM and double the ROM. For an extra buck.

Re the trig calc stuff all the 18F series have the math mutliplier hardware built in, so that PIC has it.

That PIC runs at max 40MHz HSPLL (10 MIPS) which is pretty standard. Some newer 18F series run 12 MIPS or 16 MIPS, but most are 3.3v parts.

Personally I think 10 MIPS with the math hardware will be plenty fast enough. The slowest thing will be turning the motors, the calc will be much quicker than that and if you want to get smarty-pants with it you can even do the calc while the motors are turning.

The only time you might need more math speed would be if you planned on pointing at a fast moving UAV as it flies past in real time, or to shoot down incoming enemy missiles etc. ;)
 

ericgibbs

Joined Jan 29, 2010
18,872
True, I can only program in Basic, Oshonsoft being one of them. It has been suggested (Correct me if I've got it wrong) that if the trigonometry is done in 'C' (which has Arctan), and used inside a basic program, this might work. I don't need to see the calculation, as I might only need to change peripheral stuff. Does this sound feasible?
Hi C,:)

I did not say that, I said if you use the 'C' Trig/Math Libs you will have to write the main body of the program using 'C'.

I also said that if you use Basic its possible to have Assembler coding within the Basic program, that could do the Trig/Maths.

Looking at your latest resolution value for Angles, ie: 1 deg , I also pointed out that a Table with 90 ArcTan values could be used, rather than calculating Atn on the fly, which will take time and also require more program memory.

The Northing Cosine value for the Base station tracker, [used to correct the Easting Offset value of the Remote] could be entered using using a keypad, its only required once at the start of a scan.

I also recommended a PIC 18F4520, using a 20MHz Xtal as a project starting PIC, if you find at a later date a smaller PIC would do the job, a 18F2520 [ 28 pin], the program would be compatible with the 18F4520

The PIC18F4520 series has Table Instructions that will simplify the Table usage.

Eric

EDIT:
The RB, or anyone who has experience of trig based projects.
I designed and manufactured electronic surveying equipment for over 25 years, including , automatic laser scanners, GPS base stations, Chart plotting and position digitisation, etc...
Does this qualify..:)
E.
 
Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Why it should be done in C when it can be done in Basic?
You can do arctan with tables + interpolation if needed for more accuracy or with some approximation function.

I found in the net a simple approximation for arctan.
Accuracy is better than 0.3 degrees.

First quadrant (0<= x <= 1 ) arctan(x) = x/(1+0.28125*x^2) radians
second quadrant ( x > 1) arctan(x) = pi/2-x/(x^2+0.28125)

Other quadrants by symmetry.
JJW,

As I don't understand this level of maths, would you explain "Other quadrants by symmetry" please.

C.
 

jjw

Joined Dec 24, 2013
823
I tested the approximation function above in Oshonsoft Basic.
It takes about 0.4ms to calculate the arctan with 20MHz oscillator frequency.

I think the speed and 0.26 degrees accuracy is good enough for your application.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Well the first thing would be to go to 18F4620, it is the same part but with double the RAM and double the ROM. For an extra buck.

Re the trig calc stuff all the 18F series have the math mutliplier hardware built in, so that PIC has it.

That PIC runs at max 40MHz HSPLL (10 MIPS) which is pretty standard. Some newer 18F series run 12 MIPS or 16 MIPS, but most are 3.3v parts.

Personally I think 10 MIPS with the math hardware will be plenty fast enough. The slowest thing will be turning the motors, the calc will be much quicker than that and if you want to get smarty-pants with it you can even do the calc while the motors are turning.

The only time you might need more math speed would be if you planned on pointing at a fast moving UAV as it flies past in real time, or to shoot down incoming enemy missiles etc. ;)
The_RB,
I think the one suggested in the next post 16F2520, runs (10MIPS) and Eric, is used to them, I'll go with those for the present.

Once tested if it can't keep up with the UAV, I'll re-think, or drive it slower:)
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Well the first thing would be to go to 18F4620, it is the same part but with double the RAM and double the ROM. For an extra buck.

Re the trig calc stuff all the 18F series have the math mutliplier hardware built in, so that PIC has it.

That PIC runs at max 40MHz HSPLL (10 MIPS) which is pretty standard. Some newer 18F series run 12 MIPS or 16 MIPS, but most are 3.3v parts.

Personally I think 10 MIPS with the math hardware will be plenty fast enough. The slowest thing will be turning the motors, the calc will be much quicker than that and if you want to get smarty-pants with it you can even do the calc while the motors are turning.

The only time you might need more math speed would be if you planned on pointing at a fast moving UAV as it flies past in real time, or to shoot down incoming enemy missiles etc. ;)
The_RB,
I think the one suggested in the next post 16F2520, runs (10MIPS) and Eric, is used to them, I'll go with those for the present.

Once tested if it can't keep up with the UAV, I'll re-think, or drive it slower:)

C.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Hi C,:)

I did not say that, I said if you use the 'C' Trig/Math Libs you will have to write the main body of the program using 'C'.

I also said that if you use Basic its possible to have Assembler coding within the Basic program, that could do the Trig/Maths.

Looking at your latest resolution value for Angles, ie: 1 deg , I also pointed out that a Table with 90 ArcTan values could be used, rather than calculating Atn on the fly, which will take time and also require more program memory.

The Northing Cosine value for the Base station tracker, [used to correct the Easting Offset value of the Remote] could be entered using using a keypad, its only required once at the start of a scan.

I also recommended a PIC 18F4520, using a 20MHz Xtal as a project starting PIC, if you find at a later date a smaller PIC would do the job, a 18F2520 [ 28 pin], the program would be compatible with the 18F4520

The PIC18F4520 series has Table Instructions that will simplify the Table usage.

Eric

EDIT:


I designed and manufactured electronic surveying equipment for over 25 years, including , automatic laser scanners, GPS base stations, Chart plotting and position digitisation, etc...
Does this qualify..:)
E.
Hi E,

I've slapped my legs this morning and just let myself out of the naughty corner:)
I looked at your CV, and Well done you've got the job:0

I've re-counted the pins needed and I ran out on the 28 pin, so 18F4520 it is. I'll order some and get started.

Cheers, Camerart.
 
Last edited:

jjw

Joined Dec 24, 2013
823
JJW,

As I don't understand this level of maths, would you explain "Other quadrants by symmetry" please.

C.
I should have said octants, first 0-45 degrees, second 45-90 degrees,
third 90-135 and so on.
But I think you need this only for the elevation angle, so two octants is enough.
 

ericgibbs

Joined Jan 29, 2010
18,872
I've re-counted the pins needed and I ran out on the 28 pin, so 18F2520 it is. I'll order some and get started.
hi C,
Sorry if I sounded a little sharp..;)

Do you mean order some 18F4520, not 18F2520.??

With regard to some other 18F series PIC's that have been suggested, check that Oshonsoft lists them.

Eric
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
There are many maths terms used above from each of you that I don't understand, but I'm sure you all do. My son has just explained what the Oshonsoft Function grapher does, so I can play with that and pick up a few points.

What I think is needed: A program that takes reads incoming receiver signals 1/Tracker types in on (0-9 and A-F) keyboard, gets two NMEA data sentences, and parses the LON, LAT, ALT from both. Compares between the two and gives Azimuth and elevation degrees. These two readings will then be compared to the tracker readings in degrees. In each case, if one reading from the source is > or < the tracker, then the tracker moves accordingly.

Thanks, Camerart.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Why not 18F4620 as RB suggested, double ROM, more RAM.
The program space will always be filled :)

It's price is about 1$ more in single units.
JJW,

Perhaps I should have done, but Eric, has 18F4520 and he lives in the next county, so in an emergency, I'm sure would post a programmed chip to me, if I have a programming problem, as happened in the past.

I just thought I would get the ball rolling and remember the 4620, if the extra features help, also I would also have enough experience to see the difference.

Camerart.
 
Top