Show Posts
Pages: [1] 2 3
1  Using Arduino / LEDs and Multiplexing / Help needed with 10 LED driver lm3914 on: October 18, 2012, 12:14:47 am
Hello im making a led vu meter with a lm 3914 IC. Here is the datasheet http://www.ti.com/lit/ds/symlink/lm3914.pdf.
Im doing the 1st schematic in the datasheet. Im using the 2 formulas right below the schematic for the calibration and LED brightness
My R1 is 660 making Iled=18mA (2x330 in series, because i dont have a 660 resistor) and R2 is 82 ohms (330 220 220 in parallel). The range of the leds is about 1.6 volts. Im powering it with a 9v wall thing
Im planning to wire it between my computer and my 2.1 speakers. Today i figured out the resistor values and tested it with the pc cranked to the max and all leds blinked yey. so far so good but as i was watching the leds blink, it must have been working for 2-3 minutes and when i turned it off the chip was really hot. I checked for shorts, bad wiring and whatever. nothing found. Then i read in the datasheet, that Vled should be < V+ and in my case its the same. I checked the internet for other schematics and all of them were powering the leds from the source that is powering the chip without any dividers resistors or whatsoever. Can someone hint me what im doing wrong? I even tried adding the 10uF cap like the dotted line says, it didnt help.
2  Community / Exhibition / Gallery / Re: Arduino based MIDI controller. on: October 17, 2012, 09:04:37 pm
ok pics time ! smiley
In the beginning it started with 2 buttons that via the arduino usb cable and a software Serial2Midi converter, it performed simple MIDI on off
http://s15.postimage.org/w6vqxfsex/185399_4098535596116_2109559659_n.jpg

Then it grew up to be 1 multiplexer wired with 6 pots and those same 2 buttons
http://s11.postimage.org/i7czkuvo1/599381_4146699280178_1730773599_n.jpg

Then the desire of more buttons and knobs came and a diy arduino shield was born (Such a genious board arduino is, such  a stupid error to make the spacing awkward :-/. With longer headers and some crafty bending its fixable.)
http://s14.postimage.org/emblrhl74/SDC10382.jpg

This is the final layout, box is made from 3mm thick very dense fibre board i found on the street. (Someone had thrown away his kitchen drawers and stuff)
http://s12.postimage.org/g0hxos04c/SDC10390.jpg

Everything in place ready for soldering. It looks like a mess, but i prefer to call it controlled chaos smiley-grin
http://i.imgur.com/8gA8d.jpg

Close up of the circuitboard - 10 debounce circuits for the 10 buttons
http://i.imgur.com/rtifq.jpg

Everything soldered in place smiley
http://i.imgur.com/SH0O7.jpg

And the box closed.

http://i.imgur.com/XLRsD.jpg

Here is the code for the midi controller.
http://pastebin.com/hY8PVhED

Here is the debug code for the controller, helps alot.
http://pastebin.com/wdDbidAJ

If someone wants the schematic, let me know.
I know everything is not fancy and shiny, but hey thats my first box i made and the first arduino project i made.
Many thanks to Addidis for helping me go through all of this smiley
http://www.jeselectronics.com/

ps. sorry for the pics being as url but they are too big.
3  Community / Exhibition / Gallery / Re: Arduino based MIDI controller. on: October 16, 2012, 04:21:39 pm
thank you smiley
I have some pics of the building process, but i dont really know how and where to make a blog. If i get some free time (university started) i will put some pictures here smiley
4  Community / Exhibition / Gallery / Arduino based MIDI controller. on: October 15, 2012, 03:02:43 pm
Hi people, i finished my first project!  smiley-razz Its an arduino based midi controller. 3x8 channel multiplexers fed into the arduino and with a usb midi converter its connected to the PC. Arduino is powered via the usb cable the converter uses.
Heres a video :
If you want i could add the code and the schematics!
5  Topics / Education and Teaching / Where should i look; request guidance for learning. on: September 30, 2012, 07:34:07 pm
Hi people, i started playing guitar when i was 13. As every guitarist i love effect pedals  smiley. Then i decided to start making electronic music. All the VSTs amazed me, envelopes, filters, oscillators.
My question is, in which field should i look into to learn how to manipulate sound waves in hardware with real parts, like understanding how an equaliser is built (how it works, what happens if i replace a resistor from 10k to 100k.), like understanding an oscillator - sine triangle square sawtooth. Filters lowpass highpass, bandpass. Distortion, modulation. all of those things im very interested in. Its easy in software you just click click click, but i want to learn to make it. Bad news is if i want to learn this and see what im doing - i should get an oscilloscope and they are a bit expensive.
Im new in electronics, but im learning fast. I have my arduino from 1 month and i almost made my first big project - a MIDI controller DJ mixer with the help of a friend of course. (im pretty deep in the MIDI things, but ask me to make something else and im blind).
6  Using Arduino / Project Guidance / Re: Trouble with hardware debouncing on: September 19, 2012, 02:13:08 pm
Im adding a picture of how i did the wiring made in Fritzing. The IC is the multiplexer. Here is how it should be http://www.labbookpages.co.uk/electronics/files/debounce/debounceCircuit.png
The resistor connected to + is 47k and the resistor under the diode is 10k
7  Using Arduino / Project Guidance / Trouble with hardware debouncing on: September 19, 2012, 10:02:28 am
Hi, im making a hardware debounce for a button. I read about hardware debouncing and i made this debouncing circuit with a pulldown resistor.

Code:
5v                GND
|                  |
|           47k resistor
|--0.1uf cap-------|
|---button---------|------Pin on a Multiplexer-------Arduino

Im not using a schmitt trigger inverter, because im not sure i need it, i read that arduino has inverters on every pin.
As i was testing it i pushed it around for 5-10 minutes and the button stopped working.
Then i found a tutorial for hardware debouncing, this one http://www.labbookpages.co.uk/electronics/debounce.html
It says that the fast discharging of the capacitor can burn the buttons legs and it should be discharged via R2. So i thought i have burned them up with my circuit because the capacitor is not discharging through another resistor.
So i wired up another button like the tutorial said using R1=47k R2= 10k C1=0.1uf and D1=1N4004 (without the inverter) giving me around 6ms until it reaches logic 1 and used this code
Code:
#include <AnalogMuxDeMux.h>
AnalogMux amux(13, 12, 11, A0); // Define Mux
#define NO_PINS 8
int lastbuttonState =1;
void setup()
{
  pinMode (13, OUTPUT); // Selector pin
  pinMode (12, OUTPUT); // Selector pin
  pinMode (11, OUTPUT); // Selector pin
  pinMode (A0, INPUT);  // Mux Common OUTPUT
  Serial.begin(9600);
}
void loop()
{
  // Read the values from the button
  int sw = amux.AnalogRead (1) / 1023;
  if (sw != lastbuttonState)
  {
    if (sw == 0)  
    {
      Serial.print("pressed");
      Serial.println(sw * 127);
    }
  }

  // Check to see if button is released

  if (sw == 1 && lastbuttonState == 0)
  {
    Serial.print("depressed");
    Serial.println(sw * 127);
  }
  lastbuttonState=sw;
}

The results in serial monitor for 1 press were

Code:
pressed0 /This is when i pressed it
depressed127 / Everything else from here is when i depressed it
pressed0
depressed127
pressed0
depressed127
pressed0
depressed127

Can anyone help me debounce it properly, tell me where my mistakes are and what should i do.
Do note im fairly new to Electronics. Thank you in advance.
PS. Im making hardware debounce, because im making a MIDI controller mixer and the built up software delay would eventually lead to big latency and it not responding on time.
8  Using Arduino / Programming Questions / Re: Having trouble with an if statement on: August 29, 2012, 11:39:24 am
omg im stupid im sorry i meant vHigh not vHigh1. NVM though a friend told me to add the command that saves the state in the if statements big brackets (where serial.write is)

The correct fix is the 1st guy's answer smiley thank you guys!
9  Using Arduino / Programming Questions / Re: Having trouble with an if statement on: August 29, 2012, 11:10:36 am
1. Yes the if statements are not triggering the Serial.write
2. Note in my code
Code:
  int vHigh = amux.AnalogRead(2) / 8; // Library command to read the pot from the pin on the mux - amux.AnalogRead(pinnumber)
  int vMid = amux.AnalogRead(3) / 8;
  int vBass = amux.AnalogRead(4) / 8;
  int vHigh1 = amux.AnalogRead(5) / 8;
  int vMid1 = amux.AnalogRead(6) / 8;
  int vBass1 = amux.AnalogRead(7) / 8;
Serial.write(vHigh) // or vMid or vBass according to the if statement
the if statement for vHigh is just a simple if the value has changed no matter how - print the value of the pot.
Whatever (except vHigh) pot i turn nothing is getting printed. When i turn the vHigh pot it prints its value from 0 - 127
3.
Code:
1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
26
27
28
29
30
29
30
31
32
33
32
33
34
35
36
37
38
39
40
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
116
117
118
119
120
121
122
123
124
125
126
127
126
127
126
125
124
125
124
125
124
123
122
121
120
119
118
117
116
117
116
115
114
115
114
113
112
113
112
111
110
109
108
107
106
105
104
105
104
103
104
103
104
103
104
103
102
101
102
101
100
99
98
97
96
97
96
95
96
95
96
95
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
75
76
75
74
73
72
71
70
69
68
67
66
65
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
45
44
43
42
41
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
2
1
0
10  Using Arduino / Programming Questions / Re: Having trouble with an if statement on: August 29, 2012, 10:36:54 am
If i write Serial.println in the if statements nothing is being read.
If i write them outside the if statements its just 0-1023 / 8 (0-127)
For high 1 its being read 0 - 127
11  Using Arduino / Programming Questions / Re: Having trouble with an if statement on: August 29, 2012, 09:15:46 am
When i replace all Serial.write with Serial.println, it prints the buttons with their values - either 0 or 1. When i rotate the pots it prints only for pot1 (vHigh, in the code its right after the buttons). When i rotate all other pots nothing happens (im running them through a multiplexer, there is no problem with the multiplexer. If i make all the if statements like the one for pot1 - all pots work, though not the way i want them to.)
12  Using Arduino / Programming Questions / Re: Having trouble with an if statement on: August 29, 2012, 08:01:26 am
Yes i know i suck at coding, i dont know how to use properly arrays. im sorry its so long :/

EDIT: I formated the code so its easier.
13  Using Arduino / Programming Questions / Re: Having trouble with an if statement on: August 29, 2012, 07:56:56 am
 smiley-roll-sweat Still not working  smiley-cry. It has an LED to monitor the incoming signal FROM the arduino so when i power it up it flashes, so the first time it loops it works, though when i rotate it fast or slow, doesnt send data. Im starting to think i should not Serial.write(analogRead(ofthepot)) but something modified. I thought something happened to the hardware so i changed it to the buggy state (only vHigh!=vHighState) and it works, tho the sent data is with values 1 2 1 2 3 2 3 4 3 4 5 6 5 6 5 6.......
And im thinking i should use unsigned int or something for the analogread, because if i rotate it from 127 towards 0 it would give a negative value (pot - pot before)

Here im putting the code with the things you people said.

Code:
#include <AnalogMuxDeMux.h>
#define THRESHOLD 2
AnalogMux amux(13, 12, 11, A1);
#define NO_PINS 8
int vHigh = 0;
int vHighState =0;
int HighEQ = 0;
int vMid = 0;
int vMidState =0;
int MidEQ = 0;
int vBass = 0;
int vBassState = -2*THRESHOLD;
int BassEQ = 0;
int vHigh1 = 0;
int vHigh1State= -2*THRESHOLD;
int HighEQ1 = 0;
int vMid1 = 0;
int vMid1State= -2*THRESHOLD;
int MidEQ1=0;
int vBass1 = 0;
int vBass1State= -2*THRESHOLD;
int BassEQ1=0;
int lastbuttonState =0;
int lastbuttonState1 = 0;
byte CC=176;
byte ON=144;
byte OFF=128;
byte switch1=1;
byte switch2=2;
byte pot1=3;
byte pot2=4;
byte pot3=5;
byte pot4=6;
byte pot5=7;
byte pot6=8;
byte on=127;
byte off=0;

void setup()
{
  pinMode (13, OUTPUT);
  pinMode (12, OUTPUT);
  pinMode (11, OUTPUT);
  pinMode (A1, INPUT);
  Serial.begin(31250);
}

void loop()
{

  int sw = amux.AnalogRead (0) / 8;
  int sw1 = amux.AnalogRead(1) / 8;
  int vHigh = amux.AnalogRead(2) / 8;
  int vMid = amux.AnalogRead(3) / 8;
  int vBass = amux.AnalogRead(4) / 8;
  int vHigh1 = amux.AnalogRead(5) / 8;
  int vMid1 = amux.AnalogRead(6) / 8;
  int vBass1 = amux.AnalogRead(7) / 8;


  if (sw != lastbuttonState)
  {
    if (sw == 127)  {
      Serial.write(ON);
      Serial.write(switch1);
      Serial.write(on);
    }
  }

  if (sw == 0 && lastbuttonState == 127)
  {
    Serial.write(OFF);
    Serial.write(switch1);
    Serial.write(off);
  }
  lastbuttonState=sw;

  if (sw1 != lastbuttonState1)
  {
    if (sw1 == 127)  {
      Serial.write(ON);
      Serial.write(switch2);
      Serial.write(on);
    }
  }
  if (sw1 == 0 && lastbuttonState1 == 127)
  {
    Serial.write(OFF);
    Serial.write(switch2);
    Serial.write(off);
  }
  lastbuttonState1=sw1;

  if (vHigh != vHighState)
  {
    Serial.write(CC);
    Serial.write(pot1);
    Serial.write(vHigh);
  }
  vHighState=vHigh;

  MidEQ = vMid - vMidState;
  MidEQ = abs(MidEQ);

  if (MidEQ > 2)
  {
    Serial.write(CC);
    Serial.write(pot2);
    Serial.write(vMid);   
  }
  vMidState=vMid;

  if (abs(vBass-vBassState) > THRESHOLD)
  {
    Serial.write(CC);
    Serial.write(pot3);
    Serial.write(vBass);   
  }
  vBassState=vBass;

  if (abs(vHigh1 - vHigh1State) > THRESHOLD)
  {
    Serial.write(CC);
    Serial.write(pot4);
    Serial.write(vHigh1);   
  }
  vHigh1State=vHigh1;

  if (abs(vMid1 - vMid1State) > THRESHOLD)
  {
    Serial.write(CC);
    Serial.write(pot5);
    Serial.write(vMid1); 
  }
  vMid1State=vMid1;

  if (abs(vBass1 - vBass1State) > THRESHOLD)
  {
    Serial.write(CC);
    Serial.write(pot6);
    Serial.write(vBass1);
  }
  vBass1State=vBass1;



}


14  Using Arduino / Programming Questions / Re: Having trouble with an if statement on: August 29, 2012, 06:07:51 am
Tried separated, still doesnt work  smiley-eek
Am i approaching it the wrong way? Any ideas?
15  Using Arduino / Programming Questions / Re: Having trouble with an if statement on: August 28, 2012, 06:20:30 pm
hm... replaced it like you said for all the pots, still same thing Serial.write isnt triggered... :/


Also i got this from the reference site
 
Code:
Warning
Because of the way the abs() function is implemented, avoid using other functions inside the brackets, it may lead to incorrect results.
abs(a++);   // avoid this - yields incorrect results

a++;          // use this instead -
abs(a);       // keep other math outside the function

How do i make it like this?
Pages: [1] 2 3