Page 1 of 1

WiFi controlled DDS signal generator

PostPosted: Fri May 19, 2017 1:35 pm
by Doug Coulter
I've discovered I want to play with some RF on the fusor. I don't think a sine is what I'll wind up wanting, but you gotta start somewhere and I don't have a lot of options that aren't likely to get fried along with some expensive windows box before I get my data, and gee, there's some neato stuff out there these days that at least gets you to sine.
So, here we go.
I used an ESP-8266 module, in this case a NodeMcu model, as I wanted to have the microUSB connector for power on this one. It's a decent tradeoff between the more expensive ADA feather version that charges LiIon (why? these things use LOTS of power), and other versions out there that need me to make yet. another. power. supply.
I used some comparators I had in my junkbox from a project I never wound up needing them for as level shifters. I have a nice one transistor circuit that would have done, but this got rid of some junk for me - it's not the way I'd have designed from scratch, but hey, cowboy, I have what I have, and time isn't on the list of "way too much".

I needed the level shifters, as the DDS module I was able to get that actually works...(yes, this is about the 3rd one I've ordered, and not even all of these work, the Chinese need to pen up the pigs and chickens in a separate room from the reflow soldering) - if 5v only with the crystal they used, and won't deal with 3.3v logic levels - it's just barely out of spec to wing it there.
The module is a "Puuli AD9850 DDS Signal Generator Module 0-40MHz IC Test Equipment AD9850" from Amazon - 3 out of 4 ordered worked and Amazon paid me back for the bad one.

So, here's the breadboard:
100_3146.JPG
Quick built, but I'll put it on perfboard in a box.

Useful pinout for the DDS module:
ad9850.jpg
Module. The put the pinouts on the bottom! Gheesh.

Here's a scope trace from somewhere in the sweep:
DS0003.png
Top trace is an FFT, sort of
DS0003.png (6.23 KiB) Viewed 3860 times

Just to make things more "fun" the NodeMcu guys have "multiple" pinouts. The big ones (not the ones on the silkscreen) are the right ones.
nodemcu_pins.png
Don't use the pins as D? - use the numbers from the picture, not the silkscreen.


And of course the entire point is that this can be remotely controlled, so it generates a web page, actually two of them - one to just show you what it thinks it's doing and one that lets you change that, with special attention in the code to getting it shut off FAST if you ask for that (why would you want that?).
So, it looks like this on the control page. The / page is just the same stuff but read-only.
DDS_Controls.png
I do some fixups for operator whoopsies - it'll sweep up or down, sit still, even fix negative numbers or incorrect directions for increment.


And of course, this ain't crap without the code, so here's the code. I didn't do a schematic for something this insanely simple. I used a couple forward biased 1n457 diodes to make a volt reference for the level shifting comparators; I assume you'd use something smarter for that anyway. Pinouts are in the code. If I think I need it and get more ambitious, there's a place in the library where they do a divide on every frequency set which is just stupid DSP technique - you only need to do that when you change the "trim calibration" when you can create a constant that you multiply by - which is always faster. So far, I don't care, but...
Here's the library I used: https://github.com/F4GOJ/AD9850
Here's the arduino sketch:
ESP82DDS.ino.zip
The goods
(5.1 KiB) Downloaded 319 times