Show Posts
Pages: 1 [2] 3
16  Forum 2005-2010 (read only) / Troubleshooting / replacing resonator with crystal? on: March 03, 2008, 12:44:47 pm
i notice the modern devices clones use a resonator also.

i have a boarduino and have a problem using a max72xx that does not happen on my arduino NG and seems to be related to the serial input i have feeding the boarduino. im basically sending the arduino bytes that it uses to light up appropriate rows, leds, etc.. when i have the boarduino generated patterns itself its fine. but when i have it parse the serial data i end up with 'noise' on the display. like its occasionally missing or inserting extra commands into. this goes away when i swap it for an arduino NG.

i noticed it uses a resonator instead of a crystal and am wondering if i bought a 16mhz crystal if there was anything preventing me from swapping the resonator for it? is there a reason they are using resonators? it seems like crystals cost about the same.
17  Forum 2005-2010 (read only) / Development / Re: matriduino on: December 17, 2008, 06:42:55 pm
it should be added a 74hc164 is only good for about 40ma total current, 20ma for a single pin.

you may want to look at the tpic595
18  Forum 2005-2010 (read only) / Development / big arduinome shield group buy (max72xx / shift) on: November 07, 2008, 12:30:17 am
crossposting this for some people who won't see it on the monome site.

i'm having a large run of my arduinome shields made by 4pcb, they will be blue smiley-grin and lead free. there will be 128 available and 52 have been spoken for at the moment. everything is going to be transparent and i am not making any money off of this group purchase.

even if you don't want an arduinome it is an excellent breakout board for (1) max72xx chip (1) 164 shift register (1) 165 shift register.

mailed 1st class within the US these boards should be under $6!! shipped.

post in the monome thread, or email me. my gmail address is unsped.

thanks, and sorry for the spam  smiley-wink
19  Forum 2005-2010 (read only) / Interfacing / shifting out and shifting in with 74hc164 74hc165 on: February 12, 2008, 10:48:12 pm
i know this place is where i search for info, so maybe this will help someone out.

here is some very basic, very verbose code that shows how to set the outputs of a 74hc164 shift register, and to read the 74hc164's (8 parrallel outputs, serial input) output values using a 74hc165 shift register (8 parrallel inputs, serial output). this is the beginning of concepts you would use to read a 8x8 matrix of buttons, or even drive a 8x8 matrix of led's.

this assumes a basic understanding of what a shift register is.


//164 pins
int clearPin = 2; // enablepin
int dataPin = 3;
int clockPin = 4;

//165 pins
int inclearPin = 11; // enablepin
int indataPin = 9;
int inclockPin = 10;
int inloadPin = 12; // toggling this tells the 165 to read the value into its memory for reading

int temp = 0;

void setup() {
  //start serial

  pinMode(clearPin, OUTPUT);
  digitalWrite(clearPin, 1); // enable output, you could also tie this pin to VCC
  pinMode(dataPin, OUTPUT);
  pinMode(clockPin, OUTPUT);  

  pinMode(inclearPin, OUTPUT);
  digitalWrite(inclearPin, 0); // enable input, you could also tie this pin to GND
  pinMode(indataPin, INPUT);
  pinMode(inclockPin, OUTPUT);  
  pinMode(inloadPin, OUTPUT);

  //we want to set the 164's outputs to any combination of 1's and 0's we want
  //going to set the 164 outputs to 11101101 or on,on,on,off,on,on,off,on if you prefer, where on is 5v and off is grnd
  //1st bit
  digitalWrite(clockPin, 0);
  digitalWrite(dataPin, 1);
  digitalWrite(clockPin, 1);
  //2nd bit
  digitalWrite(clockPin, 0);
  digitalWrite(dataPin, 1);
  digitalWrite(clockPin, 1);
  //3rd bit
  digitalWrite(clockPin, 0);
  digitalWrite(dataPin, 1);
  digitalWrite(clockPin, 1);
  //4th bit
  digitalWrite(clockPin, 0);
  digitalWrite(dataPin, 0);
  digitalWrite(clockPin, 1);
  //5th bit
  digitalWrite(clockPin, 0);
  digitalWrite(dataPin, 1);
  digitalWrite(clockPin, 1);
  //6th bit
  digitalWrite(clockPin, 0);
  digitalWrite(dataPin, 1);
  digitalWrite(clockPin, 1);
  //7th bit
  digitalWrite(clockPin, 0);
  digitalWrite(dataPin, 0);
  digitalWrite(clockPin, 1);
  //8th bit
  digitalWrite(clockPin, 0);
  digitalWrite(dataPin, 1);
  digitalWrite(clockPin, 1);


// now its time to read the values that we outputted back in

void loop() {
  digitalWrite(inloadPin, 0); // read into register (tells the 165 to take a snapshot of its input pins)
  digitalWrite(inloadPin, 1); // done reading into register, ready for us to read    

  for(int i=0; i<=7; i++){ // read each of the 165's 8 inputs (or its snapshot of it rather)
  // tell the 165 to send the inputs pin state
  digitalWrite(inclockPin, 0);
  // read the current output
  temp = digitalRead(indataPin); // read the state
  // tell the 165 we are done reading
  digitalWrite(inclockPin, 1);

  Serial.print (temp);  
  Serial.println ("");
  Serial.println ("--------");

20  Forum 2005-2010 (read only) / Interfacing / Re: TLC5940 Unable to interface with Arduino on: December 09, 2008, 01:38:35 am
i don't see a bypass capacitor on the tlc5940? it may work without it, but you should have one on there. .1uf capacitor accross the 5940 vcc/gnd.
21  Forum 2005-2010 (read only) / Interfacing / Re: questions about powering the arduino on: November 17, 2008, 01:41:55 pm
lets pretend i never mentioned the motor shield lol.

is there anything preventing you from powering the arduino via the 5v and gnd pins on the power header?
22  Forum 2005-2010 (read only) / Interfacing / Re: questions about powering the arduino on: November 17, 2008, 12:54:46 am
here is what i want to do:

power the shield, and provide external power to the idc connectors. the external power supply will have a higher amperage rating that the voltage regulator on the arduino board (i want about 1amp).

if i connected a 5v regulated power supply to the "EXT" connector on top of the shield. what configuration should the arduino be in? ie. jumper to usb or ext?

i would think ext, but ladyada says to have it jumpered for usb power?? when using an external supply.
23  Forum 2005-2010 (read only) / Interfacing / questions about powering the arduino on: November 16, 2008, 09:29:30 pm
i have a need to provide power to chips the arduino is interfacing beyond the 500ma the external connector / voltage regulator can provide.

to do this can i:
1) switch the arduino to external power via jumper (im assuming usb power + external power = bad?)
2) provide the arduino power through the 5v and gnd header?

also what is the max current draw through the usb, ive heard 100ma and ive heard 500ma

i notice lady ada says this about her motor shield:
If you would like to have the Arduino powered off of USB and the motors powered off of a DC power supply, set the Arduino power jumper to USB, plug the DC power supply into the Arduino, and place the jumper on the motor shield. This is a suggested method of powering your motor project

is it ok to have chips powered off one vcc, but getting digital input from the arduino on another vcc? as long as the gnd's are connected?
24  Forum 2005-2010 (read only) / Interfacing / Re: eeprom as source of pcm or 1-bit sampled audio on: February 06, 2008, 11:39:35 am
thanks for the advice keep it coming smiley-grin

it looks like someone has found a way around the analogwrite problems:

the article writer offered:
"I have not done the experiment yet. I plan to hijack a timer and do PWM control without the built in Arduino functions. The rate needs to be increased to well above audio, say 50KHz. I have not checked into what resolution would remain for duty cycle control. If all goes to plan this could be the best solution for high quality sound output but I don't see it being used much so there must be some problems."

a user solutions:

i imagine bit banging the 1-bit converted waveforms through romanblack's resistor/capacitor solution will probably be best in terms of ease and storage. i will look into r2r and hardware dac's (im not against buying a seperate dac ic) ... im assuming the resistor/capacitor solution is a basic dac as well.

thanks for the storage link, if i get the eeprom stuff working ill definitely want to get one of those.

25  Forum 2005-2010 (read only) / Interfacing / eeprom as source of pcm or 1-bit sampled audio on: February 06, 2008, 01:33:33 am
im looking into using the arduino to play back sampled audio, i already know the quality won't be fantastic.

so far i've seen a couple ways of potentially storing the data, either as say 8bit 8khz pcm, or 1-bit audio

the 168 based arduino's have 16k of storage, which even on a good day lets say you had half of that ... which is roughly 1sec of 8bit/8khz audio (im assuming 1byte x 8000 = ~8k/sec)

so i'm going to try and store the audio on a spi interfaced eeprom like the arduino tutorial.

.... so i guess i have some questions on the best way to go about this.

i figure there are a few approaches

1) have the arduino fetch the entire eeprom sample, then play the sample ... this would run into the arduino's memory limitations. and limit it to very short clips of sound ... possibly not too bad with the 1-bit sound alternative.

2) play/fetch the data at the same time, im assuming only fetching what it needs to play in that time frame

... i guess i don't have a real good idea of what the arduino is capable of speedwise, and what the eeprom is capable of (at the moment i just have the eeprom that is in the arduino tutorial). lets say i do the simplest play loop, 8000 iterations a second for 8khz audio im assuming and only fetch one byte of storage then play it each iteration ... will i hit a brick wall in both the arduino's processing, and the eeprom's ability to fetch etc...?

if so, what are some of the preferred methods to get around this? fetch larger chunks ... offload tasks to other arduinos, use other chips better suited?

for our example lets say i just have some pushbuttons, an arduino168, a AT25HP512 (64k eeprom), an amplifier and a speaker. function being to play a different portion of the eeproms stored data on different button presses.
26  Forum 2005-2010 (read only) / Interfacing / Re: Around 50 RGB Leds... Possible??? on: May 08, 2008, 03:49:27 pm
the idea with the max7221 and transistors.... is:

24 transistors, 3 groups of 8 that activate or deactivate each color anode row.

you have the max7221 display Red matrix... wait, then switch to the next color ... repeat.

basically ... multiplexing a multiplexer it would end up a little dimmer than normal but should work.

the more advanced option is 3 max7221 chips each driving each color channel, however since there is a common cathode for all 3 chips that you have to cycle through the chips anyways, turning them off so there led sinks go high (this is only on the 7221, the 7219 you can't do this) so i dont think it would really be more benefit than the single max + transistors.
27  Forum 2005-2010 (read only) / Interfacing / Re: issue w/ multiplexing and shiftin/shiftout exa on: February 11, 2008, 01:28:33 pm
standard shiftout() function


void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {
  // This shifts 8 bits out MSB first,
  //on the rising edge of the clock,
  //clock idles low

  //internal function setup
  int i=0;
  int pinState;
  pinMode(myClockPin, OUTPUT);
  pinMode(myDataPin, OUTPUT);

  //clear everything out just in case to
  //prepare shift register for bit shifting
  digitalWrite(myDataPin, 0);
  digitalWrite(myClockPin, 0);

  //for each bit in the byte myDataOutÂ…
  //This means that %00000001 or "1" will go through such
  //that it will be pin Q0 that lights.
  for (i=7; i>=0; i--)  {
    digitalWrite(myClockPin, 0);

    //if the value passed to myDataOut and a bitmask result
    // true then... so if we are at i=6 and our value is
    // %11010100 it would the code compares it to %01000000
    // and proceeds to set pinState to 1.
    if ( myDataOut & (1<<i) ) {
      pinState= 1;
    else {      
      pinState= 0;

    //Sets the pin to HIGH or LOW depending on pinState
    digitalWrite(myDataPin, pinState);
    //register shifts bits on upstroke of clock pin  
    digitalWrite(myClockPin, 1);
    //zero the data pin after shift to prevent bleed through
    digitalWrite(myDataPin, 0);

  //stop shifting
  digitalWrite(myClockPin, 0);

28  Forum 2005-2010 (read only) / Interfacing / issue w/ multiplexing and shiftin/shiftout example on: February 11, 2008, 12:51:53 pm
im currently using a 595 and 4021 to decode a 8x8 button pad.
the 595 output pins are connected directly to the 4021 input pins, and each of the 4021 input pins also have a resistor to ground like the examples. each button has a 1n4148 diode. i do have a .1uf cap to prevent flickering like the tutorials show.

the problem im having is ... without the delayMicroseconds(20) after shifting in the value to the 595, the 4021 reads what appears to be a >> 1 shifted value. it works fine with the added delay the problem is that the delays are starting to add up with 8 iterations.... so the button presses aren't immediate, and lowering the delay much more than 20ms results in poorly shifted data.

any thoughts on how to speed it up while maintaining data integrity?
reasons for it requiring such a long delay? flickering on 595 outputs... flickering on input signal? diode delay? you can see my schematic a few topics down.

thanks for any help. - unsped

the outputs of the following code as an example while holding down appropriate button:
d[8][8] is a boolean array that stores my led states. the code below is simplified and doesn't debounce input or check for existing states. mrow[8] is a byte array that stores the value being sent to the max72XX for each row.

(commas separate each iteration)
with delay and 595 value of 1:
4021 output - N,0,0,0,0,0,0,0

without delay and 595 value of 1:
4021 output - 0,N,0,0,0,0,0,0

with delay and 595 value of 128:
4021 output - 0,0,0,0,0,0,0,N

without delay and 595 value of 128:
4021 output - N,0,0,0,0,0,0,0

where N is the 4021 output value 0-255


void loop() {

  inputrow = 0;
  for (i=1; i<=128; i=i*2)  {

    // 595
    digitalWrite(outlatchPin, 0);
    shiftOut(outdataPin, outclockPin, i);  // set each 595 output high through iteration
    digitalWrite(outlatchPin, 1);  
    delayMicroseconds(20);// lag on output pin being triggered

    // 4021 Pulse the latch pin:
    switchVar[inputrow] = shiftIn(indataPin, inclockPin);    

    //migrate switchvar data into d[]
    d[7][inputrow] += (switchVar[inputrow] & 1);
    d[6][inputrow] += (switchVar[inputrow] & 2) >> 1;
    d[5][inputrow] += (switchVar[inputrow] & 4) >> 2;
    d[4][inputrow] += (switchVar[inputrow] & 8) >> 3;
    d[3][inputrow] += (switchVar[inputrow] & 16) >> 4;
    d[2][inputrow] += (switchVar[inputrow] & 32) >> 5;
    d[1][inputrow] += (switchVar[inputrow] & 64) >> 6;
    d[0][inputrow] += (switchVar[inputrow] & 128) >> 7;    
    //end migration


  //construct displays from d[] array
  for (e=0; e<=7; e++)  {

    mrow[e] = (d[e][7]) + (d[e][6] << 1) + (d[e][5] << 2) + (d[e][4] << 3) + (d[e][3] << 4) + (d[e][2] << 5) + (d[e][1] << 6) + (d[e][0] << 7);


}// end loop()

standard shiftin() function


////// ----------------------------------------shiftIn function
///// just needs the location of the data pin and the clock pin
///// it returns a byte with each bit in the byte corresponding
///// to a pin on the shift register. leftBit 7 = Pin 7 / Bit 0= Pin 0

byte shiftIn(int myDataPin, int myClockPin) {
  int i;
  int temp = 0;
  int pinState;
  byte myDataIn = 0;

  pinMode(myClockPin, OUTPUT);
  pinMode(myDataPin, INPUT);
//we will be holding the clock pin high 8 times (0,..,7) at the
//end of each time through the for loop

//at the begining of each loop when we set the clock low, it will
//be doing the necessary low to high drop to cause the shift
//register's DataPin to change state based on the value
//of the next bit in its serial information flow.
//The register transmits the information about the pins from pin 7 to pin 0
//so that is why our function counts down
  for (i=7; i>=0; i--)
    digitalWrite(myClockPin, 0);
    temp = digitalRead(myDataPin);
    if (temp) {
      pinState = 1;
      //set the bit to 0 no matter what
      myDataIn = myDataIn | (1 << i);
    else {
      //turn it off -- only necessary for debuging
     //print statement since myDataIn starts as 0
      pinState = 0;

    //Debuging print statements
    //Serial.print("     ");
    //Serial.println (dataIn, BIN);

    digitalWrite(myClockPin, 1);

  //debuging print statements whitespace
  //Serial.println(myDataIn, BIN);
  return myDataIn;

29  Forum 2005-2010 (read only) / Interfacing / Re: diagram (4 sparkfun button pads max7221) on: February 10, 2008, 02:35:59 am
lol sorry big93 i wish it would have let me edit it.

im calling it a night, but i have all the hardware finished i think. i have some rudimentary software that detects the button press shift value and sets each led row to that value.

now i have to multiplex the shift-out outputs to (currently i just have them all set high) and work out the conversion factor to get that to line up with the max7219 addressing (as the rows and columns for the registers vs. the max are rotated 90 degrees.)

ill need to have some 8x8 bit arrays, one for buttons one for led's

then to implement the monome protocol. at least no more wiring (it is quite a mess lol) until i get ready to put them on a proto pcb and off the breadboard. since its running the monome protocol which is a single color im saving rgb functionality for other but similar projects.
30  Forum 2005-2010 (read only) / Interfacing / Re: diagram (4 sparkfun button pads max7221) on: February 09, 2008, 09:54:12 pm
UPDATE: deleted first post because i couldnt modify it. here is the new working circuit.

im building a monome compatible device, using 4 of the sparkfun 4x4 button pads, im only using 1 of the anodes though as im using single color led's. i had a hard time getting the 7221 to work until i added decoupling capacitors so maybe i should have some more stuff thrown in? im also just assuming that i can joint the 4 4x4 segments together at the endpoints like in the diagram.

finally got it wired up and working, need to work on the software tomorrow though.
Pages: 1 [2] 3