RF Detector
Moderator: Benj
RF Detector
Hello all,
I have constructed a project which converts the DC voltage from a RF detector circuit to ADC counts using a PIC16F876 and displays the counts as RF power in -dBm and a Bar graph representing signal strength on a LCD. Initially in the calculator block I just put in simple calculations such as RFPower=(ADCReading -1023)*45/716 and Bars=45/(0-RFPower) whilst I completed the rest of the project. Once all finished I calculated a equation from the plot of RF power vs counts and came up with RFPower=(ADCReading*0.0571-83.2972), Bars=400/(0-RFPower). With these equations placed in the calculator block simulation worked fine but when the micro was programmed the RF detector stopped working all the LCD display did was stay on one number and not display any bars, number was random any help greatly appreciated. Also I admit I did plagiarise the Bar graph program.
Regards,
Don
I have constructed a project which converts the DC voltage from a RF detector circuit to ADC counts using a PIC16F876 and displays the counts as RF power in -dBm and a Bar graph representing signal strength on a LCD. Initially in the calculator block I just put in simple calculations such as RFPower=(ADCReading -1023)*45/716 and Bars=45/(0-RFPower) whilst I completed the rest of the project. Once all finished I calculated a equation from the plot of RF power vs counts and came up with RFPower=(ADCReading*0.0571-83.2972), Bars=400/(0-RFPower). With these equations placed in the calculator block simulation worked fine but when the micro was programmed the RF detector stopped working all the LCD display did was stay on one number and not display any bars, number was random any help greatly appreciated. Also I admit I did plagiarise the Bar graph program.
Regards,
Don
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: RF Detector
Hi Don,
Welcome to Matrix forums.
It's always helps if you can post a flowchart, and let us know what version of flowcode you have got (Help, About Flowcode)
If it's commercially sensitive then someone may be able to PM you about that.
Martin
Welcome to Matrix forums.
It's always helps if you can post a flowchart, and let us know what version of flowcode you have got (Help, About Flowcode)
If it's commercially sensitive then someone may be able to PM you about that.
If it is from a flowchart that I had posted then I don't mind at all!don854 wrote: Also I admit I did plagiarise the Bar graph program.
Martin
Martin
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
Re: RF Detector
Hi Don
Sounds an interesting project.
What hardware are you using for the RF detector?
Sounds an interesting project.
What hardware are you using for the RF detector?
1 in 10 people understand binary, the other one doesn't !
Re: RF Detector
Apologies couldn't figure out how to attach the flowchart. I'm using Flowcode 4.5. Hardware used is the following;
Gali-39 RF Amp
MAX4003 RF Detector
LM358 Signal conditioning-Peak detector and non-inverting amp
MCP73831 LI-ION Battery Charger and
Pololu U3V12F9 DC/DC converter
The detector is designed as a handheld device that's the reason for the MCP73831 and the DC/DC converter is for the RF circuit.
How do I attach the Flowchart?
Don
Gali-39 RF Amp
MAX4003 RF Detector
LM358 Signal conditioning-Peak detector and non-inverting amp
MCP73831 LI-ION Battery Charger and
Pololu U3V12F9 DC/DC converter
The detector is designed as a handheld device that's the reason for the MCP73831 and the DC/DC converter is for the RF circuit.
How do I attach the Flowchart?
Don
- Attachments
-
- Phone Detector.fcf
- Don't know how I missed that.
- (11 KiB) Downloaded 663 times
Last edited by don854 on Wed Jun 04, 2014 9:00 am, edited 1 time in total.
Re: RF Detector
Apologies how do you attach the flowchart?medelec35 wrote:Hi Don,
Welcome to Matrix forums.
It's always helps if you can post a flowchart, and let us know what version of flowcode you have got (Help, About Flowcode)
If it's commercially sensitive then someone may be able to PM you about that.
If it is from a flowchart that I had posted then I don't mind at all!don854 wrote: Also I admit I did plagiarise the Bar graph program.
Martin
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RF Detector
Hello,
When creating/editing a post there is a tab below the main text entry field which states "Upload Attachment", click on this for options to attach a file to the post.
When creating/editing a post there is a tab below the main text entry field which states "Upload Attachment", click on this for options to attach a file to the post.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: RF Detector
I might have confused people with my original post so I will hopefully make my problem more clearer. The flowchart attached is almost similar to the original except for the calculator block which has the equation for counts to RF power this flowchart compiles and simulates ok. But when running on the EB006 and LCD board is stays on a ridiculous number such as 18986dBm no negative sign and will not change when counts are changed including the bar graph, I have tried changing variables to floats string manipulation nothing works when I revert to the original flowchart no problems hardware works fine. So I'm fairly confident in saying the hardware isn't the problem the micro just doesn't like linear equations I'm confused. The original flowchart is very inaccurate more than 20dBm error.
- Attachments
-
- RF Det.fcf
- Modified flowchart
- (11 KiB) Downloaded 623 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: RF Detector
Hi Don.
The problem with your flowchart is with the type of variable you're using for calculations.
for instance an Integer is being used, and they are whole numbers only. You can't use any decimal point as thy will be completely ignored and whole part will be rounded down.
e.g 0.999 * 1023 +10
= 0 * 1023 + 10
=0+10
=10
The range of integer (its a signed integer to be precise) is -32678 to 32767
So with using only whole numbers, you will loosing accuracy.
The only way you can use decimal numbers like 0.999 is by using float variables.
They are not really recommended for the older 16F range pics due to taking up loads of ram and 32bits of rom so you will be running out of memory very quickly.
It not all doom as I have modified your flowchart to work on hardware.
With pot reading 0V then display should show -83.4dBm
With pot reading 5V then display should show -24.8dBm
If you want the range to be different then let me know.
THe other thing to mention is when using integer calculations do not go over the integer range of -32678 to 32767
E.g 1023 * 32 is allowed as that will = 32736
1023 * 33 is not allowed as that will -31777 since the result is larger than the allowed 32767 the number has rolled over.
Hence the random looking numbers you're experiencing
Martin
The problem with your flowchart is with the type of variable you're using for calculations.
for instance an Integer is being used, and they are whole numbers only. You can't use any decimal point as thy will be completely ignored and whole part will be rounded down.
e.g 0.999 * 1023 +10
= 0 * 1023 + 10
=0+10
=10
The range of integer (its a signed integer to be precise) is -32678 to 32767
So with using only whole numbers, you will loosing accuracy.
The only way you can use decimal numbers like 0.999 is by using float variables.
They are not really recommended for the older 16F range pics due to taking up loads of ram and 32bits of rom so you will be running out of memory very quickly.
It not all doom as I have modified your flowchart to work on hardware.
With pot reading 0V then display should show -83.4dBm
With pot reading 5V then display should show -24.8dBm
If you want the range to be different then let me know.
THe other thing to mention is when using integer calculations do not go over the integer range of -32678 to 32767
E.g 1023 * 32 is allowed as that will = 32736
1023 * 33 is not allowed as that will -31777 since the result is larger than the allowed 32767 the number has rolled over.
Hence the random looking numbers you're experiencing
Martin
- Attachments
-
- RF Det V2.fcf
- (11.5 KiB) Downloaded 669 times
Martin
Re: RF Detector
Thanks medelec35,
My intentions were to make the variables floating it's because I couldn't get the flowchart to work that I used integers for ease. I didn't realise I was going over range, had a feeling it was something simple I'm better with hardware than software. The flowchart worked fine all tested fine.
Cheers Don
My intentions were to make the variables floating it's because I couldn't get the flowchart to work that I used integers for ease. I didn't realise I was going over range, had a feeling it was something simple I'm better with hardware than software. The flowchart worked fine all tested fine.
Cheers Don
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: RF Detector
Hi Don,
Thanks for updating us as forum users like to find out what the end result was..
Martin
That happens fairly often and can take the more experienced by surprise.don854 wrote: didn't realise I was going over range
Thanks for updating us as forum users like to find out what the end result was..
Martin
Martin