Show Posts
Pages: 1 2 [3] 4 5 ... 26
31  Using Arduino / Project Guidance / Re: How to control simple 10 LED Bar Graph with MAX7219? on: January 19, 2014, 07:31:17 pm
Got it fixed!
I thought caps were option on chip's VCC line, but I guess it's necessary. After I added 10uF and .1uF caps, it started to work.

Edit: Oops, it was actually Rset resistor value that got it working, I didn't realize I was using 10K resistor and replaced it with 33K at the same time as added caps.  More LEDs are lit, large resistor value needed. With 10K resistor I'm able to light up around 4 LEDs before chip resets itself and it all goes out...
I'm still having small issue because my LED bar is has both Green and RED LEDs, so greens are bright, but reds are dim smiley-sad  But I guess there's nothing I can do about this other than using second MAX7219 chip to control REDs, and that would be a waste...
32  Using Arduino / Project Guidance / Re: How to control simple 10 LED Bar Graph with MAX7219? on: January 19, 2014, 06:59:50 pm
Got it working, well kind of smiley I do have weird issue and not sure why it's happening.
I can light up any of the 10 LEDs directly but for some reason I cannot light up more than in a row smiley-sad  When I try to light up several they blink for a second and go out.
I'm attaching schematic.
Code:
//We always have to include the library
#include "LedControl.h"

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(9,8,7,1);

void setup() {
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,15);
  /* and clear the display */
  lc.clearDisplay(0);
  lc.setScanLimit(0,1);
    
}

void loop() {
  //  lc.setLed(0,0,1,true);  // THIS WORKS
  // lc.setRow(0,0,B10000000); // THIS WORKS
 // lc.setRow(0,0,B00001000); // THIS WORKS
 lc.setRow(0,0,B10001000); // THIS DOESN'T WORK
}
33  Using Arduino / Project Guidance / Re: How to control simple 10 LED Bar Graph with MAX7219? on: January 19, 2014, 04:35:57 pm
I wired all cathodes together to GND. Connected MAX's Digita0-7 to LED1-8 and SEGA-B to LED9-10...

Well then you are not following the wiring for a MAX7219 and will get exactly nowhere.

If you have 10 LEDs, you connect the cathodes of the first eight to the digit 0 drive line, and the cathodes of the last two to the digit 1 drive line.  You connect the anodes of the first eight to the respective eight "segment" drive lines and the anodes of the last two to the first two segment drive lines.

You now have your matrix.  You set the current limit for 20 mA (or less if it turns out to be too bright)with a 27k resistor, and in programming, set the scan limit register to 1 - which means it scans only the two "columns" you have wired.

Brilliant! I didn't think of making a matrix out it, thank you very much! I will give it a try! smiley
34  Using Arduino / Project Guidance / How to control simple 10 LED Bar Graph with MAX7219? on: January 19, 2014, 04:02:58 pm
I'm trying to figure out how to control any of individual LEDs in the simple bar graph (datasheet here).
Bar graph is essentially 10 individual LEDs, it's not in any kind of matrix configuration. It seems that LedControl library meant to control matrix or 7 segment displays, but I can't figure out how to address simple LEDs...
I wired all cathodes together to GND. Connected MAX's Digita0-7 to LED1-8 and SEGA-B to LED9-10...
35  Using Arduino / General Electronics / Re: MCP4241 Shutdown Pin on: January 15, 2014, 08:58:01 am
VIL means voltage input low.  So its active low.

All (voltage controlled) logic families have VIL/VIH/VOL/VOH specs, an input has
to be below VIL to read low, above VIH to read high.

[also I just checked the datasheet, the signal is clearly active low as it has a line
over the top, which means active-low or negative-logic - this is a standard boolean
algebra convention]
Thank you Mark!  I wasn't sure what active-low condition is.
Anyway I figured it out.
Put pulldown resistor between shutdown pin and GND. Then change pin to LOW to shut down, or to high to turn it back on.
36  Using Arduino / General Electronics / Re: MCP4241 Shutdown Pin on: January 12, 2014, 10:19:20 am
Unfortunately I don't understand much of it.
Can someone who has more experience than me please help me? smiley
I just want to Shutdown chip. What do I need to do to accomplish this?
Set SHDN pin (12) to HIGH or LOW or leave floating?
What kind of command bit I need to send via SPI?
I'm using this function to control chip:
Code:
void writeMCP4241(byte address, byte value) {
  digitalWrite(SlaveSelect, LOW);
  SPI.transfer(address << 4);
  SPI.transfer(value & 127);
  digitalWrite(SlaveSelect, HIGH);
}
37  Using Arduino / General Electronics / MCP4241 Shutdown Pin on: January 12, 2014, 12:00:50 am
Quick question. I'm working with MCP4241 digital pot IC and it has shutdown pin which disconnects one of the terminals from wiper. But I have no idea how to activate it. Normally I have it connected to VCC (HIGH) but I tried connecting it to Ground  (LOW) and it didn't seem to do anything. It's not immediately clear to me from datasheet how to activate it (or I didn't find it).
Quote
When the SHDN pin is forced active (VIL):
• The P0A and P1A terminals are disconnected
• The P0W and P1W terminals are simultaneously
connect to the P0B and P1B terminals
38  Using Arduino / Programming Questions / Re: Code for logarithmic volume control on: January 11, 2014, 07:31:03 pm
1. Subtract 15 from everything.
2. Stop before 128. 0x7F, 0b01111111.  7 bits is 0 to 127.

Thanks! I'll give it a try. Btw looks like there's built in function to check for inf and Nan: isinf() is isnan().
39  Using Arduino / Programming Questions / Re: Code for logarithmic volume control on: January 11, 2014, 03:00:59 pm
or
Code:
for (int i=0; i< 255; i++)
  {
    float y = 255- a * log(255-i);  // more dynamic in the end
    Serial.print(i);
    Serial.print('\t');
    Serial.println(y);
  }
I finally got digital pot (10K, 128 steps) and I have one more question. How do I avoid "inf" and "nan" values?  Here's my code adapted to 7 bit Digital Pot...
Code:
void volUp(){
  float scale=64/2.77;
 for (int i=0;i<128;i++ ) {
  float y=127- scale*log(127-i);  // more dynamic in the end
  Serial.print (i);
  Serial.print ('\t');
  Serial.println (y);
  writeMCP4241(0,y);
  delay (100);
 }
}
Code:
0 15.08
1 15.26
2 15.44
3 15.63
4 15.82
5 16.00
6 16.19
7 16.39
8 16.58
9 16.77
10 16.97
11 17.17
12 17.37
13 17.57
14 17.78
15 17.98
16 18.19
17 18.40
18 18.61
19 18.82
20 19.04
21 19.25
22 19.47
23 19.69
24 19.92
25 20.14
26 20.37
27 20.60
28 20.83
29 21.07
30 21.30
31 21.54
32 21.78
33 22.03
34 22.28
35 22.53
36 22.78
37 23.03
38 23.29
39 23.55
40 23.82
41 24.08
42 24.35
43 24.63
44 24.90
45 25.18
46 25.47
47 25.75
48 26.05
49 26.34
50 26.64
51 26.94
52 27.25
53 27.56
54 27.87
55 28.19
56 28.51
57 28.84
58 29.17
59 29.51
60 29.85
61 30.20
62 30.55
63 30.91
64 31.27
65 31.64
66 32.02
67 32.40
68 32.79
69 33.18
70 33.59
71 34.00
72 34.41
73 34.84
74 35.27
75 35.71
76 36.16
77 36.61
78 37.08
79 37.56
80 38.04
81 38.54
82 39.05
83 39.57
84 40.10
85 40.64
86 41.20
87 41.77
88 42.35
89 42.95
90 43.57
91 44.20
92 44.85
93 45.52
94 46.21
95 46.93
96 47.66
97 48.42
98 49.20
99 50.01
100 50.85
101 51.72
102 52.63
103 53.57
104 54.56
105 55.58
106 56.66
107 57.78
108 58.97
109 60.22
110 61.54
111 62.94
112 64.43
113 66.03
114 67.74
115 69.59
116 71.60
117 73.80
118 76.23
119 78.96
120 82.04
121 85.60
122 89.81
123 94.97
124 101.62
125 110.99
126 127.00
127 inf
128 nan
Also not sure how do I get 0 value in the beginning? smiley
40  Using Arduino / General Electronics / Re: Can I use 74AHC125 as shift register to control LED bar graph? on: January 07, 2014, 10:38:16 am
Yes.

If you've got 100+ of them you can build them into flip-flops and construct a few shift registers.

A proper shift register chip will be much smaller though.

Haha, ok so I'll take is a "no" smiley  I meant to ask if I can use single 74AHC125 for the purpose...
Thanks.
41  Using Arduino / General Electronics / Can I use 74AHC125 as shift register to control LED bar graph? on: January 07, 2014, 10:30:46 am
I realize this is probably really dumb question, but I'm just getting started with shift registers. It happens that I have 100+ of 74AHC125 chips which I use for shifting logic levels (from 5V to 3.3V).  Can these ICs also be used as shift register (i.e. serial to parallel) to control LED array (i.e. bar graph) by using just 2 digital pins from Arduino?
42  Using Arduino / Audio / Re: volume control w/ remote (which POT?) on: January 06, 2014, 09:01:06 pm
Thank you so much!  I'm getting SPI based pot. I guess I'll have to manage logarithmic fade in the code...
43  Using Arduino / Programming Questions / Re: Code for logarithmic volume control on: January 06, 2014, 03:08:21 pm
So you're using the pot as a voltage divider then.
I'd go with 10K on that.


Sounds good! Thank you!
44  Using Arduino / Programming Questions / Re: Code for logarithmic volume control on: January 06, 2014, 03:03:10 pm
Are you feeding the audio thru the pot to divide it down?
Then 1.5V/45000 = 33uA, not much load on the source.

Are you instead using it to divide down 5V as reference for something else? Might go for lower value to get a little more current flow and perhaps be less susceptible to noise.
I'm trying to control volume of audio signal coming from computer monitor and into powered speaker.  Basically I have TiVo that sends AV signal via HDMI into 30" monitor. Monitor separates audio from the signal and outputs it via line-out (3.5mm cable).  Since neither monitor or speaker have remote control I want to build one with Arudino.
45  Using Arduino / Programming Questions / Re: Code for logarithmic volume control on: January 06, 2014, 02:40:00 pm
BTW Is 45K a good value for line audio control?  I wasn't sure which resistance is best for this (10K,50K or 100K)?
Pages: 1 2 [3] 4 5 ... 26