Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 34

Thread: Emergency signal generator

  1. #11
    Join Date
    May 2008
    Location
    nerdtown, USA
    Posts
    1,165

    Default

    Quote Originally Posted by mixedgas View Post
    Thats nice, but you still need a second source for testing some times in the field. what is wrong with 6$ instead of 450-560.
    ATmega328 + Microchip MCP4922 + Max232 -> can haz $15 test pattern generator.

    That's how I generate ramps and sine waves for testing my laser modulator project anyway. (Mine uses a pair of MCP4921s, which are the same but only a single DAC on the chip.)

    Here's the code for an Arduino to produce counter-ramps:
    Code:
    #define DATAOUT 11//MOSI
    #define DATAIN 12//MISO - not used, but part of builtin SPI
    #define SPICLOCK  13//sck
    #define SLAVESELECTX 10//ss
    #define SLAVESELECTY 9//ss
    #define LDAC 8
    
    void setup()                    // run once, when the sketch starts
    {  
      byte clr;
      pinMode(DATAOUT, OUTPUT);
      pinMode(DATAIN, INPUT);
      pinMode(SPICLOCK,OUTPUT);
      pinMode(SLAVESELECTX,OUTPUT);
      pinMode(SLAVESELECTY,OUTPUT);
      pinMode(LDAC,OUTPUT);
      digitalWrite(SLAVESELECTX,HIGH); 
      digitalWrite(SLAVESELECTY,HIGH); //disable devices
      digitalWrite(LDAC,HIGH);
    
      SPCR = (1<<SPE)|(1<<MSTR);
      clr=SPSR;
      clr=SPDR;
      delay(10);
    }
    void write_values(uint16_t samplex, uint16_t sampley)
    {
      uint8_t dacSPI0 = 0;
      uint8_t dacSPI1 = 0;
      
      dacSPI0 = (samplex >> 8) & 0x00FF;
      dacSPI0 |= 0x30;
      dacSPI1 = samplex & 0x00FF;
      digitalWrite(SLAVESELECTX,LOW);
      SPDR = dacSPI0;                    // Start the transmission
      while (!(SPSR & (1<<SPIF)))     // Wait the end of the transmission
      {
      };
    
      SPDR = dacSPI1;
      while (!(SPSR & (1<<SPIF)))     // Wait the end of the transmission
      {
      };  
      digitalWrite(SLAVESELECTX,HIGH);
      
      dacSPI0 = (sampley >> 8) & 0x00FF;
      dacSPI0 |= 0x30;
      dacSPI1 = sampley & 0x00FF;
      digitalWrite(SLAVESELECTY,LOW);
      SPDR = dacSPI0;                    // Start the transmission
      while (!(SPSR & (1<<SPIF)))     // Wait the end of the transmission
      {
      };
    
      SPDR = dacSPI1;
      while (!(SPSR & (1<<SPIF)))     // Wait the end of the transmission
      {
      };  
      digitalWrite(SLAVESELECTY,HIGH);
      
      // Latch the DACs
      digitalWrite(LDAC, LOW);
      digitalWrite(LDAC, HIGH);
      
      //delay(1);
    }
    
    void loop()                     // run over and over again
    {
      static int j;
    
      j+=5; 
      if (j > 4096) j = 0;
    
      write_values(j, 4095-j);
    }

  2. #12
    Join Date
    Oct 2008
    Location
    Portland
    Posts
    1,566

    Default

    Quote Originally Posted by keeperx View Post
    i will have one soon as well

    its called the RIYA MultiBus
    What you really want is a micro if you just wanted to test, hack in a 5vdc button cell and away you (via the usb port of course).
    Attached Thumbnails Attached Thumbnails Picture 005.jpg  

    Support your local Janitor- not solicited .

    Laser (the acronym derived from Light Amplification by Stimulated Emissions of Radiation) is a spectacular manifestation of this process. It is a source which emits a kind of light of unrivaled purity and intensity not found in any of the previously known sources of radiation. - Lasers & Non-Linear Optics, B.B. Laud.

  3. #13
    Join Date
    Jul 2008
    Location
    Maryland
    Posts
    1,691

    Default

    i LOVE the pic... i was thinking micro and realized that the basic was better 4 me.. but nice pic...
    Quis custodiet ipsos custodies?
    Solid State Builders Group

  4. #14
    Join Date
    Nov 2007
    Location
    Bend Oregon USA
    Posts
    3,350

    Default

    damn I wish I knew what you guys were talking about
    Pat B

    laserman532 on ebay

    Been there, done that, got the t-shirt & selling it in a garage sale.

  5. #15
    Join Date
    Oct 2008
    Location
    Portland
    Posts
    1,566

    Default

    Quote Originally Posted by Laserman532 View Post
    damn I wish I knew what you guys were talking about
    http://riyalasers.com/ - Laserman, Steves circuit is much cheaper than buying a DAC!

    -Adam
    Support your local Janitor- not solicited .

    Laser (the acronym derived from Light Amplification by Stimulated Emissions of Radiation) is a spectacular manifestation of this process. It is a source which emits a kind of light of unrivaled purity and intensity not found in any of the previously known sources of radiation. - Lasers & Non-Linear Optics, B.B. Laud.

  6. #16
    Join Date
    Jun 2007
    Location
    Lake Geneva, WI.
    Posts
    2,704

    Default

    Hey Steve!

    I built your circuit but I get an output of 52.65Hz @ 2.1VAC out of all the channels. It is a clean square wave. What did I do wrong? Any suggestions? I haven't hooked up to scanners yet.

    Also, I'm getting 210Hz @ 1.5V out of the 555.
    Thanks!
    Adam


  7. #17
    mixedgas's Avatar
    mixedgas is offline Creaky Old Award Winning Bastard Technologist
    Infinitus Excellentia Ion Laser Dominatus
    Join Date
    May 2007
    Location
    A lab with some dripping water on the floor.
    Posts
    10,016

    Default

    I must have missed a factor of two in the resistor when I did the math, or you have a cap with poor tolerances. Or in some rare cases frequency measuring gear can catch a 2nd harmonic. Are you getting a quad square? You should be at 1/4 the input as a its a divide by four walking ring counter.
    What do you see on the scope?

    52.6 x 4 = 210.6, so it seems to be working and at 50 hz 2.1 vac is about right, regular TTl should bounce from 1.6 to 2.4V but if your voltmeter is not true rms reading on a square wave it would be about 2.1. I cant see it causing any problems, so hook it up.

    [/QUOTE]
    Last edited by mixedgas; 05-05-2009 at 19:21.
    Qui habet Christos, habet Vitam!
    I should have rented the space under my name for advertising.
    When I still could have...

  8. #18
    Join Date
    Jun 2007
    Location
    Lake Geneva, WI.
    Posts
    2,704

    Default

    Quote Originally Posted by mixedgas View Post
    I must have missed a factor of two in the resistor when I did the math, or you have a cap with poor tolerances. Or in some rare cases frequency measuring gear can catch a 2nd harmonic. Are you getting a quad square? You should be at 1/4 the input as a its a divide by four walking ring counter.
    What do you see on the scope?

    52.6 x 4 = 210.6, so it seems to be working and at 50 hz 2.1 vac is about right, regular TTl should bounce from 1.6 to 2.4V but if your voltmeter is not true rms reading on a square wave it would be about 2.1. I cant see it causing any problems, so hook it up.

    [/QUOTE]

    Looks like a quad square to me! It should work a 50Hz okay.... Right?


  9. #19
    Join Date
    Jun 2007
    Location
    Lake Geneva, WI.
    Posts
    2,704

    Default

    Maybe I'm getting 50Hz because my C2 is 20% tolerance ceramic. All the other caps are low tolerance poly. My resistors are 10% as well. I should probably switch to 1%. Thanks for the the help Steve! Cool circuit!

  10. #20
    mixedgas's Avatar
    mixedgas is offline Creaky Old Award Winning Bastard Technologist
    Infinitus Excellentia Ion Laser Dominatus
    Join Date
    May 2007
    Location
    A lab with some dripping water on the floor.
    Posts
    10,016

    Default

    I cannot speak highly enough about this gadget when doing RF work with caps and inductors.

    http://www.aade.com/lcmeter.htm

    Was 99$ for the kit, and the design has been published some place if you like programming PICs.

    Steve
    Qui habet Christos, habet Vitam!
    I should have rented the space under my name for advertising.
    When I still could have...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •