Show Posts
Pages: [1] 2
1  Using Arduino / Audio / Re: Auduino and IllutronB on: November 29, 2013, 04:41:23 am
I have looked at it closer, and it looks like IllutronB uses both Timer1 and 0
Timer0 is used for PWM output, so I guess it doesn't come in conflict with the Delay()

Would it be possible to use Timer0 as output for Auduino as well?
That way I can have the same audio output pin6 for both in the hardware

What do you think DuaneB?
2  Using Arduino / LEDs and Multiplexing / Re: MAX72XX 7 segment display LedControl on: November 28, 2013, 05:18:51 am
I have tried lots of things now, and tried to find out about "pointer scheme" and "wrap around"
I just can't figure it out

do I need another forward loop with another int?

I have changed the code to make it simpler
Code:
char text[14] = "_hello_earth_";

void scrollText(){
    for (int i = 0; i <=14; i++) {
    lc.setChar(0,0,(text[i]),false);
    lc.setChar(0,1,(text[i+1]),false);
    lc.setChar(0,2,(text[i+2]),false);
    lc.setChar(0,3,(text[i+3]),false);
    lc.setChar(0,4,(text[i+4]),false);
    lc.setChar(0,5,(text[i+5]),false);
    lc.setChar(0,6,(text[i+6]),false);
    lc.setChar(0,7,(text[i+7]),false);
    delay(delaytime);
}
    lc.clearDisplay(0);
}

I just have no idea about how to "wrap it around"
could you please give me a clue smiley
3  Using Arduino / Audio / Re: Auduino and IllutronB on: November 27, 2013, 07:27:21 pm
I have tried some different ways now
I thought I got it right, but I get a compile error

Code:
void audioOn() {
  // Set up PWM to 31.25kHz, phase accurate
  TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM00);
  TCCR0B = _BV(CS00);
  TIMSK0 = _BV(TOIE0);
}

As far as I can see, this is the way to set phase accurate on Timer0
But I get the error:
core.a(wiring.c.o): In function `__vector_16':
C:\Program Files\arduino-1.0.5\hardware\arduino\cores\arduino/wiring.c:49: multiple definition of `__vector_16'
Auduino_pin6.cpp.o:C:\Program Files\arduino-1.0.5/Auduino_pin6.ino:138: first defined here

As I understand, it doesn't like me using Timer0

What does this line do?
#define PWM_INTERRUPT TIMER0_OVF_vect
because if I change it to .......Timer0_OVF_vect, it compiles
4  Using Arduino / LEDs and Multiplexing / Re: MAX72XX 7 segment display LedControl on: November 27, 2013, 05:06:32 pm
the array is just the  line at the top,
char text[] = "hello earth";

but yes, the characters come from  a large array in the LedControl.h file

It seams like its "skipping"
this is what is scrolling : hello earth011103hello earth etc.
I have no idea why it puts in the 011103 between

wrap around sounds like a good idea

do you have a code suggestion for ho that would look?

Cheers

 

5  Using Arduino / LEDs and Multiplexing / MAX72XX 7 segment display LedControl on: November 27, 2013, 01:13:48 pm
I have a setup with a MAX7221 and 8 digits of 7 segment displays
I use the LedControl library, and it all works.
I have edited the LedControl.h file, so I can use all characters in the alphabet.

I want to have a text scrolling from left to right
I use this code:
Code:
char text[] = "hello earth"; //should be world, I know, but W doesn't really work on a 7 segment display

    for (int num = 0; num <= sizeof(text)-1; num++) {
    lc.setChar(0,7,(text[num]),false);
    lc.setChar(0,6,(text[num-1]),false);
    lc.setChar(0,5,(text[num-2]),false);
    lc.setChar(0,4,(text[num-3]),false);
    lc.setChar(0,3,(text[num-4]),false);
    lc.setChar(0,2,(text[num-5]),false);
    lc.setChar(0,1,(text[num-6]),false);
    lc.setChar(0,0,(text[num-7]),false);
    delay(600);
}


It scrolls like I want to, but between each time it scrolls, other characters are added.

don't pay attention to the minus in stead of pluss  (text[num-1])
I must have wired the digits in reverse order, but it just means that digit 0 is to the left

any suggestions?

Cheers
6  Using Arduino / Audio / Re: Help Receiving MIDI input on: November 27, 2013, 11:16:20 am
I just looked at the circuit at instructables again

try changing R1 to 5,6K, and R2 to 1,2K
that's what I use and it works on my UNO

Also, try to power it with a power supply, not the USB
7  Using Arduino / Audio / Re: Help Receiving MIDI input on: November 27, 2013, 10:50:42 am
It depends on your type of Arduino.
If you have a board, like UNO, it should work with the 6N138, I used it myself yesterday.
If you have a breadboard Arduino or something like it, I would use a 4N28 circuit.

I don't know why. It's only my experience
8  Using Arduino / Audio / Auduino and IllutronB on: November 27, 2013, 10:45:27 am
I would like to have both Auduino and IllutronB on the same device, and use the same pin for audio out.
The synths will not be running at the same time, so no mixing, but I only have one pin available.

IllutronB uses Timer 0, on pin 6 (and 5 for separated channels)
Auduino uses Timer 2, on pin 3

Has anyone tried to change this?

My device now has audio out on pin 6, for the IllutronB, so the best for me would be to "move" Auduino to that pin.
I have little understanding of Timer interrupts, but since they are both 8 bit timers, could I change the Auduino code to use
Timer 0 A, in stead of the TImer 2 B it uses originally?

Change this:
Code:
#define PWM_PIN       3
#define PWM_VALUE     OCR2B
#define LED_PIN       13
#define LED_PORT      PORTB
#define LED_BIT       5
#define PWM_INTERRUPT TIMER2_OVF_vect

To this?
Code:
#define PWM_PIN       6
#define PWM_VALUE     OCR0A
#define LED_PIN       13
#define LED_PORT      PORTB
#define LED_BIT       5
#define PWM_INTERRUPT TIMER0_OVF_vect

I understand that I can just try it, but was wondering if anyone had tried it, or if there's anything that can go wrong.

There is also this.
What would I have to do here?
Code:
void audioOn() {
  // Set up PWM to 31.25kHz, phase accurate
  TCCR2A = _BV(COM2B1) | _BV(WGM20);
  TCCR2B = _BV(CS20);
  TIMSK2 = _BV(TOIE2);
}

Cheers
9  Using Arduino / Audio / Re: Help Receiving MIDI input on: November 27, 2013, 10:16:13 am
Hi,

What Arduino setup do you have?
For some reason I can never get MIdi circuit based on 6N138 to work with "minimal/breadboard" Arduino, then I use this

But I can never get this to work with Arduino boards, so then I use the 6N138 circuit.

Also the Midi connector illustrations are from the back of the socket, not the plug.

Don't know if that helped you any
10  Using Arduino / Motors, Mechanics, and Power / Re: Speed control of a leaf blower on: October 10, 2012, 09:20:01 am
yes, you are right
I have edited the image now with the correct connection
11  Using Arduino / Motors, Mechanics, and Power / Re: Speed control of a leaf blower on: October 10, 2012, 09:08:33 am
here's a quick schematics and photo of the circuit



would it be possible to control the TRIAC with an optocoupler with a PWM pin?




12  Using Arduino / Motors, Mechanics, and Power / Re: Speed control of a leaf blower on: October 09, 2012, 07:12:17 pm
thanks for the tip
I have found high voltage LDR's up to 600V, but I don't think they are suitable for 2400W
dimmers have the same problem, most of them are for lights up to 500W
I have a router speed control that works up to 20A, but it's with a pot as well, so...

I think maybe my first idea, to turn the pot with a servo is the safest, cheapest and easiest solution, but I'm open to all suggestions
13  Using Arduino / Motors, Mechanics, and Power / Speed control of a leaf blower on: October 09, 2012, 03:33:23 pm
Hello
I have a leaf blower, 2400W, 220V (abt.11A) with a speed control.
The speed control circuit is based on a TRIAC BTA12 600B, a diode, a capacitor, a 100K resistor and a potentiometer.
It's a 490K poteniometer with a 390K resistor between the legs, I measure it to 220K

Does anybody have a good idea for how to control this circuit with an arduino?
My "safe" solution is to have a servo turn the pot back and forth, but I would like a better, less mechanical solution.

Would it be possible to use a photo resistor in stead of the pot, and an LED to control that?
I assume the 220V is running through the pot, so are there photo resistors that can take that?

I appreciate any suggestions on this
thanks in advance smiley   
14  Using Arduino / Audio / Re: Change MIDI channel on: August 21, 2012, 01:28:58 am
thanks guys smiley

Pete, that was exactly the type of "bit-wizardry" I was hoping for
It worked perfect.
I have spent a while now to go through the math to understand it, so it's been a learning experience as well.
 
15  Using Arduino / Audio / Change MIDI channel on: August 20, 2012, 08:58:25 am
I have a simple MIDI keyboard that only sends messages on channel 1
I want to use it with a EHX V256 vocoder that only receives messages on channel 16

I have built a circuit with an arduino + MIDI I/O
I would like to read the incoming MIDI message, and pass it on to MIDI out, just changing the channel number.

Any suggestions to how to do this fast enough?

I have tried with this code:
Code:
byte incomingByte;


void setup(){
   Serial.begin(31250);
}
 
void loop () {
  if (Serial.available() > 0) {   // read the incoming byte:
    incomingByte = Serial.read();
    Serial.print(incomingByte, BYTE); //debugging over midi out
   
  }
}

it reads the MIDI message, and sends it to MIDI out
so the circuit works

then I tried to change the channel with:
Code:

byte statusByte, dataByte1, dataByte2;

void setup(){
    Serial.begin(31250);
  }
 
void loop(){
  if(Serial.available() > 0) {
    statusByte = Serial.read();
    if (statusByte == 0x90){
      while(Serial.available() < 1){  //wait for dataByte1 to arrive on Serial;
   }
      dataByte1 = Serial.read();
      while(Serial.available() < 1){  //wait for dataByte2 to arrive;
   }
      dataByte2 = Serial.read();
   }
   if (statusByte == 0x90){
    playNote(0x9F, dataByte1, dataByte2);
  }
 }
}
 

  void playNote(byte cmd , byte pitch, byte velocity){
  Serial.write(cmd);
  Serial.write(pitch);
  Serial.write(velocity);
  }

With this code it reads the MIDI message and changes the channel by sending 159 (note on ch.16) as the first byte
but it can not read multiple notes (polyphony) and if the key is released too fast, it will not register it to send the note off

I would really appreciate if anybody has any suggestions on how to do this
Would the MIDI.h library handle polyphony and be faster to read/write the message? 
Pages: [1] 2