Forums :: Resources :: Features :: Photo Gallery :: Vintage Radio Shows :: Archives
Support This Site: Contributors :: Advertise


It is currently Sep Sun 22, 2019 11:45 pm


All times are UTC [ DST ]





Post New Topic Post Reply  [ 208 posts ]  Go to page 1, 2, 3, 4, 5 ... 11  Next
Author Message
 Post subject: Microcontroller Based Signal Generator
PostPosted: Jan Mon 30, 2017 2:19 pm 
Member
User avatar

Joined: Feb Fri 25, 2011 8:00 pm
Posts: 955
Location: Dublin, Ohio
I have started a project and wanted to see if any other may be interested in this for collaboration. I am a EE but did software most of my career so it seemed natural to try to see what I could do with an Arduino micro controller and many of the little boards that can be bought for that environment.
My goal here is to build a very accurate signal generator that will cover 1 Hz all the way up to as high as I can go, preferably 108MHz for FM testing.
Thus both an audio and a RF generator. Accuracy should be crystal controlled so no counter is needed to adjust the frequency; just dial it in.
There should also be a sweep option for both the 455KHz and 10.7 Mhz (or really anything inside the range of the selectable frequencies).
And an AM modulator option using the classic 400Hz tone for alignment (or external signal as well perhaps).

So far I have prototyped much of this. I am using an Arduino Uno board plus a small generator board based on the Analog Devices AD9850 chip.
I can dial in any frequency from 1HZ to 30MHz and get sine and square wave outputs. I have also written a software loop that will sweep the frequency about a given center frequency. At the same time, a sweep sawtooth is generated on an analog pin of the Arduino that is used for the X-axis sweep on an oscilloscope. I have not yet worked out an approach for AM modulation. FM would be nice too. And I will need an attenuator for producing a low signal for alignments. I am looking at several display options for settings including a small LCD touch screen.

Here are some links to specific parts. They are really cheap so this whole build will come in somewhere between $50 and $100 I expect given a cabinet and other needed parts. I buy stuff on Amazon since I am a Prime member and get free shipping. But many parts are on eBay or can be bought very cheap from China.

I am thus posting this to see if others have had this idea or wish to collaborate on the project. Some may have computer skills, or RF skills that will help. In the end, it would be nice to share this with others on the forum as a completed design that anyone could replicate.

Lou Haskell

--------------------------------
Arduino: https://www.amazon.com/OSOYOO-ATMEGA328P-Module-Micro-controller-Arduino/dp/B00UACD13Q/ref=sr_1_4?ie=UTF8&qid=1485781585&sr=8-4&keywords=arduino+mini

Generator board: https://www.amazon.com/NooElec-AD9850-Function-Generator-Digital/dp/B0085N592S

Generator chip details: http://www.analog.com/media/en/technical-documentation/data-sheets/AD9850.pdf

Possibly touch screen display: https://smile.amazon.com/Elegoo-Inches-Screen-Technical-Arduino/dp/B01EUVJYME/ref=sr_1_13?ie=UTF8&qid=1485726961&sr=8-13&keywords=TFT+touch+display

Another experimenter's approach:http://www.instructables.com/id/Arduino-30MHZ-DDS-Signal-Generator-In-12/

_________________
Website - http://www.louhaskell.com/


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Jan Mon 30, 2017 3:15 pm 
Member
User avatar

Joined: Dec Sun 21, 2014 6:37 am
Posts: 1966
Location: Portland, TN, USA
While my passion is the boat anchor test equipment (still looking for an HP-606B) and radio end of things, I look forward to following your project. It looks like you've gotten a good start on it. I hope you are able to find the collaboration here that you're looking for.

Having an accurate signal source comes in handy when calibrating the older stuff. (I know, I know, why go to all that trouble. Logic does not always govern one's hobby practices.)

_________________
73, de Chuck K4CCW

“A bad book is the worst thief.”


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Jan Mon 30, 2017 5:21 pm 
Member
User avatar

Joined: Mar Sun 11, 2007 6:55 am
Posts: 10937
Location: Mission Viejo, southern California
Nice idea! Markers may also be useful.

_________________
many of my radios http://s269.photobucket.com/user/FSteph ... t=3&page=1


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Jan Mon 30, 2017 5:37 pm 
Member
User avatar

Joined: Feb Fri 25, 2011 8:00 pm
Posts: 955
Location: Dublin, Ohio
Yes, indeed, I forgot to mention that I hope to figure out a way to do markers.
I saw 2 approaches that are typically used if I recall correctly.
One is to boost the signal slightly at the marker frequency to create a blip. The other is to pause the scan for a small delay which should produce a brighter spot on the scope.. Not sure if that works but it is easy to check out.

_________________
Website - http://www.louhaskell.com/


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Jan Mon 30, 2017 5:47 pm 
Member
User avatar

Joined: Mar Sun 11, 2007 6:55 am
Posts: 10937
Location: Mission Viejo, southern California
Even better, include a scope display for an all in one alignment tool.

_________________
many of my radios http://s269.photobucket.com/user/FSteph ... t=3&page=1


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Jan Mon 30, 2017 5:56 pm 
Member
User avatar

Joined: Feb Fri 25, 2011 8:00 pm
Posts: 955
Location: Dublin, Ohio
I did think about a scope display built in but wondered if I could get a decent bandwidth.
I expect it may be fine for 455KHz IF stuff which maybe what most folks would want.
I have seen several kits for a digital scope using a micro controller approach.
So I think it would be worth looking into.

Thanks,
Lou

_________________
Website - http://www.louhaskell.com/


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Jan Mon 30, 2017 10:32 pm 
Member

Joined: Jun Tue 02, 2009 3:38 am
Posts: 1271
Location: Albuquerque, NM
Since the AD9850 doesn't have any sort of built-in sweep functions or anything you'll need to sweep by shifting in your frequencies the entire time the sweep function is being done as you already know with your test setup.

What this means with an Arduino is that you are not going to be updating a full color SPI LCD during the sweep if you want it to be smooth and not just stepped frequencies. If you had a secondary MCU it would be possible but SPI LCDs are unfortunately pretty slow to update(you'll be lucky to get better than 10FPS running the SPI bus full tilt into a 320x240 color display).

A great secondary MCU could be the MSP430G series. There are a few of those chips that are compatible with the Arduino IDE and sell for a dollar or less each. Have the Arduino be your interface MCU and the cheaper(and easier to implement in your own project) MSP430 chip can just babysit the AD9850 and do your sweeps. All you have to do then is decide what functions you want and how to tell the other chip to start doing it.

Adding a high-speed input as a scope could be done with the MCU that is doing the sweep since a poll of the external high-speed A/D should be fairly quick but it will affect how many 'steps' you get in your sweep.

Of course, a faster real-time MCU running 80MHz plus should be able to do all of this by itself with the added benefit of being able to drive a parallel-input display which takes way less time to update but will need programmed in C.

_________________
-Kyle


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Jan Mon 30, 2017 10:53 pm 
Member
User avatar

Joined: Feb Fri 25, 2011 8:00 pm
Posts: 955
Location: Dublin, Ohio
Thanks for your ideas, Kyle. I agree a second CPU for sweeping will take the burden off of the main CPU and I will keep that in mind as I see if everything can be handled by one processor. I also have played with the ESP8266 family of processors which run at 80MHz and also have built in WiFi. I did not see the need for WiFi capability but I keep an eye to that. The programming can be done with the Arduino development tools so that is a plus keeping everything compatible. If the cost can be controlled, a set of cooperating CPUs is entirely within reason.
As long as the cost does not get carried away.

_________________
Website - http://www.louhaskell.com/


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Jan Tue 31, 2017 12:22 am 
Member

Joined: Jan Thu 01, 1970 1:00 am
Posts: 2301
Location: Saskatoon
louhaskell wrote:
Yes, indeed, I forgot to mention that I hope to figure out a way to do markers.
I saw 2 approaches that are typically used if I recall correctly.
One is to boost the signal slightly at the marker frequency to create a blip. The other is to pause the scan for a small delay which should produce a brighter spot on the scope.. Not sure if that works but it is easy to check out.


If you do implement markers, then it would be a good idea to have an analog output proportional to frequency so that you can drive a scope horizontal input in X-Y mode. Then either the pause method or amplitude method for markers would work well, and no need to include a built-in scope display, which I think would be a lot of work. This would also resolve the problem of having to keep the sweep linear with respect to time. As long as the analog sweep output voltage matches the current DDS frequency, the resulting scope trace will be linear.


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Jan Tue 31, 2017 12:55 am 
Member

Joined: Jun Tue 02, 2009 3:38 am
Posts: 1271
Location: Albuquerque, NM
Bob, correct me if I'm wrong but couldn't you get away with just a square wave pulse for the marker output? Then just apply the pulse to the trigger and it'll sync. Works on my WO-58 scope anyways. An RC network should allow a smooth slope from the pwm out on the Arduino.

I should have said that you'd need two processors for a dynamic display. You could load the LCD with all of the sweep data, say it began, and then ignore the display until the sweep is done and save a processor. If it's a repeating sweep you could update the display between sweeps.

_________________
-Kyle


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Jan Tue 31, 2017 1:31 am 
Member
User avatar

Joined: Feb Fri 25, 2011 8:00 pm
Posts: 955
Location: Dublin, Ohio
I had not planned on using the pwm output but just an analog pin. However, I am rusty on the analog capabilities so I looked into it. Rats... no analog output, just pwm. I can use a low pass filter to get analog but not sure how well that will work. Maybe a cheap DAC can be found.
I am including a photo of the prototype so you all know this is starting to take shape. Now using an UNO CPU board, the signal generator on the left.
For now, using a small 1306 type LED display that runs on SPI. I have a rotary encoder there to input the frequency.
Today I did some work resurrecting my 2.4" touch screen display and getting that updated with the latest IDE from Arduino.
I was hoping that I could just use a touch display for all of the GUI functions so everything is easy to change just in software.

Image

_________________
Website - http://www.louhaskell.com/


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Jan Tue 31, 2017 1:51 am 
Member

Joined: Dec Tue 29, 2015 8:23 am
Posts: 239
Location: Australia
This is one of those things I've been turning over in my mind for a few years - but I've never actually done due to running into feature creep and real-world performance issues.

Short version: Even as a largely digital guy, I keep coming back to the conclusion that an analogue VCO/VFO with switched ranges is a better solution ;). Especially if you want it to be useful for more than basic vintage AM/SW radio alignment - you'd be hard-pressed to come up with a DDS-based generator that will even match an old Leader or Heathkit signal generator on anything but sine wave quality.

A few thoughts:
  • As you say, the AD9850 will only get you so far - ~30MHz for a decent signal, maybe ~60MHz if you're using a 125MHz clock & can stand the distortion & spurious signals (which, let's be honest, will still be better than most cheap rf signal generators past or present). You start to look at better/more suitable DDS chips, or even FPGAs.
  • There are fundamental design issues with all those boards I've seen - 3v oscillators powered from 5v (or, conversely, the AD9850 run out of spec at 3v with a 125MHz clock); the output filter being incorrect (& hampering access to one of the complementary outputs of the DDS); the lack of access to the Rset pin; etc.
  • AM: Depends how you want to do it. Using the Rset current method (e.g. AD app note AN-423) requires access to both the complementary outputs of the DDS and the Rset pin (see above) - so you either need to mod the module, or come up with an external modulator.
  • FM: I don't actually see it as too much of a problem - others have shown it's possible for a standard 16MHz Arduino to read the ADC, calculate the tuning word, and write to the AD9850 using SPI fast enough to broadcast audio with a 16kHz bandwidth. That suggests it'd be entirely possible with good coding for a single uC to generate FM test tones while also handling UI, especially if you use the parallel connection to the DDS module. And if it can't, as others have suggested it's easy enough to dedicate separate uCs to each.
  • Ideally, you'd want a reasonably accurate & controllable signal level, and known load-driving characteristics (e.g. 50 ohm output). Congratulations - you 've just added AGC, an accurate attenuator, and a wideband power amplifier into the list ;)

That's not to say it's not worth doing - again, recently, I started to think about such a project for a series of "DIY test gear for cheap hobbyists" articles - but it might change your approach.

My idea was to forget about most of the bells & whistles, and start off with something that was basically the DDS equivalent of a vintage RF signal generator, albeit one that only goes up to ~60MHz. AM &/or FM modulation in the uC, unbuffered/undriven complementary DDS outs, and maybe a 0-5v sweep output. Just enough to do basic AM & FM alignments.

Then start working on extra modules to improve it. An AGC to level the output. An attenuator to accurately adjust levels. A line driver to output +10 into 50 ohms.

Good luck! I'll be watching with interest...

(edit: and I'll just drop this link to an ATmega spectrum analyser project here, because it's relevant & I can never find the link when I want it ;))


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Jan Tue 31, 2017 5:09 am 
Member

Joined: Jan Thu 01, 1970 1:00 am
Posts: 2301
Location: Saskatoon
dkjones96 wrote:
Bob, correct me if I'm wrong but couldn't you get away with just a square wave pulse for the marker output? Then just apply the pulse to the trigger and it'll sync. Works on my WO-58 scope anyways. An RC network should allow a smooth slope from the pwm out on the Arduino.

Yes this would work as long as the sweep is linear with time. However, a lot of old test equipment got around this requirement by feeding the same sweep voltage signal that was used for frequency control out to a separate output for X-Y scope display. Or alternatively, as in the case of the WR-50B signal generator, they just used the 60Hz line frequency sinewave, and then you would set the scope horizontal input to to "line." By using the same signal, the nonlinearity cancels out, and you get a perfectly linear trace. The trace brightness will increase a bit at the end points where the trace slows down, but it's not that noticeable.

That's why I mentioned this option for Arduino control. It would eliminate the need for precise linear sweep.

louhaskell wrote:
I had not planned on using the pwm output but just an analog pin. However, I am rusty on the analog capabilities so I looked into it. Rats... no analog output, just pwm. I can use a low pass filter to get analog but not sure how well that will work. Maybe a cheap DAC can be found.


That's fairly standard with most microcontroller chips, I think. I'm not all that familiar with Arduinos. My experience has been with PIC's, and I'm not aware of any of them that have anything other than a PWM output.


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Jan Tue 31, 2017 2:22 pm 
Member
User avatar

Joined: Feb Fri 25, 2011 8:00 pm
Posts: 955
Location: Dublin, Ohio
Thanks much for all of the comments so far... a big help.

In thinking about the sweep, I am now at a point where some things are settling in.
If the pwm is used and then filtered with a low pass filter, the resulting sawtooth is not going to look so good. I believe the time constants of the RC network need to be adjusted to both smooth out the individual steps and also allow for the overall sawtooth to still "look like a sawtooth".
I think a better solution for generating that sawtooth is to just get a little DAC board like this one:
https://smile.amazon.com/Adafruit-MCP4725-Breakout-Board-Interface/dp/B00SK8MBXI/ref=sr_1_1?ie=UTF8&qid=1485866422&sr=8-1&keywords=arduino+DAC
While this one costs $10, I have seen others with this chip as low as $3. I have also seen one with 4 channels which may come in handy for other features. And it is I2C controlled so easy to slap onto that bus to control.
As one of you (or more) also suggested, perhaps the easiest solution is to use the external trigger on the scope and let the scope do the sweep. Just output a pulse at the start of each sweep and adjust the scope timing to make the sweep fill the screen. I have a Tektronix 2213A and it has this feature. I am sure most other scopes (more modern) also do. I will plan to do this approach first. I think I will write a little program to simulate a sweep alignment to make sure I have my ideas correct.

_________________
Website - http://www.louhaskell.com/


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Jan Tue 31, 2017 3:15 pm 
Member
User avatar

Joined: Jul Mon 26, 2010 8:30 pm
Posts: 26435
Location: Annapolis, MD
I have a really dumb question.
Instead of using sweep as we commonly know it, why not just a relatively small number of steps, one of which would be at the desired center frequency? In this situation it seems that markers would not be needed.
For AM alignment, I think you only need 3 frequencies. For FM, at least 5, covering the typical "straight-line" portion of the S-curve.

_________________
-Mark
"Measure voltage, but THINK current." --anon.


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Feb Wed 01, 2017 12:48 am 
Member

Joined: Feb Sun 10, 2013 3:31 am
Posts: 51
Hi Lou,
You might glean some ideas from this site:

http://hfsignals.blogspot.com/p/sweeperino.html

Farhan is quite well known in the amateur radio homebrew community.

Ted, KX4OM


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Feb Wed 01, 2017 1:11 am 
Member

Joined: Jan Thu 01, 1970 1:00 am
Posts: 2301
Location: Saskatoon
A really simple D/A converter would be nothing more than an 8 bit serial in, parallel out shift register (74HC164) with an R2R resistor network, and it would require only two output lines on the microprocessor.


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Feb Thu 02, 2017 4:52 pm 
Member
User avatar

Joined: Feb Fri 25, 2011 8:00 pm
Posts: 955
Location: Dublin, Ohio
More good comments... keep 'em coming. ;-)

I ordered a couple of DACs from Amazon and should be here tomorrow. Only $6 for those and, of course, cheaper ones can be found.
They use the MCP4725 chip which is gives 12 bits which is overkill for this application but it is cheap and uses the I2C bus which is very handy.
I thought again about just using the scope trigger and that would eliminate the marker generation option of just pausing the trace to make a bright spot for the marker. I was also thinking that if the sweep is real linear (which it will be with the DAC) and the sweep is adjusted to cover the face of the scope, would the center point then indeed be the accurate center freq, e.g. 455KHz? Granted, it may not be accurate enough with a broad sweep but I though of a variable sweep percentage that can be gradually reduced to give a good display of the center. For example, start with a sweep percentage of 10% giving about 45KHz at 455KHz for the sweep. Adjust it close the center. Then narrow the sweep to 1% or about 5Khz and fine tune it.I will have to try that as a process. Full disclosure. I have not yet done sweep alignment on a radio but I did recently get a RCA WR-50B to play with and practice the process. I hope to use the line sync on my scope. Will do that in the next few days.

While waiting for the DAC, I worked more on the user interface (GUI). I have a rotary encoder that does the setting of values. If the shaft is pushed in, a switch pin is operated so that is used to put the rotary in 2 modes. With the shaft pushed in, the position of the digit to be modified is set and that digit is displayed in inverse colors. Then releasing the shaft allows the digit to be set from 0 to 9. In this way, I set the frequency, sweep percentage, AM level, and hopefully output level. See photo below.

I am still looking at designs for an AM modulator for this thing and also a digitally controlled level adjuster (attenuator). The later is a nicety to keep it all digital. If all else fails, I will use a pot and a high/low switch for controlling the output, the same as my current frequency generator.
Will also need a simple oscillator for the 400Hz tone to use for the modulation signal. I am sure those are all over the internet. For the AM, I have this application note http://www.analog.com/media/en/technical-documentation/application-notes/AN-423.pdf, but it is only good above 50KHz (likely not a big problem) since it uses an RF transformer and it requires access to the AD9850 chip which I do not think is on the board pinout.

I have the GUI, generator control, and sweep all coded. With a sweep rate of 100Hz, there is plenty of CPU time to do a sweep and check and redisplay the GUI between sweeps, even with a 16MHz Arduino. The rotary switch works on interrupts and there is little work done in the interrupt routine.

The work continues....

Image

_________________
Website - http://www.louhaskell.com/


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Feb Thu 02, 2017 5:27 pm 
Member
User avatar

Joined: Jan Thu 01, 1970 1:00 am
Posts: 4081
One of the simplest modulators is a optocoupler in the feedback loop of an op amp. As the signal to be modulated is fed into the LED section of the optocoupler, the resistance of the photocell varies according to the changing brightness of the LED. This varies the feedback in the op amp, which varies the output voltage.


Top
 Profile  
 
 Post subject: Re: Microcontroller Based Signal Generator
PostPosted: Feb Thu 02, 2017 5:40 pm 
Member
User avatar

Joined: Jul Mon 26, 2010 8:30 pm
Posts: 26435
Location: Annapolis, MD
Macrohenry wrote:
One of the simplest modulators is a optocoupler in the feedback loop of an op amp. As the signal to be modulated is fed into the LED section of the optocoupler, the resistance of the photocell varies according to the changing brightness of the LED. This varies the feedback in the op amp, which varies the output voltage.

Wouldn't the signal to be modulated go through the op-amp, and the modulating signal go to the LED?
Can you get op-amps that work at 10 or 100 MHz?

I'm mostly ignorant about current IC offerings, but surely there are cheap ICs specifically designed for AM or FM modulation.

_________________
-Mark
"Measure voltage, but THINK current." --anon.


Top
 Profile  
 
Post New Topic Post Reply  [ 208 posts ]  Go to page 1, 2, 3, 4, 5 ... 11  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests



Search for:
Jump to:  




























Privacy Policy :: Powered by phpBB