Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

From Introducing the Arduino Robot

Page 18

Massimo Banzi speaking at MAKE’s Hardware Innovation Workshop 2013.


From Made On Earth — High Five

Page 24

The Hand of Man in action at Maker Faire Bay Area 2013

And from Maker Faire Bay Area 2009


From The Six-Pack Tesla Coil

Page 49

Download files


From The Sublimator Dry-Ice Cannon

Page 76

Download files

Tips for cutting and gluing PVC


From Skill Builder — Advanced Arduino Sound Synthesis

Page 80

Download files


From Raygun Vector Weapon

Page 102

Video of the project in action: coming soon!

Download files


From Lego Phonograph

Page 108

See the full project build here.


From Bookshelf Boombox

Page 110

Download files


From TV-Go-Sleep Universal Timer

Page 116

Download files

  • TV-Go-Sleep code (Universal Sleep Timer Arduino code, and the TV-B-Gone for Arduino library (main.h and WORLDcodes.cpp) included in zip file.)

From My Franken-Keepon

Page 124

Check out the Keepons in action!

And an oldie but goodie:


From My Electro Chemical Kid Sub

Page 137

Full project build online: coming soon!


From Toy Inventor’s Notebook

Page 160

Completed cookie cutters!

finished4

finished1

finished2

finished3

Comments

  1. Jim Jewett says:

    In the digital edition of vol 35, the links to get to the web materials (this web page) seems to be wrong. The link address used at various locations throughout the magazine is makezine.com/35. This forwards me to http://makezine.com/2007/05/30/35-avr-oscilloscope-clock/ which is WAY off-topic.

    FYI

  2. Shalom says:

    Note for “Advanced Arduino Sound Synthesis” code: in listing_2 line 24, it is recommended that you comment out that line and add v=0 as follows:

    float v=0;//v = (AMP*sin((PI2/LENGTH)*i)); // Calculate current entry

    If you don’t, the square wave that results is half square wave and the other half sine wave. Sort of the Centaur of waveforms!

    Nice job on the article Jon Thompson!

    1. Shalom says:

      I’ve edited the author’s “listing_3″ code to output a Sawtooth wave instead of a Square wave and also edited the code so that it more closely resembles the standard Fourier Synthesis Equation. Notice that OFFSET is removed since the term a0*.5 takes care of the offset of the waveform in the standard synthesis equation:

      void additive(void) {
      #define PARTIALS 8
      float harmonic[PARTIALS] = {1,3,5,7,9,11,13,15};
      float amplitude[PARTIALS] = {-.4053,-.0450,-.0162,-.0083,-.005,-.0033,-.0024,-.0018};
      float v;
      float an;
      float a0;
      int i,j;

      // Fourier Synthesis Equation
      // v = a0*.5 + sum{ a_n*cos(2*pi*n*t/T) + b_n*sin(2*pi*n*t/T) }
      // where n is harmonic[j] in this code

      for (int i=0; i<LENGTH; i++) {
      a0=AMP;
      v = a0*.5;
      for (int j=0; j<PARTIALS; j++) {
      an = AMP*amplitude[j];
      v += an*cos((PI2/LENGTH)*(i*harmonic[j]));
      }
      v = constrain(v,0,255);
      wave[i]=byte(v);
      }
      }

  3. Steve Carney says:

    Any status on the Electro Chemical Kid Sub? Looking forward to the details of this project!

  4. s_p_e_x says:

    The “Skill Builder — Advanced Arduino Sound Synthesis” code doesn’t seem to build for Arduino Leonardo.

    I have a SparkFun Pro Micro 5V/16MHz ATMega32u4 board which looks very similar to the Arduino Nano in the article, but with a somewhat different chip.

    I have been using it as a Leonardo (programmed that boot loader onto it). If I choose the Pro Micro I can build the code. If I choose Leonardo, it complains:

    listing_3:25: error: ‘TCCR2A’ was not declared in this scope

    I’m guessing that I need an additional #include? Any ideas?

    1. Chuck Benedict says:

      The registers are different with different chips. I have the old Atmega 8 chips and so modified listing_2 to work. Here is my example:

      /******** Load AVR timer interrupt macros ********/
      #include

      /******** Sine wave parameters ********/
      #define PI2 6.283185 // 2 * PI – saves calculating it later
      #define AMP 127 // Multiplication factor for the sine wave
      #define OFFSET 128 // Offset shifts wave to just positive values

      /******** Lookup table ********/
      #define LENGTH 256 // The length of the waveform lookup table
      byte wave[LENGTH]; // Storage for the waveform

      /******** Waveform parameters ********/
      #define SINE 0
      #define RAMP 1
      #define TRIANGLE 2
      #define SQUARE 3
      #define RANDOM 4

      void setup() {

      /******** Populate the waveform lookup table with a sine wave ********/
      waveform(SINE); // Replace sine with the different cases to
      // Produce the different waves

      /******** Set timer1 for 8-bit fast PWM output ********/
      pinMode(9, OUTPUT); // Make timer’s PWM pin an output
      TCCR1B = (1 << CS10); // Set prescaler to 1 – full 8MHz
      TCCR1A |= (1 << COM1A1); // PWM pin to go low when TCNT1=OCR1A
      TCCR1A |= (1 << WGM10); // Put timer into 8-bit fast PWM mode
      TCCR1B |= (1 << WGM12);

      /******** Set up timer 2 to call ISR ********/
      TCCR2 = (1 << CS20); // Set prescaller to divide by 1
      TIMSK = (1 << OCIE2); // Set timer to call ISR when TCNT2 = OCR2
      OCR2 = 128; // sets the frequency of the generated wave
      // 8Mhz / (OCR2 * 256)…in this case, 244 Hz
      sei(); // Enable interrupts to generate waveform!
      }

      void loop() { // Nothing to do!
      }

      /******** Called every time TCNT2 = OCR2 ********/
      ISR(TIMER2_COMP_vect) { // Called each time TCNT2 == OCR2
      static byte index=0; // Points to successive entries in the wavetable
      OCR1AL = wave[index++]; // Update the PWM output
      TCNT2 = 33; // Timing to compensate for time spent in ISR
      }

      void waveform(byte w) {
      switch(w) {

      case SINE:
      for (int i=0; i<LENGTH; i++)
      {float v = OFFSET+(AMP*sin((PI2/LENGTH)*i));
      wave[i]=int(v);
      }
      break;

      case RAMP:
      for (int i=0; i<LENGTH; i++) {
      wave[i]=i;
      }
      break;

      case TRIANGLE:
      for (int i=0; i<LENGTH; i++) {
      if (i<(LENGTH/2)) {
      wave[i]=i*2;
      } else {
      wave[i]=(LENGTH-1)-(i*2);
      }
      }
      break;

      case SQUARE:
      for (int i=0; i<(LENGTH/2); i++) {
      wave[i]=255;
      }
      break;

      case RANDOM:
      randomSeed(2);
      for (int i=0; i<LENGTH; i++) {
      wave[i]=random(256);
      }
      break;
      }
      }

    2. Chuck Benedict says:

      I blogged more about the changes I made using an ATmega8 at http://myrede.blogspot.com/2013/09/advanced-arduino-sound-synthesis.html

  5. Dinosorceror says:

    I’m fairly new to sound synthesis and oscilloscope use, but even after following Shalom’s advice to make the square wave more “square” in listing_2, I’m still not seeing a truly square wave on my scope. It’s vaguely square, but has a sweeping curve up to the peak and then a curve away on the downslope (much like a stereotypical ocean wave). Any ideas?

    Also, I didn’t have an exact match for the transistor specified, I tried using a 2N2222, as well as a BC549, and I couldn’t get any increase in volume on a 8-ohm speaker. In fact, hooking up a scope pretty much showed nothing. I just wound up using an amplified speaker instead, and just kept to the resistor and capacitor.