Monday, March 30, 2015

Arduino with AD9850 - Redesign

Today, we have a meeting to test the target frequencies by using Pico Oscilloscope and the game programmed by Sven. The test was sucessful with high accuracy. Hence, we move to redesign the Arduino + AD9850 set to make it more compact so that it can be treated as a wearable device.

Thanks to the first set up by Andy in the group, I am able to rearrange the Ardunio and AD9850 so that it takes less space and looks a bit cooler. The below figure shows the new set up where the AD9850 board sits on top of the Ardunio.




By pushing the AD9850 chip into the Arduino right digital pin set, The AD9850 uses different pins in the Ardunio compare to the orgional propose by Andy. Here is the full new pins set up;

  • Wire from AD9850 VCC pin to 3.5V on Arduino
  • Male AD9850 W_CLK pin plug to directly to pin 10 on Arduino
  • Male AD9850 FV_VD pin plug to directly to pin 11 on Arduino
  • Male AD9850 DATA pin plug to directly to pin 12 on Arduino
  • Male AD9850 RESET breadboard row to digital pin 11 on Arduino
  • Male AD9850 GND pin plug to directly to pin GND on Arduino
  • Wire from AD9850 ZOUT2 so that we can use it for testing
As the new pins set have been changed the code for the Arduino has been changed to adapt to a new set up. Here the full new code based on the origional code by Andy:

 //AD9850 DDS test  
 #define DDS_CLOCK 125000000  
 #define CLOCK 10 //pin connections for DDS  
 #define LOAD 11  
 #define DATA 12  
 #define RESET 13  
 int flag=0;  
 int time = 2000;  
 bool on = false;  
 long lastTime;  
 long freq1 = 5000000;  
 long freq2 = 6000000;  
 long freq3 = 7000000;  
 long freq4 = 8000000;  
 long freq5 = 9000000;  
 long freq6 = 10000000;  
 long freqUp = freq3;  
 long freqDown = freq3;  
 void setup()  
 {  
  pinMode (DATA, OUTPUT);  
  pinMode (CLOCK, OUTPUT);  
  pinMode (LOAD, OUTPUT);  
  pinMode (RESET, OUTPUT);  
  AD9850_init();  
  AD9850_reset();  
  SetFrequency(freqUp);  
  Serial.begin(9600);  
  lastTime = millis();  
 }  
 /*void loop() {  
 SetFrequency(freqUp);  
 while(1);  
 } */  
 void loop()  
 {  
  // if(flag==1)  
  if (millis() - lastTime > time)  
  {  
   if (on)  
   {  
    SetFrequency(freqUp);  
   }  
   else {  
    SetFrequency(freqDown);  
   }  
   on = !on;  
   lastTime = millis();  
  }  
  // read the input on analog pin 0:  
  int sensorValue = analogRead(A0);  
  // print out the value you read:  
  Serial.println(sensorValue);  
  delay(1);  
 }  
 void SetFrequency(unsigned long frequency)  
 {  
  unsigned long tuning_word = (frequency * pow(2, 32)) / DDS_CLOCK;  
  digitalWrite (LOAD, LOW);  
  shiftOut(DATA, CLOCK, LSBFIRST, tuning_word);  
  shiftOut(DATA, CLOCK, LSBFIRST, tuning_word >> 8);  
  shiftOut(DATA, CLOCK, LSBFIRST, tuning_word >> 16);  
  shiftOut(DATA, CLOCK, LSBFIRST, tuning_word >> 24);  
  shiftOut(DATA, CLOCK, LSBFIRST, 0x0);  
  digitalWrite (LOAD, HIGH);  
 }  
 void AD9850_init()  
 {  
  digitalWrite(RESET, LOW);  
  digitalWrite(CLOCK, LOW);  
  digitalWrite(LOAD, LOW);  
  digitalWrite(DATA, LOW);  
 }  
 void AD9850_reset()  
 {  
  //reset sequence is:  
  // CLOCK & LOAD = LOW  
  // Pulse RESET high for a few uS (use 5 uS here)  
  // Pulse CLOCK high for a few uS (use 5 uS here)  
  // Set DATA to ZERO and pulse LOAD for a few uS (use 5 uS here)  
  // data sheet diagrams show only RESET and CLOCK being used to reset the device, but I see no output unless I also  
  // toggle the LOAD line here.  
  digitalWrite(CLOCK, LOW);  
  digitalWrite(LOAD, LOW);  
  digitalWrite(RESET, LOW);  
  delay(5);  
  digitalWrite(RESET, HIGH); //pulse RESET  
  delay(5);  
  digitalWrite(RESET, LOW);  
  delay(5);  
  digitalWrite(CLOCK, LOW);  
  delay(5);  
  digitalWrite(CLOCK, HIGH); //pulse CLOCK  
  delay(5);  
  digitalWrite(CLOCK, LOW);  
  delay(5);  
  digitalWrite(DATA, LOW);  //make sure DATA pin is LOW  
  digitalWrite(LOAD, LOW);  
  delay(5);  
  digitalWrite(LOAD, HIGH); //pulse LOAD  
  delay(5);  
  digitalWrite(LOAD, LOW);  
  // Chip is RESET now  
 }  

To sump up, It has been a great work to reduce the side of the device. The new set up may also promise a space for the 9V battery to sit on top of the Arduino and next to the AD9850.

Wednesday, March 25, 2015

Successful Application Scenario - Multiplayer Tank Game

Sven in the group has created a simple tank game that use the frequencies as the controllers for the game. We tested with our design device and the result is promising. Here is the video of the test.

The Tank Application Scenario

It is clearly that the game is function with a very high accuracy. This test seesion today has motivated us to dveelop the device better and think about more applications in the future if the time is allow.

Wednesday, March 18, 2015

Band-pass filter

Today lab session, we used the Oscilloscope to test the signal generators built built by Paul and Sven (as shown in Figure 1). However, one colpitts oscillator generated expected signal which is 7Mhz, the other one ,instead of producing 10Mhz, has a uneven output signal.


Figure 1: Signal generator Oscilloscope testing. 

After having a discussion and suggestion from the lab instructor, we decide to built the band-pass filter to detect our target frequency (ass shown in Figure 2). I spent hours to look at the combination of capacitors, resitors to peoduce the target 7Mhz and 10 Mhz band-pass filters. However, what I found was that the capacitor and resitors I needed for the circuit were'nt not avalable. Hence, we thought about buying it.

Figure 2: Band-pass filter diagram.


In the end of the lab, after considering the time limit and the current problem with the hand built signal generators, we decided that we will come back and use AD9850 DDS (see Figure 3) as the signal generators.

Figure 3: AD9850 DDS.

There are a few reasons make us choose AD9850 DDS instead of continuing building our own signal generator:
  • AD9850 DDS is the ready chip. It is ready to use and hence, it can save us time.
  • It is realative cheap around 8£ which is still under budget for this project
  • It produces clean sine wave signal which important for detecting signal later
  • It can be easily programme to change the frequency
However, there are some drawbacks that we need to deal with when using the AD9850 DDS;
  • We need the Arduino to programme/control the AD9850. It means that they must come as a set of Arduino+AD9850 DDS to work.
  • The combination of Arduino and AD9850 is relatively big.
Considering the advanatges of using the AD9850 outbreak some small drawacks using AD9850 brings, we have made the final decision that using the AD9850 as the signal generator.