Following on from my last post, I got something similar working with an ATTiny85. This sample code does a slow sweep from 10Mhz up a bit. It's just a demo, the bit I've been looking for myself and couldn't find was how to just say sendFrequency().I have lots of ideas for applications of these things, including:
- General purpose VFO with keypad and knob
- Sweep test generator, paired with a digital rf signal measurer for computer plotting filters etc
- Automated antenna analyser with a digital SWR measuring thingy
This code is written in C and uses avrlibc. I'm working on a Mac but it will work the same on Linux or that other OS that was quite popular.
/*
Control an AD9851 DDS with an ATMega85
*/
#include <avr/io.h>
// Sets up the default speed for delay.h
#define F_CPU 800000UL
#include <util/delay.h>
#include <math.h> // for pow()
// Pins used to talk to the DDS chip
#define LOAD 4
#define CLOCK 3
#define DATA 0
#define LED 1
#define DDS_CLOCK 180000000UL
#define OUTPORT PORTB
#define OUTPORTDIRECTION DDRB
void sendFrequency(unsigned long frequency);
void byte_out(unsigned char byte);
void outOne();
void outZero();
void bitSetHi(volatile uint8_t *port, int bit);
void bitSetLo(volatile uint8_t *port, int bit);
int main (void)
{
OUTPORTDIRECTION = _BV(LOAD) | _BV(CLOCK) | _BV(DATA) | _BV(LED);
unsigned long freq;
// flash an led to show we're alive
int i;
for(i = 0; i < 10; i++)
{
bitSetHi(&OUTPORT, LED);
_delay_ms(100);
bitSetLo(&OUTPORT, LED);
_delay_ms(100);
}
while (1)
{
// Do a frequency sweep in Hz
for(freq = 10000000; freq < 10001000; freq++)
{
sendFrequency(freq);
_delay_ms(1);
}
}
return 0;
}
void bitSetHi(volatile uint8_t *port, int bit)
{
*port |= ( 1<<bit );
}
void bitSetLo(volatile uint8_t *port, int bit)
{
*port &= ~( 1<<bit );
}
void sendFrequency(unsigned long frequency)
{
unsigned long tuning_word = (frequency * pow(2, 32)) / DDS_CLOCK;
bitSetLo(&OUTPORT, LOAD); // take load pin low
int i;
for(i = 0; i < 32; i++)
{
if ((tuning_word & 1) == 1)
outOne();
else
outZero();
tuning_word = tuning_word >> 1;
}
byte_out(0x09);
bitSetHi(&OUTPORT, LOAD); // Take load pin high again
}
void byte_out(unsigned char byte)
{
int i;
for (i = 0; i < 8; i++)
{
if ((byte & 1) == 1)
outOne();
else
outZero();
byte = byte >> 1;
}
}
void outOne()
{
bitSetLo(&OUTPORT, CLOCK);
_delay_ms(1);
bitSetHi(&OUTPORT, DATA);
_delay_ms(1);
bitSetHi(&OUTPORT, CLOCK);
_delay_ms(1);
bitSetLo(&OUTPORT, DATA);
_delay_ms(1);
}
void outZero()
{
bitSetLo(&OUTPORT, CLOCK);
_delay_ms(1);
bitSetLo(&OUTPORT, DATA);
_delay_ms(1);
bitSetHi(&OUTPORT, CLOCK);
_delay_ms(1);
}
The AMQRP board has it's own regulator and has a 5V output so I'm powering the ATTiny85 from that power rather than a separate input. Here's a nifty spot reference. Simple enough even for me to build.
Been playing with the AD9851 DDS for a while now using other people's software mostly written in assembly language that I find rather hard to get my head around. Finally tonight, with the help of
We've had Optus cable internet here at the house for many years. It's been a reliable service but over time annoyances build up in a relationship like this so I decided to upgrade and switch to Telstra Bigpond on a service they claim can deliver up to 30Mbps down and 1Mbps up.
I share an interest in good quality headphone audio with many including
I love Bill M0HBR's regular podcast
I'm experimenting with antennas again and wanted a way to string up a dipole so that I could easily pull it down and make adjustments. 
As a family, we decided to travel to Canberra to watch the torch relay and join the crowd in support of the Tibetan community. I headed out early for a
Bob's a real trooper, he gave a great speech and freely mingled with the crowd. He's pictured here talking with a reporter from 
All in all, it was a good day for democracy in Australia, as Bob Brown pointed out, if we'd done this in China we'd all have been arrested and I'd add that there would be no trace of it in the news or on the internet.
Just stumbled upon an amazing remote controlled receiver available on the internet called
MySQL has been a hugely popular database and is unambiguously the M in LAMP. (Whereas the P could be Perl, Python or PHP). That must annoy the Postgres folks.
In preparation for the next NSW Home Brew group meeting at Dural where we will be having a power meter calibrate-athon, I've built a crazy box for my simple QRP power meter. Haven't tried to calibrate it but the output of a
I'm working with SOAP and WSDL at the moment and golly that xml can be hard to read.
Acting on a tip from a work colleague, I dropped in to "
I came away with an "OptiVisor" head magnifier that I need for my recent forays into surface mount soldering, really I wanted the steampunk style that the guy I spoke with was wearing (left) but he told me that regrettably, they are no longer available.
Microsoft makes really great mice. Apple just can't seem to get it right.
Just built a nifty little kit, the
Ever since I attended a workshop on stepper motors at Dural conducted by Peter VK2EMU I've been watching for the site of an inkjet printer by the side of the road and this morning there was a rather wet Canon calling me...


Here's a simple sine wave audio generator. It generates a nice looking, and sounding sine wave by using a resistor A/D converter connected to 8 pins on port D. To the right is the waveform as displayed on a CRO. Running at 8Mhz (internal oscillator) it puts out a 400Hz tone.
I generate the 256 constants for the samples of the sine wave with a little python program - the output is pasted into the C source code. The board you see here is a nifty little target board from Evil Mad Scientist.
After hearing about them at a NSW Home Brew meeting, I purchased an AD9851 on eBay and have had about a week of frustration trying to program the thing. You need to send them a clocked 40 bit sequence to set the frequency.
Next steps are to put this in a nice box with more robust buttons, output filtering and amplifier. In summary, this gives the builder a very flexible oscillator for not many dollars. It's certain to become a core part of many future radios coming out of the Marxy lab in the future.
I've put this prototype in a little box to serve as a portable digital signal generator. Tried to run it off two AA batteries but the voltage was a little low for the 30Mhz oscillator to work reliably. (The AVR Butterfly is perfectly happy at low voltage though).
Baby steps here folks. I've just got my Atmel ATMega8 to drive an HD44780 LCD using the 4 bit parallel interface. (Previously I've been using a serial interface which is much simpler).
Over the past year, I've given up on the PIC micros and have been getting up to speed with the AVR ATMega processors. My favourite is the ATMega8 and 168 which come in a 28 pin DIL package and have loads of I/O.
A sequence of computer hand-me-downs here left us with an old PowerPC iBook with no owner. Leopard won't run on it and I'm so in to all the Leopard features and multi-touch stuff that it's getting hard to use.
Random notes: The old launch bar along the bottom of the screen was very functional compared to the dock we have now. Fonts all look rather jagged. Sherlock doesn't work any more, there must be a proxy that no longer exists.
I had the great pleasure of attending a seminar presented by the author of one of my favourite photo web sites, the
This weekend is the North Shore Railway Modeller's Association 36th Model Railway Exhibition at Forestville. I always enjoy these shows but for some reason my two daughters were too busy to attend this year.
I've heard about the amateur satellites for years but never tried to listen in. I guess my assumption was that a directional tracking antenna would be required, but it seems with at least a recent device, AO-51, that's not the case.
Saw this little 
I ordered the PSK-20 kit, a PSK31 crystal locked transceiver for 14.070Mhz (the most active spot for PSK31) from
An exciting day!
Just returned from another excellent Wyong field day. I'm sure attendance is going up again - despite a rather threatening sky.
I'm using a laptop at work and have been searching the shops for some contraption to lift the laptop up so the screen is at eye height (I'm using an external keyboard and mouse).

Started playing with PSK31 on my mac last year as