Show Posts
Pages: [1]
1  Using Arduino / General Electronics / Best way to solder/make connections between holes on PCB on: May 23, 2013, 02:39:37 pm
How do you guys make connections between two holes on a PCB? I soldered an 8x8 LED matrix to a PCB and connected the pins to a couple rows of headers for easy 'jumper wire' access to the matrix. The picture is the underside of this board. I actually took exposed strands of speaker wire to make those connections. Though it worked great, I am pretty sure this is a bad practice. The other thing I have done is use massive amounts of solder to painstakingly 'blob' two holes together on the board. This I know for sure is bad practice.

Any advice?

Thanks!
2  Using Arduino / Microcontrollers / Re: ATtiny85 differential voltage ADC problem on: May 23, 2013, 02:28:57 pm
This is why/how I am only reading ADCH instead of ADC which includes ADCH and ADCL

...reading ADCH ... which includes ADCH and ADCL?  What does that mean?  ... Forget it.  I don't care what you meant.


Are you still having problems?


The entire ADC reading is 10 bits, which is 2 more than a single register can hold. 8 of the bits go into either the ADCH or ADCL register and the 2 leftover bits get stored into the ADCH or ADCL register that wasn't used for the first 8 bits. Look at the picture in my last post. I was only reading ADCH, which with my ADLAR bit setting to 1 in the ADMUX register gives me the 8 most significant bits. I was ignoring the 2 least significant bits.

And yes it doesn't work right now. I figure that either my bike's electrical system is too unstable to work with OR that my amateur circuit building skills are not good enough to build my regulator. I had trouble making connections between two holes on the copper side of the board. I ended up just using large amounts of solder and crappily making solder jumps between the connections which more so resembled massive blobs of silver dough covering my board.

I am restarting this entire thing. Part of my problem was a bad soldering tip. I bought a new one and when my next order of parts comes in from taydaelectronics.com comes in, I will remake the regulator.
3  Using Arduino / Microcontrollers / Re: ATtiny85 differential voltage ADC problem on: May 22, 2013, 11:14:05 pm

Do you still have ADLAR set?


I set ADLAR to 1 which does the 10-bit shift as described in the screenshot below. This is why/how I am only reading ADCH instead of ADC which includes ADCH and ADCL
4  Using Arduino / General Electronics / So it doesn't work afterall... on: May 12, 2013, 10:58:04 pm
I typed a long reply and it was rejected...

It worked fine save for some coding tweaks while my motorcycle was just sitting on its stand in my garage doing some rev tests. But upon actually taking it out and riding it, the thing kept restarting (I have a short startup sequence of the LEDs) and freaking out.

So I have come to the conclusion that my motorcycle's (1996 Kawasaki Ninja ZX6) electrical system is so unstable that no sort of digital electronics can run off it.

On a side note, I found a guy that did an LED tachometer on youtube but he did not use a microcontroller, used a frequency to voltage converter straight off the ignition coil, and used some LED drivers.
http://www.youtube.com/watch?feature=player_embedded&v=Z5WAXkjszhw#!
5  Using Arduino / General Electronics / Re: Car battery voltage regulation for ATtiny85 (and other MCs) on: May 04, 2013, 12:59:21 am
So I went ahead and built my regulator, there it is below. It worked alright when I just had it on a breadboard but I haven't got to try the board on my bike since it's a little too late to be revving my bike up.

Also, for everyone saying that I need a 0.1 uF across Vcc and GND, well there already is one. The 0.1 uF capacitor's pos and neg nodes are on the same nodes as if I were to put one there distinctly.

You need at least a 100uf cap on input side of the LM7805 in this application as well as a 0.1uF on the output.  Also, as already suggested put a 0.1uF across Vcc and Gnd of the ATtiny.  If you can get a hold of a 50mH to 100mH choke rated at twice the current your circuit draws would also be very nice and quite possibly a requirement.  I am assuming your circuit draws less than about 100-200ma.  Those 4-amp automotive radio filters are pretty bulky.

BTW, what kind of bike is it?

It's a 1996 Ninja ZX6.
6  Using Arduino / General Electronics / Re: Car battery voltage regulation for ATtiny85 (and other MCs) on: May 03, 2013, 12:24:10 pm
Ok, I just came across this. Although he didn't actually build it yet (or say anything about that) I really think he knows what he is doing. Should I go ahead and build this?

http://www.ecircuitslab.com/2011/07/car-battery-monitor.html

7  Using Arduino / General Electronics / Car battery voltage regulation for ATtiny85 (and other MCs) on: May 03, 2013, 11:58:56 am
So my tachometer project is working good up until I try to power the ATtiny85 with my motorcycle's 12V battery. I Am using an LM7805 5V regulator to get down to the proper voltage. The problem is that my outputs (LED's) freak out and do random things when I power it from the battery if the bike is running. If I connect everything to my motorcycle except use a 9V DC wall adapter and run that through the regulator it works fine. The same goes for swapping the supply with a 9V battery. I have been looking into voltage regulators and the only thing I can see that I am doing wrong is I'm not putting a couple tiny capacitors between the Vin and ground and Vout and ground on my regulator like this: http://thedasdet.deviantart.com/art/5v-Regulator-358912063

I think I am getting huge spikes of voltage from my battery which causes my regulator to fail (even though it is rated up to 18V, and I didn't think a car battery spikes as much as 50% over itself). But then if that happened, wouldn't my MC get fried? I don't know. All I know is that there is noise or some kind of interference coming from my motorcycle battery only when the bike is running.

Attached is my crudely drawn schematic.

Thanks a lot!
8  Using Arduino / Microcontrollers / Re: ATtiny85 differential voltage ADC problem on: May 03, 2013, 01:24:38 am

If I use "reading = ADC;" instead of "reading = ADCH*4;" it does not work. The reading sits there and rapidly fluctuates.


Moderator edit: over-quote trimmed
9  Using Arduino / Microcontrollers / Re: ATtiny85 differential voltage ADC problem on: May 02, 2013, 11:23:04 pm
It's that the ATtiny85 has a 10 bit ADC which requires me to read 2 registers and the way they are set up makes it kind of awkward to get the full 10 bits.

Have you tried accessing ADC?


What do you mean access ADC? Aren't I already accessing it by reading what is in the results register?
10  Using Arduino / Microcontrollers / Re: ATtiny85 differential voltage ADC problem on: May 02, 2013, 10:30:55 pm
Code:
 ADMUX |= B00100110;    //...

You are setting three bits high.  What are the values of the other bits?

Code:
 ADCSRA |= B1110000;   //enable ADC, start first conversion, auto trigger enable

You are setting three bits high.  What are the vlaues of the other bits?

Code:
 reading = ADCH*4;
  brightness = map(reading,0,1023,0,255);
  analogWrite(0,brightness);

Multiplying the value by four just to divide the value by four.  Why?


I have to set those bits that I did in order to set the ADC to differential mode between the two pins that I want to use. It works as it is. The bits that I did not set stay whatever they are, which is why I did an "|=" instead of an "=".

On the *4 /4... well I didn't realize I did that. It's that the ATtiny85 has a 10 bit ADC which requires me to read 2 registers and the way they are set up makes it kind of awkward to get the full 10 bits. So, I just used the 8 most significant bits because that is good enough accuracy for me. Then I mapped it to the standard 0-255 analogWrite() range that the Arduino uses.
11  Using Arduino / Microcontrollers / ATtiny85 differential voltage ADC problem on: May 02, 2013, 09:36:33 pm
I am programming an ATtiny85 with an UNO and I finally got a differential ADC to work. For testing, I am changing the brightness of an LED based on the ADC reading which is from a potentiometer. The problem is that when the voltage reading is low (about anything less than half a volt on a 0-5V scale) the LED flickers randomly although the observed average of brightness seems to be right.

I think it may have something to do with the ADC conversion not being finished when I store the result register into "reading" but that is just a guess. I tried waiting in a while loop until the ADC Interrupt Flag bit in the ADC Control and Status Register A goes high but that did not help. Actually, that should not work since what I'm reading seems to say basically an ISR is required to use that flag.

The reason I am actually reading the ADC result register instead of doing a analogRead() is:
1. Which pin do I put in the parameters when this is a differential reading (ie two pins are needed)
2. I tried it with both pins I used and could not get it to work

Thanks a lot guys! This I believe is my last problem to overcome (knock on wood) and my tachometer project should be a smooth sail to finish!

Code:
int reading = 0;
int brightness = 0;

void setup()
{
  ADMUX |= B00100110;    //differential ADC, positive ADC2 (pin 3), negative ADC3 (pin 2), gain of 1, ADLAR set for only using 8bit precision
  ADCSRA |= B1110000;   //enable ADC, start first conversion, auto trigger enable
  //ADCSRB = B00000000;   //free running mode
 
  pinMode(6,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(0,OUTPUT);
}

void loop()
{
  reading = ADCH*4;
  brightness = map(reading,0,1023,0,255);
  analogWrite(0,brightness);
}
12  Using Arduino / Microcontrollers / Re: ATtiny85 interrupts, programming with the UNO on: May 02, 2013, 10:24:07 am
Thank you guys both! I have an external interrupt working now. Here, I just have an LED to turn on or off each time a rising edge has occurred. I still could not get the attachInterrupt(x,x,x) to work so I ended up doing it the other way. Oh, and all those mistakes you guys pointed out, thanks for that too. I read that datasheet so many times I guess I got mixed up. Now to calculate the frequency...

Code:
int pinLed = 0;
int state = HIGH;

void setup()
{
  pinMode(pinLed,OUTPUT);
  pinMode(1,INPUT);

  MCUCR |= B00000011;    //watch for rising edge
  GIMSK |= B01000000;    //enable external interrupt
  SREG |= B10000000;     //global interrupt enable
}

void loop()
{
  digitalWrite(pinLed,state);
  delay(1);
}

ISR(INT0_vect)
{
  state = !state;
}

13  Using Arduino / Microcontrollers / ATtiny85 interrupts, programming with the UNO on: May 01, 2013, 10:49:36 pm
I need help with programming an ISR with the one and only external interrupt on the ATtiny85. I have tried MANY things and nothing works. I have read through the ATtiny85 datasheet about 700 times. The only thing it gives me is how to set up the registers, which I have done below. I can't find any tutorials on how to do this except for a couple people have done a little bit of stuff on the Pin Change Interrupt. I cannot use the PCINT because that interrupt watches for rising and falling edges and is not changeable. I only need rising edge (my project involves interpreting the frequency of pulses (a tachometer on my motorcycle)). The ATtiny85 does not have an input capture timer channel apparently (only an output compare I could see in the data sheet). So, my only option is using an external interrupt to calculate the frequency or buy a frequency to voltage converter IC which I'd have to order and wait.

So, if anyone knows how to program an external interrupt on the ATtiny85 using the UNO as an ISP then I will worship you...

This is all I have anymore. I know the registers are set right. I do not know how to create the ISR itself and/or 'attach' it to the program. I tried using the Arduino attachInterrupt() and that didn't work either and I tried every pin.

Thanks a lot!

Code:
int pinLed = 0;

void setup()
{
  pinMode(pinLed,OUTPUT);

  MCUCR |= B00000011;    //watch for rising edge
  GIMSK |= B01000000;    //enable external interrupt
  SREG |= B10000000;     //global interrupt enable
}

void loop()
{
  ;
}

void beast_isr(void)
{
  digitalWrite(pinLed,HIGH);
  delay(1000);
  digitalWrite(pinLed,LOW);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
}
14  Using Arduino / LEDs and Multiplexing / My draw() function on my LED matrix code stops running on: March 27, 2013, 09:43:14 pm
I just built my first 3x3 LED matrix following this tutorial:
http://www.appelsiini.net/2011/how-does-led-matrix-work

I adapted it a little to make for multiple "images" for animation. Everything works great, but my LED's just turn off after like 20 seconds or so. To debug, I put a println("TEST") in my loop(). TEST is printed out every 1.6 seconds as expected, but once my LED's stop, TEST is printed like crazy. Actually, I counted and TEST is printed slowly 21 times before it goes super fast. This tells me that my draw() calls are either being skipped or something is wrong with them after 21 loops. I can't figure out what.

**EDIT**
I changed my start variable (for timing duration) from an int to a long. I think the data type limits is cutting my loop off inside my draw() function. Changing it to a long is making it go for a long time now, but I'm guessing it wont be forever. How can I make it run forever without running out of data type size?

Here's my code
Code:
byte column_pins[3] = {4,3,2};
byte row_pins[3] = {10,9,8};
int delay_time = 100;

byte a[3][3] =       {{0,0,0},
                      {1,0,0},
                      {0,0,0}};
byte b[3][3] =       {{1,0,0},
                      {1,1,0},
                      {1,0,0}};
byte c[3][3] =       {{0,1,0},
                      {1,1,1},
                      {0,1,0}};
byte d[3][3] =       {{0,0,1},
                      {1,1,1},
                      {0,0,1}};
byte e[3][3] =       {{0,0,0},
                      {1,1,1},
                      {0,0,0}};
byte f[3][3] =       {{0,0,0},
                      {0,1,1},
                      {0,0,0}};
byte g[3][3] =       {{0,0,0},
                      {0,0,1},
                      {0,0,0}};
byte h[3][3] =       {{0,0,0},
                      {0,0,0},
                      {0,0,0}};

void setup()
{
  Serial.begin(9600);
  for(int x = 0; x < 3; x++)
  {
    pinMode(column_pins[x],OUTPUT);
    digitalWrite(column_pins[x],LOW);
  }
  for(int y = 0; y < 3; y++)
  {
    pinMode(row_pins[y],OUTPUT);
    digitalWrite(row_pins[y],HIGH);
  }
}

void loop()
{
  draw(a,200);
  draw(b,200);
  draw(c,200);
  draw(d,200);
  draw(e,200);
  draw(f,200);
  draw(g,200);
  draw(h,200);
  Serial.println("TEST");
}

void draw(byte buffer[3][3], int duration)
{
  int start = millis();
  while(millis() - start < duration)
  {
    for(int row=0; row < 3; row++)
    {
      for(int column = 0; column < 3; column++)
      {
        digitalWrite(column_pins[column], buffer[row][column]);
      }
      digitalWrite(row_pins[row],LOW);
      digitalWrite(row_pins[row],HIGH);
    }
  }
}
Pages: [1]