Silicon ChipEl Cheapo modules Part 9: AD9850 DDS module - September 2017 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Editorial Viewpoint: A rapid shift to electric vehicles could be disastrous
  4. Feature: Commemorating Cassini's demise and... by Ross Tester
  5. Feature: Commemorating Sputnik’s birth by Ross Tester
  6. Project: Fully adjustable, 3-way active loudspeaker crossover Pt.1 by John Clarke
  7. Feature: This month: Melbourne’s turn for Electronex Expo
  8. Feature: The unclear future of radio broadcasting in Australia by Alan Hughes
  9. Feature: Digital Radio Mondiale (DRM): what’s it all about? by Jim Rowe
  10. Project: Dead simple radio IF alignment with DDS by Nicholas Vinen
  11. Serviceman's Log: When a GPS loses its way by Dave Thompson
  12. Feature: LTspice Tutorial Part 3: Modelling an NTC Thermistor by Nicholas Vinen
  13. Project: Arduino Data Logger Part 2 by Nicholas Vinen
  14. Project: Arduino “ThingSpeak.com” ESP8266 data logger by Bera Somnath
  15. Feature: El Cheapo modules Part 9: AD9850 DDS module by Jim Rowe
  16. Vintage Radio: The 3-transistor Philips MT4 Swingalong by Ian Batty
  17. PartShop
  18. Product Showcase
  19. Market Centre
  20. Advertising Index
  21. Notes & Errata: Arduino Stereo Audio Playback and Recording Sheld / 12V DC Cyclic Pump Timer / New Marine Ultrasonic Anti-fouling Unit / Induction Motor Speed Controller / Building the RapidBrake

This is only a preview of the September 2017 issue of Silicon Chip.

You can view 59 of the 112 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Fully adjustable, 3-way active loudspeaker crossover Pt.1":
  • 3-Way Adjustable Stereo Active Crossover PCB [01108171 RevD] (AUD $12.50)
  • 3-Way Adjustable Stereo Active Crossover prototype PCB [01108171 RevC] (AUD $5.00)
  • 3-Way Adjustable Stereo Active Crossover PCB [01108171 RevE] (AUD $20.00)
  • Set of four 8-gang potentiometers with knobs for the 2/3-Way Active Crossover (Component, AUD $55.00)
  • SMD parts for the 3-way Adjustable Active Stereo Crossover (Component, AUD $30.00)
  • 3-Way Adjustable Stereo Active Crossover simulation file (Software, Free)
  • 3-Way Adjustable Stereo Active Crossover PCB pattern (PDF download) [01108171] (Free)
  • 3-Way Adjustable Stereo Active Crossover front & rear panel artwork (PDF download) (Free)
Articles in this series:
  • Fully adjustable, 3-way active loudspeaker crossover Pt.1 (September 2017)
  • Fully adjustable, 3-way active loudspeaker crossover Pt.1 (September 2017)
  • 3-way Active Crossover for speakers, Part 2 (October 2017)
  • 3-way Active Crossover for speakers, Part 2 (October 2017)
Items relevant to "Dead simple radio IF alignment with DDS":
  • Micromite LCD BackPack PCB [2.8-inch version) [07102122] (AUD $5.00)
  • PIC32MX170F256B-50I/SP programmed for the Micromite-based radio IF alignment with DDS [DDSIFAlign.HEX] (Programmed Microcontroller, AUD $15.00)
  • MCP1700 3.3V LDO (TO-92) (Component, AUD $2.00)
  • AD9833 DDS module with programmable attenuator (Component, AUD $25.00)
  • CP2102-based USB/TTL serial converter with 5-pin header and 30cm jumper cable (Component, AUD $5.00)
  • Micromite LCD BackPack V2 complete kit (Component, AUD $70.00)
  • Matte/Gloss Black UB3 Lid for 2.8-inch Micromite LCD BackPack (PCB, AUD $5.00)
  • Clear UB3 Lid for 2.8-inch Micromite LCD BackPack (PCB, AUD $5.00)
  • Gloss Black UB3 Lid for 2.8-inch Micromite LCD BackPack (PCB, AUD $4.00)
  • Firmware (HEX) file and BASIC source code for the Micromite-based Radio IF Alignment [DDSIFAlign.HEX] (Software, Free)
  • Micromite LCD BackPack PCB patterns (PDF download) [07102121/2] (Free)
  • Micromite LCD BackPack/Ultrasonic sensor lid cutting diagrams (download) (Panel Artwork, Free)
Items relevant to "LTspice Tutorial Part 3: Modelling an NTC Thermistor":
  • Software for the LTspice Tutorial, Part 3 (Free)
Articles in this series:
  • LTspice – simulating and circuit testing, Part 1 (June 2017)
  • LTspice – simulating and circuit testing, Part 1 (June 2017)
  • LTspice Part 2: Simulating and Testing Circuits (August 2017)
  • LTspice Part 2: Simulating and Testing Circuits (August 2017)
  • LTspice Tutorial Part 3: Modelling an NTC Thermistor (September 2017)
  • LTspice Tutorial Part 3: Modelling an NTC Thermistor (September 2017)
  • LTspice Simulation: Analysing/Optimising Audio Circuits (May 2018)
  • LTspice Simulation: Analysing/Optimising Audio Circuits (May 2018)
Items relevant to "Arduino Data Logger Part 2":
  • Arduino Data Logger shield PCB with stackable headers [21107171] (AUD $5.00)
  • Arduino Data Logger shield PCB [21107171] (AUD $2.50)
  • VK2828U7G5LF TTL GPS/GLONASS/GALILEO module with antenna and cable (Component, AUD $25.00)
  • GY-68 Barometric Pressure/Altitude/Temperature I²C Sensor breakout board (Component, AUD $2.50)
  • Elecrow 1A/500mA Li-ion/LiPo charger board with USB power pass-through (Component, AUD $25.00)
  • Elecrow 1A Li-ion/LiPo charger board with USB pass-through (Component, AUD $35.00)
  • DS3231-based Real Time Clock & Calendar module with mounting hardware (Component, AUD $6.00)
  • Firmware (Arduino sketch) file for the Arduino Data Logger (Software, Free)
  • Arduino Data Logger shield PCB pattern (PDF download) [21107171] (Free)
Articles in this series:
  • An Arduino Data Logger with GPS (August 2017)
  • An Arduino Data Logger with GPS (August 2017)
  • Arduino Data Logger Part 2 (September 2017)
  • Arduino Data Logger Part 2 (September 2017)
Items relevant to "Arduino “ThingSpeak.com” ESP8266 data logger":
  • DHT22/AM2302 Compatible Temperature and Humidity sensor module (Component, AUD $9.00)
  • Firmware (Arduino sketch) and libraries for the Arduino ThingSpeak.com Data Logger (Software, Free)
Items relevant to "El Cheapo modules Part 9: AD9850 DDS module":
  • Software for El Cheapo Modules: AD9850 DDS (Free)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)

Purchase a printed copy of this issue for $10.00.

Using Cheap Asian Electronic Modules Part 9: by Jim Rowe The AD9850 DDS Module In the April issue, we covered the AD9833 Direct Digital Synthesiser (DDS) chip. This time, we’re looking at modules based on its big brother, the AD9850. Typically combined with a 125MHz crystal oscillator, it can be programmed to produce sinewaves to beyond 40MHz, possibly accompanied by a square or pulse waveform. It is again controlled via an SPI serial interface. W e won’t explain how a DDS chip works again as we covered that quite thoroughly in the article mentioned above, in the April 2017 issue. There are a couple of modules using the AD9850 chip in conjunction with a 125MHz oscillator, with the one shown in the photos probably the most common. The other module is very similar in most respects, apart from having a different PCB layout. In the module shown, the fact that the AD9850 is coupled with a 125MHz crystal oscillator means that it can be programmed to produce any output frequency from 0.0291Hz to over 62MHz in 0.0291Hz increments (more about the practical frequency limits later). This means it has a frequency range about five times that of the AD9833 with a resolution about 3.4 times finer (0.0291Hz compared with 0.1Hz). Although the AD9850 doesn’t provide the same choice of output waveforms as the AD9833, it does offer the basic sine waveform plus a derived rectangular waveform with bipolar outputs and an adjustable duty cycle. This allows it to produce anything from narrow positive pulses through to a square wave to narrow negative pulses. The AD9850 chip itself is a little larger than the very tiny AD9833, but is still quite small. It comes in a 28-pin SSOP package, operates from either 3.3 or 5V and is described as low power – dissipating just 380mW when running with a 125MHz master clock from 5V, or only 155mW when operating from a 3.3V supply with a 110MHz master clock. 94  Silicon Chip The AD9850-based module shown in the photos, which measures only 44.5 x 26mm and includes a 125MHz crystal oscillator, is currently being offered on eBay and AliExpress for prices ranging from A$9.80 to A$22.50, in many cases with postage included. Inside the AD9850 The block diagram of Fig.1 shows what’s inside that compact 28-pin SSOP package. The main sections involved in basic DDS operation are those shown with a pale yellow fill. The high speed comparator at lower right is used for deriving the rectangular/square output waveform, as we’ll see shortly. Down at lower left is the 40-bit input register where data and instructions are loaded into the chip from almost any micro. With the AD9850, this can be done in two ways; in serial fashion via an SPI (Serial Peripheral Interface) The AD9850 module shown at approximately twice actual size. siliconchip.com.au bus like the AD9833, or by parallel loading via an 8-bit data bus. Since the AD9850 needs a 40-bit word rather than two 14-bit words, this means that programming it gets a little more complicated than the AD9833. With serial loading via the SPI bus, all 40 bits must be sent in sequence, while with parallel loading they must be sent as a sequence of five bytes (8bit words). In both cases, they must be sent to the chip in a particular order (LSB first) and with the 32-bit frequency word sent before the 8-bit control/ phase word. Returning to Fig.1, just above the input register is the frequency/phase data register, also of 40 bits. This stores the data used to program the DDS in terms of output frequency and phase modulation (if any). Once the data has been loaded into the input register either serially or as five bytes, it is transferred into the frequency/phase register with a single positive-going pulse to the Frequency Update (FQ_UD) pin. The high speed DDS “heart” of the AD9850 is shown at upper left in Fig.1, with its 125MHz master clock input labelled “Ref Clock Input”. Then to the right of the DDS block is the very fast 10-bit DAC (digital to analog converter), used to provide the AD9850’s main sinewave output. Note that the use of a 10-bit DAC gives the device a sinewave amplitude resolution of 1024 levels. The complete module Now turn your attention to Fig.2, which shows the complete circuit for the 44.5 x 26mm module shown in the photos. It has quite a few components, comprising the AD9850 DDS chip (IC1) and its equally small (6.5 x 4.5mm) 125MHz crystal oscillator, a red power LED, seven SMD resistors, 14 SMD capacitors, three SMD inductors and a small trimpot. 10-way SIL connectors CON1 and CON2 provide all the signal and power connections to the module. Most of the pins of CON1 are used for the 8-bit parallel data input (apart from pin 1 for +5V power and pin 10 for ground), while the pins of CON2 are used for the SPI serial interface and the analog outputs. Note that pin 25 of IC1 is both D7, the most significant bit of the parallel input (via pin 9 of CON1) and also the serial data (SDA) line of the SPI intersiliconchip.com.au face (pin 4 of CON2). As shown on Fig.1, the AD9850’s DAC has bipolar outputs and these emerge via pins 21 and 20, as shown in Fig.2. But only one of these is actually used within the module – the positive output from pin 21. The signal from this output passes through a low-pass filter formed by the three small inductors and their accompanying low-value capacitors, to remove as much of the DAC noise as possible before the output signal passes to pin 10 of CON2. The negative DAC output from pin 20 is simply terminated in a 100W load and fed directly to pin 9 of CON2, without any filtering. So if you want to use this output, it will need external filtering. One more thing to note regarding the AD9850’s DAC is that its full-scale output current is set by the value of the resistor connected between pin 12 (DAC RSET) and ground. With the 3.9kW resistor supplied in the module, the full-scale output current is 10mA, which with the loading of approximately 100W gives a DAC output close to 1V peak-to-peak. This should be suitable for the majority of applications. As well as going to pin 10 of CON2, the filtered positive DAC output is also connected to the positive input of the AD9850’s high speed comparator (pin 16), via a 1kW resistor. The negative input of the comparator (pin 15) is fed with an adjustable DC voltage from the 10kW trimpot, the ends of which This photo of the underside of the AD9850 DDS module shows the pin header connections that can be used with a Micromite or Arduino. are connected to the +5V power rail and ground. The trimpot thus provides a simple way to adjust the duty cycle of the rectangular output waveforms derived from the filtered positive DAC output by the action of the comparator. The rectangular outputs emerge from pins 14 and 13, and are taken directly to pins 7 and 8 of CON2. Fig.1: internal block diagram of the AD9850 IC. This is somewhat simpler than the AD9833 featured previously as it has no facility to generate a triangle wave nor a square wave. However, the internal high-speed comparator at lower right can be used to generate a fixed or variable duty cycle square wave derived from the sinewave output and a DC reference voltage. September 2017  95 From left to right: 10kHz, 100kHz, 1MHz, 10MHz waveform outputs from the AD9850 DDS module. The 25MHz and 40 MHz output graphs are shown overleaf. Note that the comparator outputs are both bipolar and symmetrical, ie, they are always mirror images of each other, regardless of the duty cycle setting set by the 10kW trimpot. Practical limitations As with the AD9833, the main limitation of this module regards the maximum frequency that it can produce. In theory this is equal to the Nyquist frequency, or half the sampling clock frequency; in this case, 125MHz ÷ 2 or 62.5MHz. But you need to bear in mind that because of the way a DDS works, the “sinewave” that it produces at this frequency will have very high distortion. If you want to get a reasonably smooth sinewave output, this will only be possible at frequencies below about 20% of the clock frequency, or in this case, a maximum of about 25MHz. If you can tolerate a moderate amount of distortion, it should be possible to get nominal sinewaves at frequencies up to about 40-50MHz. That’s why the module pictured is usually advertised as being capable of delivering sinewaves up to “40MHz and above”. Programming it Although the AD9850 is capable of being programmed by a parallel loading sequence of five bytes, we’re going to concentrate on the SPI interface since it involves only five wires between the micro and the module, rather than the 11 wires needed for parallel loading; with most micro-based projects, it’s easy to run out of free pins. Fig.2: circuit diagram for the AD9850-based DDS module. Besides the DDS IC and 125MHz crystal oscillator used to derive its output frequency, the main point of interest is the 7th order low-pass elliptic filter formed by three SMD inductors and a few small ceramic capacitors. This has a corner frequency close to 100MHz and a rapid fall-off, to reject the 125MHz+ switching artefacts from the DAC while leaving the generated signal largely untouched. 96  Silicon Chip siliconchip.com.au While the AD9850 doesn’t provide a direct way to produce a triangle or square wave, a fixed or variable duty cycle square wave can be derived from a generated sinewave plus a DC reference voltage using the internal comparator. We have summarised the basic coding for the frequency, control and phase registers graphically in Fig.3. The 40 bits making up the serial word are shown in a line along the top of the diagram, with the 32 frequency programming bits (red tint) on the left, followed by the three control bits and the five phase programming bits (blue tint) on the right. The entire 40 bits must be sent to the AD9850 “LSB first”, ie, B0, B1, B2, B3 and so on, right up to B39. When all 40 bits have been shifted into the AD9850’s data input register, a short positive pulse is applied to the chip’s FQ_UD/SS pin (pin 3 of CON2 in Fig.2), to load the data into the frequency/phase data register. If you decide to use parallel loading instead of serial loading, the main difference is that you have to present bits B0-B7 to pins 2-9 of CON1 first, followed by a pulse to the W_CLK pin (pin 2 of CON2). Then you repeat this with bits B8-B15, B16-B23, B24-31 and finally B32-39. Only after all five bytes have been loaded do you then need to apply a short positive pulse to the FQ_UD/SS to load it all into the frequency/phase register. The formula to determine the DDS output frequency from the 32-bit frequency word is shown at bottom left in Fig.3. With a 125MHz clock and a 32 bit frequency word, the AD9850 has a minimum output frequency of 0.02910383Hz and this is also the minimum frequency increment. So the output frequency Fout = ΔPhase × 0.02910383. Or if you prefer, ΔPhase = Fout ÷ 0.02910383. For most purposes, you won’t really have to worry about the final eight bits of that 40-bit programming word, because as you can see bits B32, B33 and B34 should be set to zero for normal operation, while bits B35-B39 should also be set to zero if you don’t want to perform phase modulation. So now we just need to connect the module up to our microcontroller. Note that we’re only going to do that using the SPI serial interface. Driving it from an Arduino There isn’t much to it, as shown in Fig.4. Most of the connections can be made via the 6-pin ICSP header. These connections are quite consistent over just about all Arduino variants, including the Uno, Leonardo and Nano, the Freetronics Eleven and LeoStick, and the Duinotech Classic or Nano. The only connection that’s not available via the ICSP header is the one for SS/CS/FQ_UD, which needs to be connected to the IO10/SS pin of an Arduino Uno, Freetronics Eleven or Duinotech Classic as shown. With other Arduino variants, you should be able to find the corresponding pin without too much trouble and even if you can’t, the pin reference can be changed in your software sketch to match the pin you do elect to use. One thing to bear in mind when you’re writing your own sketch to program the AD9850 module is the requirement for the 40-bit programming word to be sent LSB first, instead of the usual MSB first. And because the serial data on the SDATA/MOSI line is clocked into the chip on the rising edges of the SCLK pulses and SCLK must idle low, this means you need to set the SPI Settings parameters like this: SPISettings(5000000, LSBFIRST, SPI_MODE0) (where that first parameter is the serial clock frequency). Also, since the Fig.3: format for loading frequency, phase and control data into the AD9850. 40 bits of data are shifted into the IC, least significant bit (LSB) first, with the first 32 bits setting the frequency, the next three bits controlling the powerdown (sleep) mode and the final five bits setting the phase. siliconchip.com.au September 2017  97 You can see that once the frequency exceeds ~25MHz, a fair amount of distortion is introduced into the output. FQ_UD input of the AD9850 is active high, this line should be programmed to idle in the low state and only go high for loading the data into the AD9850’s frequency/phase register. If this sounds confusing, please refer to the example Arduino sketch I have written; more about this shortly. Driving it from a Micromite It’s also quite easy to drive the module from a Micromite, using the connections shown in Fig.5. By connecting the MOSI, SCK and SS/FQ_UD lines to Micromite pins 3, 25 and 22 as shown, MMBasic’s built-in SPI protocol commands will have no trouble in communicating with the module. Again, there is just one small complication, brought about by the AD9850’s need to have the data sent to it LSB-first. As MMBasic’s SPI commands only have provision for MSB-first data transmission, your program needs to reverse the bit order before it’s sent to the DDS. You’ll see one way of doing this in my example program for the Micromite, discussed below. Note that if you’re using the Micromite LCD BackPack, because the LCD touchscreen also communicates with the Micromite via its SPI port, your program needs to open the SPI port immediately before it sends commands or data to the module and then close the port again immediately afterwards to prevent any SPI conflicts. This is also illustrated in my example MMBasic program. Programming examples The sample program for Arduino is called “sketch_for_testing_AD9850_ DDS_module.ino”. This simple program initialises the AD9850, programs it to generate a 100kHz sinewave, then informs you of the current frequency via the Serial Monitor utility built into the Arduino IDE. Fig.4: as with many of the modules we’ve examined in this series of articles, connecting the AD9850 DDS module to an Arduino is quite simple. All you have to do is connect the 5V, GND and SPI signals to the ICSP header on the Arduino, leaving just the slave select (SS) pin which normally goes to I/O pin 10. 98  Silicon Chip siliconchip.com.au At the same time, it gives you the opportunity to type a new frequency into the Serial Monitor and if you respond by typing in a new frequency and clicking on the Send button, it will load the new frequency into the AD9850 and repeat the process. It’s pretty straightforward, but it should demonstrate the basics of controlling the AD9850 DDS module from an Arduino. The other program is written for the Micromite LCD BackPack and is called “Simple AD9850 sig gen.bas”. This one is a little more complicated, partly because of the need to control the program’s operation via the LCD touchscreen and partly because of the need to reverse the bit order of the 40 bits of data sent to the AD9850 because of its LSB-first requirement. It again lets you control the AD9833’s output frequency, in this case by using buttons and a virtual keypad on the BackPack’s touchscreen. It’s quite easy to drive and again, should show you how the AD9850 can be controlled via a Micromite. Both of these programs are available from the Silicon Chip website (www. siliconchip.com.au). SC siliconchip.com.au Fig.5: again, wiring up this module to a Micromite is pretty straightforward. Check the instructions for your Micromite to determine the MOSI and SCK pins; as shown here, for the 28-pin Micromite and LCD BackPack, these go to pins 3 and 25. That just leaves 5V, GND and the slave select pin, which in this case we’ve wired to pin 22. September 2017  99