Show Posts
Pages: [1]
1  Development / Other Software Development / RGB leds animation library on: December 08, 2013, 10:49:19 am
Hi everybody!
I've developed a a CSS3 inspired, keyframe based rgb light animation library  for controlling RGB leds with Arduino.
It basically allows you to program custom RGB light patterns by specifying a duration and what color to display in a specific percentage of that duration, without caring about transitions between the colors. I've put a small demo video here  https://vimeo.com/79962595 and the library comes with quite a lot of examples.

I'd love to hear any suggestion and comments about it!
Didn't actually do it for christmas... but I guess it can come in handy these days smiley

It's here on github https://github.com/fabricacode/arduinoLightAnimation

Cheers!
2  Using Arduino / Microcontrollers / Change PWM frequency on: April 28, 2013, 11:39:27 am
Hi everybody!

In my program I need a very slow PWM signal where I can change the duty cycle, and since in the meanwhile I want to keep reading serial data I was planning to use the PWM function of the atmega.

I've been reading around how to do it
http://www.electronicsblog.net/atmega8-pwm-controlfrequencypolarityduty-cycle-example-tutorial-with-program/
http://www.nunoalves.com/classes/spring_2012_cpe355/cpe355-02-f.pdf

and so far I succeed in changing PWM duty cycle by changing OCR2 but I had no success in shifting down the frequency.
I have an arduino ng with atmega8, the pwm signal is on pin 9 and below there's the code for changing the PWM timing options

thanks!


Code:

void setup()
{
  TCCR2=0x6F; //1024 prescaler
  OCR2=0x1A; // 10% duty cycle -> 256/10=25,6 26 in hex = 1A;
}

3  Using Arduino / LEDs and Multiplexing / Re: Piezoelectric sensors and 4051 mux on: March 21, 2013, 11:59:51 am
Hi!

Yes, that is something I'll try, as soon as I receive the 5v Zener diodes I've ordered. But I was displaying the signals while trying the system and the strange thing is that with some piezos the signal would show up in other channels even though I hit it lightly... But I'm gonna write back after I get those diodes...



4  Using Arduino / LEDs and Multiplexing / Re: Piezoelectric sensors and 4051 mux on: March 21, 2013, 10:40:31 am
ok, thanks for your advice...
5  Using Arduino / LEDs and Multiplexing / Re: Piezoelectric sensors and 4051 mux on: March 17, 2013, 01:48:36 pm
Hi thanks,

so ok, I took away delay(delSetMuxAddress) and added a decoupling cap (0.01u and 1u) as close as possible to the supply/ground pins of the 4051 but still when I hit one piezo over some strenght other values are affected... and I also noticed that this happens differently with different mux inputs. Some are more robust (I need to hit really strong for having other signals affected) while with others a much lighter hit would affect other signals

 I'm planning to put a 5v zener diode for not to get from the piezo voltages above that value. Could this be the issue?

Quote
I doubt it.

this is the rest of the code

Code:
//4051 mux piezo test

//int delSetMuxAddress = 1;
int delReadAnalog = 8;

int sensorValue[8];        //4 values get from the mux

void setup() {
  // initialize serial communications at 9600 bps:
  for (int i=0; i<4; i++) sensorValue[i] =0;
  for (int i=0; i<10; i++) pinMode(i, OUTPUT);
 
  Serial.begin(9600);
}

void loop() {
  // read the analog in value:
 
 
  for (int i=0; i<4; i++)
  {
    setMuxAddress(i);

    sensorValue[i] = analogRead(A0);
    delay(delReadAnalog);
 
    sensorValue[i+4] = analogRead(A1);
    delay(delReadAnalog);
   
  }
 

     
  Serial.print(sensorValue[0]);
  Serial.print('*');
  Serial.print(sensorValue[1]);
  Serial.print('*');
  Serial.print(sensorValue[2]);
  Serial.print('*');
  Serial.print(sensorValue[3]);
  Serial.print('*');
  Serial.print(sensorValue[4]);
  Serial.print('*');
  Serial.print(sensorValue[5]);
  Serial.print('*');
  Serial.print(sensorValue[6]);
  Serial.print('*');
  Serial.print(sensorValue[7]);
  Serial.println();



   
               
}

void setMuxAddress(int var)
{

  digitalWrite(2, bitRead(var, 2));
  //delay(delSetMuxAddress);
  digitalWrite(3, bitRead(var, 1));
  //delay(delSetMuxAddress);
  digitalWrite(4, bitRead(var, 0));
  //delay(delSetMuxAddress);
}


I use the serial print for displaying the signals with an external software.. 
6  Using Arduino / LEDs and Multiplexing / Piezoelectric sensors and 4051 mux on: March 17, 2013, 11:39:41 am
Hi everybody!

I'm buliding a drumpad with piezoelectric sensors, which I know is a really popular project, but I still have problems with multiplexing: sometimes (mainly when the hit is over a certain strenght) values from a piezo influence the others values read from the same mux

This is my setup

4 piezo with 1M res in parallel connected to the first 4 inputs of a 4051 mux, other mux inputs are grounded

I have 2 circuits like the one above, each mux's output goes to an arduino analog pin.

3 digital pins from the arduino go to both address pin of the muxs

all the unused analog arduino pin are grounded

and these are relevan parts of my arduino code. I tried to play with delays in between different analogRead and also between different writing to the address pins of the mux, but no success...

Code:
  for (int i=0; i<4; i++)
  {
    setMuxAddress(i);

    sensorValue[i] = analogRead(A0);
    delay(delReadAnalog);
 
    sensorValue[i+4] = analogRead(A1);
    delay(delReadAnalog);
   
  }

void setMuxAddress(int var)
{

  digitalWrite(2, bitRead(var, 2));
  delay(delSetMuxAddress);
  digitalWrite(3, bitRead(var, 1));
  delay(delSetMuxAddress);
  digitalWrite(4, bitRead(var, 0));
  delay(delSetMuxAddress);
}





Thanks in advance!
Pages: [1]