HobbyPCB.com

Built by Hobbyist for Hobbyist!
It is currently Mon Aug 19, 2019 1:17 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Understanding the code
PostPosted: Sun Apr 21, 2019 9:14 am 
Offline

Joined: Sun Apr 21, 2019 8:59 am
Posts: 5
I am working on putting together a radio using the Teensy 3.6 Arduino board, Teensy Audio board and the RS-HFIQ. I am working on replacing the nano with the Teensy and I have a few questions.

1. What is the clip light and what is it used for?
2. I see code for setting the external frequency reference on CLK_2 but the board has no external connection. Is CLK_2 needed?
3. I see reference to the temperature sensor. Is this just for reference?
4. I see code this in the code...
// Analog A0 is used to read the temperature of the crystal and adjust
// the frequency accordingly. There is a 2.048V precision voltage reference on
// The AREF pin so we'll use it as our reference
analogReference(EXTERNAL);

but I see no code to do anything with it. Is this needed?

Any help in these areas would be greatly appreciated. I am trying to eliminate any extraneous inputs because I likely need all inputs on the Teensy.

Ken KE3C


Top
 Profile  
 
PostPosted: Sun Apr 21, 2019 7:13 pm 
Offline

Joined: Mon Jul 23, 2012 6:25 am
Posts: 1142
Hi Ken,

1. What is the clip light and what is it used for?
There is a relative power detector that drives one of the analog inputs. Since most SDR software does not have any kind of a TX output level display, we decided that we should light a light if the TX is overdriving. It's not an exact science, it depends on the supply voltage, SWR and other factors but it's better than nothing. If your Teensy has a display you could drive a TX relative power meter which would be better IMHO.

2. I see code for setting the external frequency reference on CLK_2 but the board has no external connection. Is CLK_2 needed?
You can add the transformer and output jack and use CLK_2 as a LO for a VHF converter, drive a SWR bridge, use it as a GP signal generator. It works from 4 kHz to 225 MHz but it has no function in the base radio.

3. I see reference to the temperature sensor. Is this just for reference?
The original version of the board had a crystal oscillator and we used Arduino code to temperature compensate the frequency of the crystal. It didn't work very well. On the Rev D boards we replaced the crystal with a TXCO so there's no need for temperature compensation in software. But it's nice to be able to monitor the temperature in any case so I left the sensor. You don't need it unless you want display the board temperature.

I made a prototype SDR with a RS-HFIQ and a Teensy 3.2 with the audio card and 2.8" display. I'll share the project with you if you want it.

Here is a video if it in action: https://www.youtube.com/watch?v=rtdGiA5sZSY

73,
Jim WA2EUJ


Top
 Profile  
 
PostPosted: Mon Apr 22, 2019 4:50 pm 
Offline

Joined: Sun Apr 21, 2019 8:59 am
Posts: 5
Thanks for the quick response.

I am still in the infant stages of this project. I have code that I hacked together from several sources that does some basic frequency control to receive, applies some filters and builds a waterfall display. I was working on building my own SDR hardware and had my code working on that hardware. Then I remembered the RS-HFIQ I purchased from you at Dayton 2 years ago and decided to pause the hardware build and try to get it working with the RS-HFIQ.

I would love to see your code and I would be happy to share my code once I have it working well.

Ken KE3C


Top
 Profile  
 
PostPosted: Mon Apr 22, 2019 8:36 pm 
Offline

Joined: Mon Jul 23, 2012 6:25 am
Posts: 1142
Hi Ken,

Here is a link to my Arduino project:

https://www.dropbox.com/sh/w07xi3aof58827o/AAAHBUkgGeE0KhGepUXEUKn2a?dl=0

It uses the functions in the Teensy Audio library. I apologize in advance for the lack of comments and proper programming techniques; I'm an RF Engineer not a C++ programmer.

73,
Jim WA2EUJ


Top
 Profile  
 
PostPosted: Tue Apr 23, 2019 10:32 am 
Offline

Joined: Sun Apr 21, 2019 8:59 am
Posts: 5
No problem on the engineer vs. programmer thing. I am a mechanical engineer by degree, but after 15 years working as an ME, I worked 20+ years as a programmer, IT Manager and IT Director.

I just downloaded the code, but haven't looked at it yet. I actually enjoy cleaning up code and getting it parsed out into objects. I find that it is a good way to get to know the code and the interactions and dependencies between functions and objects.

Thanks for sharing.

73s de KE3C


Top
 Profile  
 
PostPosted: Tue Apr 23, 2019 11:04 am 
Offline

Joined: Sun Apr 21, 2019 8:59 am
Posts: 5
Now that I am looking at your code I have a couple more questions. I hope that is okay. Just let me know if I am asking too many questions.

I see you are using a serial connection and talking to the nano on board the RS-HFIQ. I actually had your nano code running on the Teensy, removed the nano and wired in the teensy. I am thinking now that your approach of just communicating via serial is much better since all one really needs to do is control the frequency. Would you mind sharing how you wired up to the nano. Can I just connect RX1 on the Teensy to TX1 on the nano and TX1 on the Teensy to RX1 on the nano? I have never done serial between two arduino processors.

Also, am I correct in saying that the nano gets powered by the usb connection on the RS-HFIQ? Is there an easy way to get power to the nano from the RD-HFIQ?

Thanks for answering these questions.

Ken KE3C


Top
 Profile  
 
PostPosted: Wed Apr 24, 2019 5:18 am 
Offline

Joined: Mon Jul 23, 2012 6:25 am
Posts: 1142
Hi Ken,

I think that for the P40 I re-purposed the 'KEY' 3.5mm jack and cut the traces that normally went to D2 and D3 and a wired them to TXD and RXD on the Nano. The Nano has 1K resistors in series with the serial lines going to the CH340 USB-serial chip so you can 'overdrive' it with the signals from the Teensy. You need to perform a cross-over function. RXD on the Nano goes to TXD on the Teensy and vice-versa.

Yes, the Nano is normally powered by the USB connection and needs 5V from somewhere to operate. If your RS-HFIQ is a Rev D board, everything you need is on the A6/A7 terminal block near the Nano. Jumper pins 2 and 4 to connect the grounds together. Then you'll need a regulator or DC-DC converter to step down the 13.8V on pin 6 and create 5V to put on pin 1. You can also use this 5V to power the Teensy.

You can probably use a 3 terminal regulator like the 7805 but it may need a heatsink. There are also tiny, inexpensive DC-DC converter modules:

https://www.mpja.com/LM2596-Step-Down-Adjustable-15-37V-DC_DC-Converter/productinfo/30148+PS

This one provides 2A output which is more than enough for the Nano, Teensy, LCD display, audio amp, etc.

I don't mind answering question, if I did, I'm in the wrong business!

73,
Jim WA2EUJ


Top
 Profile  
 
PostPosted: Wed Apr 24, 2019 2:29 pm 
Offline

Joined: Sun Apr 21, 2019 8:59 am
Posts: 5
Thanks for the additional information. It was very helpful. I decided to modify the RX/TX pins on the nano so that they are pass through headers with a socket on the top as well as pins below. I did not want to try finding and cutting traces on the board and I figured if I buggered up the nano I could just order another.

For now I am powering the nano from the Teensy. I jumpered power from the Teensy VIN to pin 1 and GRD to pins 2 and 4. I have several 7805 regulators in the junk bin so I will build a small board to plug into the header pins for power. For now the USB on the teensy seems to be supplying enough power.

I was able to get the serial link working and tested.

I have audio and I was able to listen to a few QSOs with the Teensy and my code!!!!!

My waterfall display does not seem to be working right, but that is just working though the code. So the main wiring up is done and I can start working on adding buttons, perfecting filters, getting transmit to work and making a nice display.

Thanks so much for your help.

Ken KE3C


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group