Go Down

Topic: What is wrong with my project? (Read 3855 times) previous topic - next topic

CalinB

Hi guys,

I have tried following the instructions in order to make an Illutron B synth (http://rcarduino.blogspot.co.uk/2012/08/the-must-build-arduino-project-illutron.html). Unfortunately, only 2 of the 4 LEDs blink and I get no sound unless I touch the 2. Only then do I get only the sounds attributed to those LEDs. I have read that the original creator added 2 amplifiers to the project but I can't figure out how to do so as it is not included in neither the photo or the circuit diagram. Thank you. Sorry if this is wasting your time. Here is a link with some photos I took of the setup: https://drive.google.com/folderview?id=0B-QIGqnDA9j2WWxMSWhCdVhVUUU&usp=sharing

Kind Regards,
Calin

Hackscribble

Hi Calin

Please post the Arduino program you are using.  Use the code tags when you create your post - use the "#" button above the row of smileys.

And have you connected your Arduino and the other components exactly as shown in the schematic on the page you linked to?  It is hard to tell from the different angles, but some of your leads to the LEDs seem to come from Arduino pins different from those shown on the page you linked.

Quote
Unfortunately, only 2 of the 4 LEDs blink and I get no sound unless I touch the 2. Only then do I get only the sounds attributed to those LEDs.


Touching the LEDs (if that's what you meant) should not affect the sound at all.  It may suggest you have a wiring problem.

Regards

Ray




Hackscribble.  Writing about making things
hackscribble@outlook.com

CalinB

The below code is exactly how I found it and it didn't seem to bring up any errors. Yes, I believe I have followed the diagram correctly, if not, let me know what you think is wrong. Thanks for helping!

Cheers,
Calin


Code: [Select]

//**************************************************************************
//*   Simple AVR wavetable synthesizer V1.0                                *
//*                                                                        *
//*   Implements 4 voices using selectable waveform and envelope tables    *
//*   Uses 8-bit PWM @ 62.5 kHz for audio output                           *
//*                                                                        *
//*   (C) DZL 2008                                                         *
//**************************************************************************

// Refactoring pass 1. Subsequent passes will address the interface to accessing CVoice members of the CIllutronB class

// The Illutron is a wave table synthesiser, which generates complex sound by combining simpler wave forms
// Each of the voices is formed by combining one waveforms - noise,ramp,saw,sin,square,triangle - included with the library
// With an envelope - the envelope controls how the sound evolves over time - the initial attach, the sustain and then the decay of the note
// The synth provides additional parameters from controlling the pitch, duration and pitch over time of the sound
//
// The synth is the original work of Nikolaj Mobius and has been refactored, optimised and documented by Duane B (rcarduino)
//
// The synth is contained in the files IllutronB.h and IllutronB.cpp
//
// This sketch presents a demonstration of the synth sound using a simple sequencer


#include <math.h>

#include "avr/interrupt.h"
#include "avr/pgmspace.h"

#include "IllutronB.h"

// Include the wavetables, you could add your own as well
#include "sin256.h"
#include "ramp256.h"
#include "saw256.h"
#include "square256.h"
#include "noise256.h"
#include "tria256.h"

// include the envelopes, again you could add more
#include "env0.h"
#include "env1.h"
#include "env2.h"
#include "env3.h"

// include the pitches as defined by the Arduino tone function
// while these work - it would be useful to check that the tones are correct against a tuned instrument
// the midi note calculations and tone library pitches do not agree with each other.
#include "pitches.h"

#include "AmenBreak.h"

#define PLAY_BACK_BPM_PIN 0 // analog pin 0
#define PITCH_PIN 1 // analog pin 1

// Pins and other definitions for the LED Visualiser
#define REFRESH_DIVIDER 16

// These pins are the least interesting digital pins, no interrupts, no SPI, no PWM
// so lets use them for the LEDs
#define CHANNEL0_LED 8
#define CHANNEL1_LED 12
// digital pin 5 might be used for output if we are splitting channels.
// digital pin 6 is our output
#define CHANNEL2_LED 7
#define CHANNEL3_LED 13

void setup()
{
  Serial.begin(9600);

/* PROJECT SPECIFIC SETUP */
  pinMode(CHANNEL0_LED,OUTPUT);
  pinMode(CHANNEL1_LED,OUTPUT);
  pinMode(CHANNEL2_LED,OUTPUT);
  pinMode(CHANNEL3_LED,OUTPUT);
 
  CIllutronB::setBPM(120); 
  CIllutronB::initSynth();

  CIllutronB::m_Voices[0].setup((unsigned int)SinTable,200.0,(unsigned int)Env1,1.0,300);
  CIllutronB::m_Voices[1].setup((unsigned int)RampTable,100.0,(unsigned int)Env1,1.0,512);
  CIllutronB::m_Voices[2].setup((unsigned int)TriangleTable,100.0,(unsigned int)Env2,.5,1000);
  CIllutronB::m_Voices[3].setup((unsigned int)NoiseTable,1200.0,(unsigned int)Env3,.02,500);
}

uint8_t nCycle = 0;
uint8_t nBeat = 0;

void loop()
{
    // The synth works in the background using a timer interrupt
    // Ask the IllutronB if the current beat has completed, if so lets add the next one
    if(CIllutronB::beatComplete())
    {
      // This is just for fun - allow the user to change the play back speed at anytime using
      // a potentiometer on analogue pin A1 - Map the potentiometer to a range of 80 to 240 BPM
      // Use this for user control of BPM
//      CIllutronB::setBPM(map(analogRead(PLAY_BACK_BPM_PIN),0,1024,80,240));       
      // use this to hear the original sequence at the original play back speed
      CIllutronB::setBPM(140);       
     
      // If there is a new beat/note for this channel, tell the Illutron B to play it
      // repeat simple repeats the note using whatever configuration it was previously given
      // its good for drum sounds where you just want to repeat without changing the tone
      unsigned char sNote = pCurrentSequence->getTrigger(0,nBeat);
      if(sNote /*&& digitalRead(CHANNEL0_GATE)*/)
      {
        CIllutronB::m_Voices[CHANNEL_0].trigger();
      }
     
      // triggerMidi allows you to trigger the channel to play back a sound at a particular note
      // it uses the midi note number, there is a look up table here - http://www.phys.unsw.edu.au/jw/notes.html
      // Notice that this is also connected to an analog input, this adjusts the base play back note.
      sNote = pCurrentSequence->getTrigger(1,nBeat);
      if(sNote /*&& digitalRead(CHANNEL1_GATE)*/)
      {
        // Use this to add user control of the pitch other wise the default will play the pitch defined in the sequence
        //CIllutronB::m_Voices[CHANNEL_1].triggerMidi(analogRead(PITCH_PIN)>>3);
        // To hear the original sequence played as intended, use the following -
        CIllutronB::m_Voices[CHANNEL_1].triggerMidi(sNote);
      }
     
      // This is also a neat trick, it looks at the pattern in channel 2 to trigger the percussion sound
      // but uses the notes in parttern 1 to add some variety to the sound by playing it a different pitches
      sNote = pCurrentSequence->getTrigger(2,nBeat);
      if(sNote /*&& digitalRead(CHANNEL2_GATE)*/)
      {
        CIllutronB::m_Voices[CHANNEL_2].triggerMidi(sNote);
      }
     
      // another example of simply repeating a drum sound
      sNote = pCurrentSequence->getTrigger(3,nBeat);
      if(sNote /* && digitalRead(CHANNEL3_GATE)*/)
      {
        // double up for a bang and then sustain using two voices, one for the bang and one for the sustain
        CIllutronB::m_Voices[CHANNEL_0].trigger();
        CIllutronB::m_Voices[CHANNEL_3].trigger();
      }

      // update the beat counter
      nBeat++;     

      switch(nCycle)
      {
        case 4:
          CIllutronB::m_Voices[3].setup((unsigned int)TriangleTable,1500.0,(unsigned int)Env3,.03,100);
          break;     
        case 8:
          CIllutronB::m_Voices[3].setup((unsigned int)NoiseTable,1500.0,(unsigned int)Env3,.03,300);
          break;     
        case 12:
          CIllutronB::m_Voices[1].setup((unsigned int)TriangleTable,100.0,(unsigned int)Env1,2.0,512);
          break;     
        case 16:
          CIllutronB::m_Voices[1].setup((unsigned int)RampTable,100.0,(unsigned int)Env1,1.0,512);
          break;     
      }
     
      // if it gets to the end of our sequence, reset it and update the cycle counter
      // the cycle counter is used below to change some of the voices
      if(nBeat == pCurrentSequence->getLength())
      {
        nBeat=0;
        nCycle++;
        if(nCycle >= 16)
        {
          nCycle = 0;
        }
      }
    }
   
    // Thats it, now make some music and if its good feel free to post it here -
    // http://rcarduino.blogspot.com/2012/08/the-must-build-arduino-project-illutron.html
    // If its really good I will add it as an option in the source code guaranteeing your future fame and fortune.
   
    // Duane B rcarduino.blogspot.com
   
  updateVisualiser();
}

void updateVisualiser()
{
  // for each channel we have an 8-bit power level - its the amplitude
  // lets divide by 4 to give 0-15
  // lets decrement each pass, if high byte set, set top led, keep the bottom led on as long as the value is > 1
  static unsigned char sRefreshDivider = REFRESH_DIVIDER;
  static unsigned char sChannelPower[CHANNEL_MAX];
 
  if(0 == sRefreshDivider)
  {
    for(unsigned char sIndex = 0;sIndex < CHANNEL_MAX;sIndex++)
    {
      sChannelPower[sIndex] = (CIllutronB::m_Voices[sIndex].getAmplitude() >> 4);
    }
    sRefreshDivider = REFRESH_DIVIDER;
  }
 
  // this is ok for a demo, but in anything more sophisticated we would want faster updates using direct port access.
  digitalWrite(CHANNEL0_LED,sChannelPower[0]);
  digitalWrite(CHANNEL1_LED,sChannelPower[1]);
  digitalWrite(CHANNEL2_LED,sChannelPower[2]);
  digitalWrite(CHANNEL3_LED,sChannelPower[3]);
 
  for(unsigned char sIndex = 0;sIndex < CHANNEL_MAX;sIndex++)
  {
    if(sChannelPower[sIndex]>0)
      sChannelPower[sIndex]--;
  }
 
  sRefreshDivider--;
}


Hackscribble

#3
May 04, 2014, 07:34 pm Last Edit: May 04, 2014, 07:43 pm by Hackscribble Reason: 1
Hi Calin

OK, looks like the Arduino code uses different pins for LEDs compared with the picture on that original project website.  If you have your LEDs on digital pins 7, 8, 12 and 13, then that matches the program.  

Sorry if you have already checked this, but do you have all the LEDs the correct way round?  And what happens if you swap the working LEDs for the non-working ones?

Also, could you clarify exactly when (if at all) you get sound out?  What do you do to make it happen?  And does it sound anything like what you expect based on the video on the website?

EDIT
Question about the program.  The code includes a bunch of other files (e.g. below).  Have these been downloaded as well as the main program and they all compile OK with no error messages?

Code: [Select]

#include "IllutronB.h"
// Include the wavetables, you could add your own as well
#include "sin256.h"
#include "ramp256.h"
#include "saw256.h"
#include "square256.h"
#include "noise256.h"
#include "tria256.h"


Cheers

Ray
Hackscribble.  Writing about making things
hackscribble@outlook.com

CalinB

Ok, first of all I have tried switching the non-functioning LEDs with the working ones and I get the same results. Secondly, the LEDs are connected to PWM pins 10,11,12,13 (from right to left); there is another connection on PWM pin 6 that leads to a resistor and the 2 capacitors and finally, the 2 potentiometers are connected to pins A0 and A1.

When I power up the board, I get no sound and I only get the 2 LEDs flashing. If I touch them, I get a low output of what it is supposed to be for one of them but a completely unrelated sound for the other. I have to touch them both in order to get sound from both of them.

I have downloaded all of the necessary libraries and I get no errors upon compiling.

Thanks,
Calin

CalinB

#5
May 04, 2014, 08:02 pm Last Edit: May 04, 2014, 08:10 pm by CalinB Reason: 1
Update: I have switched PWM pins 10 and 11 with 7 and 8 and now all of the LEDs are flashing  :D

However, I get no sound output unless I touch the leeds of the LEDs. When I do, the sound is not as in the video and is very faint. Also, I seem to get no response from messing with the potentiometer knobs.

P.S.: I don't know how big of a deal it is, but for one of the capacitors I put a 0.22uF one instead of 0.1uF as it is listed in the diagram.

Cheers,
Calin

Hackscribble

In that position in the circuit, the 0.22uF capacitor should be OK.  What have you connected the audio output to?
Hackscribble.  Writing about making things
hackscribble@outlook.com

CalinB

I have connected the output to a stereo cable soldered to a mother jack. The left and right channels are connected to one of the capacitors, while the ground well, it goes to ground. As for the speakers, I'm currently using a Philips az2558 system. I know it's kind of big for the small voltage that the arduino alone is outputting but I do get sound when I touch the leeds of the LEDs.


Hackscribble

Hi Calin

Sometimes, if you get an output only when you touch a component or lead, it indicates that there is a problem with the ground connections.  The weird thing here is that, from the schematic on that website, the LEDs have no connection at all with the audio output to your amplifier. 

I guess you have tried touching other parts of the circuit to see if that also starts the output working?

Cheers

Ray
Hackscribble.  Writing about making things
hackscribble@outlook.com

CalinB

I have tried touching other components but there wasn't any difference.. I have rewired the whole thing and have given the LEDs, the potentiometer and the capacitor setup their separate ground pins. Still, I get no output and now only 2 of the LEDs produce sound when I touch them. The potentiometers are still not working. Here are some photos of the new setup: https://drive.google.com/folderview?id=0B-QIGqnDA9j2RWNSOHNvdDBmUGs&usp=sharing



P.S.: The pins of the potentiometers weren't fitting through the holes of the breadboard so I used pliers to make them smaller. I have included a photo of the modified pins in the link. I hope this doesn't affect anything.


Kind Regards,
Calin Baciu

Hackscribble

Hi Calin

It might be worth breaking down the circuit into chunks and testing each with simple Arduino programs, to track down possible hardware problems.

So, for example, write a short program or modify one of the Arduino example programs to flash each of the LEDs off and on.  Disconnect all the other components from the Arduino (i.e. the potentiometers and the audio output) while doing this.

If this works OK for all LEDS, then reconnect each of the potentiometers in turn and make sure the LEDs still work ok.

Then use the Arduino example program ReadAnalogSerial to check that you are getting a changing (and sensible) reading from each potentiometer.

If this works ok, reconnect the audio output and retest LEDs and potentiometers.  Then use one of the tone() example programs to see if you get audio through to your amp.

Cheers

Ray
Hackscribble.  Writing about making things
hackscribble@outlook.com

CalinB

Hi again,

I have tested the capacitors with a multimeter - they work fine.
I have tested the potentiometer using an led fade program while checking the serial monitor - they work fine.
I have borrowed small speakers to see if it is a matter of voltage - it isn't, it's still not working.

Now I can't upload any other programs on arduino as I've started receiving this error when I try to do so:
avrdude: stk500v2_ReceiveMesage(): timeout arduino

However, I've noticed that the code does not define an output for the signal. It does say that pin 6 should be the output but it is not in the code. Maybe I should also trim the code as it contains a lot of "optional coding" that could cause the issue.

Thank you,
Calin Baciu

Hackscribble

Hi Calin

The output pin may be defined in the Illustron.b or Illustron.cpp.  Maybe check in those to see if it is (and what value), as well as defining in your code. 

Also, before that, there should be a sample program in the Arduino IDE or on this website for the tone() function.  If you can find one, and configure it to use your audio output pin, it may help to test the circuit between the Arduino and amplifier.

All the best

Ray
Hackscribble.  Writing about making things
hackscribble@outlook.com

Go Up