Show Posts
Pages: 1 ... 8 9 [10] 11 12 13
136  Using Arduino / Microcontrollers / attiny85 serial monitor on: December 22, 2012, 01:08:08 am
I have the monitor working well and everything but some oddities are happening when I try external power. I seem to be able to get readings on serial monitor in IDE when I have it plugged into 3.3v on ardiuno board, but when I try 3v battery (CR2032) it doesn't seem to want to read serial, all I do is disconnect the power and plug in the battery instead, so Tx is still connected to arduino and obviously still connected to USB.

does it need a certain voltage for serial? attiny85 specs say it's rated 2.7 V ~ 5.5 V so I am a bit confused.
137  Topics / Device Hacking / Re: Problems with MindFlex Hack on: December 11, 2012, 02:52:23 pm
this should be on the processing forum, since it's more of a processing problem than arduino. However, I have successfully done this hack with processing 2.0b6. try downloading controlP5 again and delete old version, you might have some legacy items in there.
138  Using Arduino / Microcontrollers / Re: capacitive switch on attiny85 on: November 30, 2012, 11:33:04 pm
yeah, easy with arduino, just having issues with how to implement it with attiny85. just not sure if I need hardware or if I should go software route to turn the program on. or if there is even a cap sense lib for attiny85
139  Using Arduino / Microcontrollers / Re: attiny85 with 3 PWN pins on: November 30, 2012, 09:04:39 pm
Quote
I have all 3 LEDs working now,

You are only setting one pin as output, for one thing.



Code:
 for(int i = 0; i < 255; i++){
    digitalWrite(0, i);
    delay(50);
  }

Quote
but there is some really weird things going on with the timing. this code basically only produces an on and off state every 30seconds or so:

That's what digitalWrite does. Turn the pin on or off.

sorry I meant the original project I was working on. I used your references to get it working. It was the new library that fixed it.

Quote
That's what digitalWrite does. Turn the pin on or off.

hah... yeah you are totally right, I was silly and had digital instead of analog.
140  Using Arduino / Microcontrollers / Re: attiny85 with 3 PWN pins on: November 30, 2012, 09:01:32 pm
The short form is, vary these three lines:

Code:
  OCR0A = 127;                   // duty cycle (50%)
...
  OCR0B = 63;                    // duty cycle (25%)
...
  OCR1B = 31;                   // duty cycle (25%)

They control the duty cycle. In the case of the first two, 100% is 255, and 0% is 0. The third one counts up to 127, so the duty cycle is half that (or change the line "OCR1C = 127;" to be "OCR1C = 255;" and they will all be the same).


Put your LEDs on pins 3, 5 and 6. Change the duty cycle as required and the LEDs will change brightness.

aha, ok that is very helpful. is this to save battery life? ie set duty cycle to half at 127
141  Using Arduino / Microcontrollers / capacitive switch on attiny85 on: November 30, 2012, 09:00:00 pm
trying to figure out what to read up on to make a capacitive switch on attiny85. What I would like it to do is start a program when you touch near the chip or hand passes by it. I've no idea where to start only a few good leads like using sleep mode to save battery and possible an interrupt to turn it on, but not sure how I could get this to work with a capacitive proximity sensor.

Also read somewhere about a 555 timer in flip flop mode to do this, but it was a bit over my head. if this is way to go I would be willing to read up on it though.
142  Using Arduino / Microcontrollers / Re: attiny85 with 3 PWN pins on: November 28, 2012, 11:23:44 pm
Out of interest, I set up a test. I definitely got 3 PWM outputs from the Attiny85.



You can see from the screenshot that we got a frequency of 31.5 KHz which is slightly off from the predicated 31.25 KHz (it's just running off the internal oscillator). The duty cycle is exactly 50%.

For Timer 1, I was able to adjust the frequency (the count-up-to is in OCR1C) and get a 25% duty cycle (32 / 128).

Code to generate the above:

Code:
// For Attiny85
// Author: Nick Gammon
// Date: 29 November 2012

void setup()
 {
  pinMode (0, OUTPUT);  // pin 5  // OC0A
  pinMode (1, OUTPUT);  // pin 6  // OC0B
  pinMode (4, OUTPUT);  // pin 3  // OC1B
 
  // Timer 0, A side
  TCCR0A = _BV (WGM00) | _BV (WGM01) | _BV (COM0A1); // fast PWM, clear OC0A on compare
  TCCR0B = _BV (CS00);           // fast PWM, top at 0xFF, no prescaler
  OCR0A = 127;                   // duty cycle (50%)

  // Timer 0, B side
  TCCR0A |= _BV (COM0B1);        // clear OC0B on compare
  OCR0B = 63;                    // duty cycle (25%)

  // Timer 1
  TCCR1 = _BV (CS10);           // no prescaler
  GTCCR = _BV (COM1B1) | _BV (PWM1B);  //  clear OC1B on compare
  OCR1B = 31;                   // duty cycle (25%)
  OCR1C = 127;                  // frequency
  }  // end of setup

void loop() { }

Nick you're always giving me good stuff to go and read up on. hah, I am totally lost here, but I will try to read up on it. Really appreciate the info though. hopefully soon I will understand what that all says.
143  Using Arduino / Microcontrollers / Re: attiny85 with 3 PWN pins on: November 28, 2012, 11:21:18 pm
ah, this with strykeroz suggestion seemed to work perfect. Earlier I was just getting a faint glow from last led that was constant.

I have all 3 LEDs working now, however I am trying to do a simple fade, but there is some really weird things going on with the timing. this code basically only produces an on and off state every 30seconds or so:


Code:
void setup(){
  pinMode(0,OUTPUT);
}

void loop(){
  for(int i = 0; i < 255; i++){
    digitalWrite(0, i);
    delay(50);
  }
  for(int i = 255; i > 0; i--){
    digitalWrite(0,i);
    delay(50);
  }
}
144  Using Arduino / Microcontrollers / Re: attiny85 with 3 PWN pins on: November 28, 2012, 09:26:06 pm
ok cool, thank you. I have downloaded them all (there are 3), ...

http://code.google.com/p/arduino-tiny/downloads/list
...the first download (Arduino Tiny for 1.0) is the core.

Quote
...however I am just seeing C++ files. am I missing something?

Instructions are in readme.txt.  They are also available here...
http://code.google.com/p/arduino-tiny/source/browse/trunk/readme.txt


oh duh...I had to do this for the other core too. appreciate it.
145  Using Arduino / Microcontrollers / Re: attiny85 with 3 PWN pins on: November 28, 2012, 09:12:19 pm
ok cool, thank you. I have downloaded them all (there are 3), however I am just seeing C++ files. am I missing something? Wiki on that page doesn't seem to offer much insight.
146  Using Arduino / Microcontrollers / Re: attiny85 with 3 PWN pins on: November 28, 2012, 09:03:39 pm
is there any way to get a third PWM pin from attiny85 using arduino, maybe more?

The ATtiny85 processor has three pins capable of normal PWM.  Use this core...
http://code.google.com/p/arduino-tiny/

Quote
I have read up on it and it seems some people are saying you have to go straight to AVR.

Not necessary.


If core is what you put on the arduino to program it, I think I was already using attiny. used the one suggested here though http://hlt.media.mit.edu/?p=1695

by core do you mean what you upload to arduino to program the attiny?
147  Using Arduino / Microcontrollers / Re: attiny85 with 3 PWN pins on: November 28, 2012, 08:39:26 pm
ah, I was reading: http://forums.adafruit.com/viewtopic.php?f=24&t=23937 and they said only two are PWM.

what pin would timer 1 be? I'm looking at the documentation, but am new to going straight to the doc, so not sure where to find this info. I am using http://www.atmel.com/Images/doc2586.pdf not sure if that is correct one to reference since it has a few ICs in it.
148  Using Arduino / Microcontrollers / attiny85 with 3 PWN pins on: November 28, 2012, 08:18:57 pm
is there any way to get a third PWM pin from attiny85 using arduino, maybe more? I have read up on it and it seems some people are saying you have to go straight to AVR. I am using arduino as an ISP but there isn't much info on it. There are some people saying that OC1B can be turned into PWM, but not sure if current version of programmer handles this.
149  Using Arduino / General Electronics / Re: RF reading for arduino on: October 25, 2012, 04:49:43 pm
im looking into the xbee and I see you can get a shield for it. what exactly does that do for you? is it even necessary. I think I've seen them used for breakout, but in this case it goes right on top of it, so I am not sure what it does.
150  Using Arduino / General Electronics / Re: RF reading for arduino on: October 25, 2012, 09:43:14 am
sure, sometimes that $20 less is only because its a less used technology that is harder to use...which I am ok with. xBee seems like it could have same problems?
Pages: 1 ... 8 9 [10] 11 12 13