The AM Forum
March 28, 2024, 07:53:14 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Calendar Links Staff List Gallery Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Communicating with the Arduino - Homebrew DDS VFO  (Read 7489 times)
0 Members and 1 Guest are viewing this topic.
ka1tdq
Member

Offline Offline

Posts: 1509


Red part turned in for a refund.


« on: September 29, 2018, 06:05:07 AM »

On newsstands now is an article in Everyday Practical Electronics, September 2018 issue about using the Arduino to drive an AD9850 DDS module. The module is available from China for about $15 and can produce a clean sine wave up to around 25MHz. You enter the frequency you want to produce via the Arduino.

I've connected the module and Arduino together per the article, and added a W1FFL crystal driver kit on the end. I replaced the 50 ohm resistor on the input of the kit with a 100K pot so as not to load down the DDS module and allow for a change in amplitude of the output.

I uploaded the sketch (program) to the Arduino, got everything together, and then realized that I don't know how to talk to the Arduino. After Googling, I know that I need to connect something to pins 11, 12, and 13 (SCK, MISO and MOSI).What do I connect to these pins? A terminal emulator like Putty, or what?

Jon


* IMG_1337.jpg (2897.33 KB, 4032x3024 - viewed 445 times.)
Logged

It’s not just values, it’s business.
W1RKW
Contributing
Member
*
Offline Offline

Posts: 4410



« Reply #1 on: September 29, 2018, 06:48:00 AM »

Jon,
Could it be a rotary encoder that goes to those pins?
Logged

Bob
W1RKW
Home of GORT. A buddy of mine named the 813 rig GORT.
His fear was when I turned it on for the first time life on earth would come to a stand still.
ka1tdq
Member

Offline Offline

Posts: 1509


Red part turned in for a refund.


« Reply #2 on: September 29, 2018, 07:06:52 AM »

I see some rotary encoders are 5-pin for the Arduinos. I’m not sure. I only took pictures of the important parts of the article. I didn’t want to buy the magazine at $12. I’ll have to go to Barnes & Noble and look at it again.

Jon
Logged

It’s not just values, it’s business.
W1RKW
Contributing
Member
*
Offline Offline

Posts: 4410



« Reply #3 on: September 29, 2018, 10:30:54 AM »

Jon,
email me the schematic and sketch if you can.
Bob
Logged

Bob
W1RKW
Home of GORT. A buddy of mine named the 813 rig GORT.
His fear was when I turned it on for the first time life on earth would come to a stand still.
ka1tdq
Member

Offline Offline

Posts: 1509


Red part turned in for a refund.


« Reply #4 on: September 29, 2018, 10:38:52 AM »

Thanks, I appreciate it! I’ll get it to you later today. I’ve got a few events with the kiddos this morning.

Jon
Logged

It’s not just values, it’s business.
w8khk
Member

Online Online

Posts: 1200


This ham got his ticket the old fashioned way.


WWW
« Reply #5 on: September 29, 2018, 12:30:33 PM »

Jon,

There are dozens of implementations of DDS VFOs using Arduino and the AD9850 module like yours.  Be careful, as some AD9850 modules have a crystal oscillator that works fine on 5.0 volts, but others should not have more than 3.3 volts.  Look for details on top of the crystal.  If yours needs 3.3 volts you may drop from 5.0 volts using two diodes in series.

The easiest and most convenient way to control the frequency is with a rotary encoder, less than $5.00 on ebay.  Peruse your sketch and see if you can find "#include rotary"  This is a library module that deals with rotary encoders.  When it is referenced in the sketch, typically you will see which pins are used to connect the encoder assembly.  The encoder may be a mechanical or optical switch assembly, with or without detents.  The two switches make and break in an overlapping manner as the knob is rotated.  The software looks at the make-break sequence to determine if the frequency should be raised or lowered.  Some encoders come with a push switch, and this is commonly used by software to set the tuning rate so that you may quickly move close to your desired frequency then reduce the rate to fine tune.  I prefer the optical without detent and a heavy flywheel knob, makes tuning a breeze! To get started, an inexpensive mechanical version works fine.

For frequency readout, an alphanumeric LCD display, either 2 lines by 16 characters or 4 lines by 20 characters works well.   These devices run anywhere from $6 to $15.  Get the version with the I2C interface on the back, or buy it separately and solder it on the back.  (You will probably need to adjust the contrast pot on the back of the interface module to see any characters.)  With I2C you only need ground and 5 volts, plus two more wires, SDA (Serial Data) connected to Arduino A4, and SCK (Serial Clock) connected to Arduino A5.  You will need to set the correct I2C address in software to match the device.  A simple "I2C Scanner" may be loaded into Arduino to verify proper connections and identify the correct address.  Google I2C Scanner and download one from github or arduino playground.

For a good understanding, look at the implementation by K2ZIA at this link, which includes schematic and software.  You will then see how to connect the display and the rotary encoder:

http://www.farrukhzia.com/k2zia/

There are many different ways to configure the I/O devices on the Arduino.  The Nano in the K2ZIA and your UNO are almost identical functionally.  Look first at which pins are connected to the DDS module.  Typically you need four signals, Clock, Load (FQ_UD) Serial Data, and Reset.  Look at the source code for your sketch to see which pins are connected to these signals.  Then you can avoid conflicts when adding the rotary encoder.

The encoder is often configured using interrupt-capable pins, but other people may poll the encoder switches and use general purpose pins, either digital or analog.

You could easily use the K2ZIA sketch and wire your devices as in his schematic and you will be off and running.  Or, compare his sketch and I/O pin assignments to the sketch you loaded and you will have a much better understanding of how to control and display frequency.

Later on, you might want to add a GPS module and lock in calibration with the satellites.  Google Gene Marcus, W3PM, he has a good implementation using the same DDS and Arduino you are using.

By the way, it would be much easier to interconnect everything if you purchase some dupont wires!  You do not need the ZIA circuit board, It can all be done in a chassis like you have, or on a proto board.  I did mine with a Nano.  If you really want to get proficient with Arduino, check out "Random Nerd Tutorials" by Rui Santos, all free on the web.

Hope this helps....

73, Rick

PS  If you plan to become addicted to microcontroller projects, have a look at banggood.com.  It takes some patience to wait for the mail to come from China, but the savings are enormous.  If you purchase three or more of an item, you get even larger discounts.  I have ordered from them countless times, they have never erred on any shipment!
Logged

Rick / W8KHK  ex WB2HKX, WB4GNR
"Both politicians and diapers need to be changed often and for the same reason.”   Ronald Reagan

My smart?phone voicetext screws up homophones, but they are crystal clear from my 75 meter plate-modulated AM transmitter
w8khk
Member

Online Online

Posts: 1200


This ham got his ticket the old fashioned way.


WWW
« Reply #6 on: September 29, 2018, 01:35:42 PM »

A bit more information for your project....

The K2ZIA DDS VFO QST Article in the March 2016 Issue is a modification of the original VFO design in "Arduino™ Projects for Amateur Radio" by Dr. Jack Purdum W8TEE and Dennis Kidder W6DQ, an ARRL publication.

I put together a DDS VFO and also used the WA1FFL amplifier (same as your kit) to drive my Johnson Viking II.  I also built another one using the K2ZIA board and packaged it as a complete stand-alone 40M QRP rig.  I will attach some pictures. I used the 4x20 I2C LCD display in this implementation.  Inside, you will see how easy it is to interconnect modules with dupont wires.  They come in M-M, M-F, and F-F versions, and various lengths.  They are actually ribbon cables in the standard resistor color code order, so wires do not need to be numbered.  They peel apart if desired, just like zip cord.  Very handy indeed.

I think if you study the K2ZIA schematic, as well as his sketch, you will have a much better understanding.  Be careful following the wires from the rotary encoder through the jumper array on his board to the Arduino....  You will see it is easy to modify the code and add any feature you desire.  Have FUN!



* DDSVFO1.JPG (45.97 KB, 915x453 - viewed 305 times.)

* DDSVFO2.JPG (105.29 KB, 786x489 - viewed 355 times.)

* DDSVFO3.JPG (118.57 KB, 710x694 - viewed 350 times.)
Logged

Rick / W8KHK  ex WB2HKX, WB4GNR
"Both politicians and diapers need to be changed often and for the same reason.”   Ronald Reagan

My smart?phone voicetext screws up homophones, but they are crystal clear from my 75 meter plate-modulated AM transmitter
ka1tdq
Member

Offline Offline

Posts: 1509


Red part turned in for a refund.


« Reply #7 on: September 29, 2018, 09:14:09 PM »

Thanks for all the info! I looked at the article again and communication with the Arduino is via the port monitoring feature of the programming software. I had it set for 9600 baud (the absolute universal serial communication speed), but lo-and-behold the sketch called for 115200 baud. Apparently the programmer is in some sort of hurry. Anyway, I can talk to it now.

Only problem is, it doesn’t work. I’ve triple checked all my wiring. I’m using 5 volts for the DDS module. I can’t tell from the crystal what voltage it’s looking for. When I turn it on, output goes up 1 volt DC and stays there (on the scope).

Jon
Logged

It’s not just values, it’s business.
k3msb
Member

Offline Offline

Posts: 213


« Reply #8 on: October 05, 2018, 08:25:15 AM »

After Googling, I know that I need to connect something to pins 11, 12, and 13 (SCK, MISO and MOSI).What do I connect to these pins? A terminal emulator like Putty, or what?
Jon

Jon,

Those are standard signals for the SPI bus; a common serial bus.  I suggest you look at

https://www.arduino.cc/en/Reference/SPI

I've written SPI software numerous times at work; SPI is robust and easy to use. 

Logged

73 Mark K3MSB
York, PA
ka1tdq
Member

Offline Offline

Posts: 1509


Red part turned in for a refund.


« Reply #9 on: October 06, 2018, 09:12:57 AM »

Yeah, after playing with the Arduino I realized that it's not as intimidating as I originally thought. Cookbooking is easiest and pretty straight forward. Eventually I'll get bored with stuff and maybe learn coding for either it or the Raspberry Pi. Possibilities are almost limitless for ham radio applications, even in AM. You could build transmit sequencers, PWM's, wattmeters...

Right now, I almost pride myself on my shack being the simplest of home-brew technology. I use analog modulated class E rigs and even my sequencer is mechanical. I guess I'm one step above using a multivibrator and frequency multiplier to drive the gates (that's a joke).

Jon
Logged

It’s not just values, it’s business.
Pages: [1]   Go Up
  Print  
 
Jump to:  

AMfone - Dedicated to Amplitude Modulation on the Amateur Radio Bands
 AMfone © 2001-2015
Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.051 seconds with 19 queries.