Show Posts
Pages: 1 2 3 [4] 5 6 ... 71
46  Using Arduino / Microcontrollers / Re: [ATTINY85]Nothing but junk appears on my serial monitor... :( on: February 28, 2014, 08:57:51 am
I did an experiment with SoftwareSerial

ATtiny85V - 10 @ 8MHz
10 kOHM resistor from reset to VCC
0.1 uF from VCC to grnd

Tuned at 21 degree Celcius, and 5V (USB power)
Test sketch below:
Serial @ 9600

I started it at 21 degree and then put it in my frezer at -18 degree for half an hour.
Result: nothing - no garbled text it just continued to write flawlessly.

Then I stuck it on a room heater for another half hour at 30 degree, and it just kept on without failure

Lastly I borrowed my wife's hairdryer,the temperature now +50 degree and still no errors.

Next step was to try to lower VCC

At 1.9V the text began to be garbled
Under 1.8V it stopped and resat
At 2V No problems at all.

So not bad, atleast it is good enough for me.
I can only guess that the problems with SoftwareSerial that is reported is because of lack of tuning.

Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(3,4 ); //rx=3,tx=4 setup of software serial
unsigned int x=0;

void setup() {
  OSCCAL = 0x68; 
  mySerial.begin(9600);
  x=0;
}

void loop() {
  x++;

  mySerial.print("Test= "); 
  mySerial.println(x);
  delay(500);
}
47  Using Arduino / Microcontrollers / Re: Using ATTiny84 with DS18B20 temp sensor as temperature logger on: February 27, 2014, 03:18:05 pm
Quote
'Reset the processor.  A welcome message should be displayed.'

You breefly connect the reset pin (PB3) to ground, and you will see this in the serial monitor:

Code:
--------------------------------------------------------------------------------
Poor Man's Tiny Tuner
Slowly send lowercase 'x' to tune the oscillator...

  // Starting OSCCAL value is 0x9C

Step  OSCCAL
  1    

Then you start sending x 's.
You get a new line for every x, as the tuner try to determin the right OSCCAL value.

This is the final result for my particular ATtiny84

Code:
Poor Man's Tiny Tuner
Slowly send lowercase 'x' to tune the oscillator...

  // Starting OSCCAL value is 0x9C

Step  OSCCAL
  1     9F
  2     9E
  3     9F
  4     9F
  5     9F
  6     9F
  7     9E
  8     9E
  9     A0
 10     A0
 11     A0
 12     A0
 13     A0
 14     9F

Copy-and-paste the following line of code at the top of setup...

  OSCCAL = 0x9F;


So in my sketch i will place this value in setup()

Code:
void setup(){

OSCCAL = 0x9F;

//other code

}

BYTW this is TinyTuner 1
48  Using Arduino / Microcontrollers / Re: Using ATTiny84 with DS18B20 temp sensor as temperature logger on: February 27, 2014, 06:17:50 am
The garbled text could be a sympton of bad timing.

You can tune the internal osccilator by setting a value for the  OSCCAL

There are sevaral option for tuning.
Coding Badly has made TinyTuner

TinyTuner 1

http://forum.arduino.cc/index.php/topic,8553.0.html

And TinyTuner2

http://forum.arduino.cc/index.php?topic=173408.0


Another option is to use SoftwareSerial as an indicator for the tuning.
If you load this sketch to your Attiny84 it will output the OSCCAL value to the serial monitor.
A potmeter connected to PA3 will vary the OSCALL value, and you will see the output going
from garbled to readable and garbled again. Then you pick a value in tyhe midlle of the readable text.

Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2,3 ); //rx=PB2,tx=PA7 setup of software serial

void setup() {
  mySerial.begin(9600);
}

void loop() {
  int val=analogRead(3); //PA3
  OSCCAL=val/4;
  mySerial.print("Osccal= "); 
  mySerial.println(OSCCAL,HEX);
  delay(200);
}

If you have a frequencee counter you can use the sketch below.
With a attiny84 @ 8MHz it will output 1MHz on pin5, if it is tuned correct.
Again a potmeter is connected to PA3, which will alter OSCCAL.
When you read 1 MHz on the frequence counter, you can read the OSCCAL value on the serial monitor.

Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2,3 ); //rx=PB2,tx=PA7 setup of software serial

void setup(){
  mySerial.begin(9600);
  OSCCAL = 0x9F; 
  pinMode(5,OUTPUT);
  noInterrupts(); 
  TCNT1 = 0;
  TCCR1A=0;
  TCCR1B=0;
  TCCR1B |=(1<<WGM12); //Start timer 1 in CTC mode Table 14.4
  TCCR1A |=(1<<COM1B0); //Timer1 in toggle mode Table 14-1
  TCCR1B |=(1<<CS10) ; //prescaler Table 14-5, no prescal
  interrupts();
  OCR1A=3; //CTC Compare value
 }

void loop(){
  int val=analogRead(3); //PA3
  OSCCAL=val/4;
  mySerial.print("Osccal= "); 
  mySerial.println(OSCCAL,HEX);
  delay(200);
}
49  Using Arduino / Microcontrollers / Re: [ATTINY85]Nothing but junk appears on my serial monitor... :( on: February 26, 2014, 03:03:23 pm
Quote
I powered with 3.3volts because today i learned that serial working only under this voltage.

That proves that you should not trust everything you read, it is nonsens.

I don't know the core you are using, as I said in previous post I am using this one:

https://code.google.com/p/arduino-tiny/

Quote
is there any problem that windows isn't in english language? I think i have tryied everything...

No mine windows is danish, and that dosn't give me any trouble.

Are you using SoftWareSerial for communication ?

50  Using Arduino / Microcontrollers / Re: Erratic behaviour with software serial and eeprom, attiny 84, tinyisp on: February 26, 2014, 02:24:16 pm
Quote
From the knockbang header file It seems that the knockbang is using the ordinary miso on the tiny, so I should get some output even if I don't connect any oscillator on xtal2, right?

Yes that is right.

The the  _TinyISP_BuildOptions should look like this when you are using KnockBang
Remember to comment out  this in the TinyISP
Code:
//#include <SoftwareSerial.h>

Code:
/Set to 1 if using KnockBang and comment out #include <SoftwareSerial.h> in TinyISP
   #define RELAY_KNOCK_BANG_ENABLED 1
 
//Set to 1 if using Serial Relay, and uncomment #include <SoftwareSerial.h> in TinyISP
   //Transmit on Arduino is A0
   #define RELAY_SERIAL_ENABLED  0
 
//Set to 1 if using TinyTuner2

   //Tuning signal pin 3 on UNO, connect to xtal2 on target
   #define TUNING_SIGNAL_ENABLED  1

And rember to set the Serila monitor at 19.200
51  Using Arduino / Microcontrollers / Re: Using ATTiny84 with DS18B20 temp sensor as temperature logger on: February 26, 2014, 01:48:07 pm
You are welcome
52  Using Arduino / Microcontrollers / Re: [ATTINY85]Nothing but junk appears on my serial monitor... :( on: February 26, 2014, 01:37:36 pm
How are you connecting the tiny to your Arduino.

Why are you powering the tiny with 3.3V
53  Using Arduino / Microcontrollers / Re: Using ATTiny84 with DS18B20 temp sensor as temperature logger on: February 26, 2014, 10:47:13 am
Just tryed the sketch mentioned in reply #1, on a ATtiny84, and it works.

The only difference I made was the pin assignment

Code:
OneWire  ds(3);  // on pin PA7 (a 4.7K resistor is necessary)

PA7 is physical pin 6
54  Using Arduino / Microcontrollers / Re: [ATTINY85]Nothing but junk appears on my serial monitor... :( on: February 26, 2014, 09:47:53 am
If you use this core:

https://code.google.com/p/arduino-tiny/

there are several options for serial output.

A simple example below.
The serial output will be pin PB3. Connect a serial/USB converter to that pin.

This might be of interest:

http://www.ernstc.dk/arduino/tinycom.html

Code:
void setup() {
Serial.begin(9600);
}

void loop() {
Serial.println("Testing..");
}
55  Using Arduino / Microcontrollers / Re: ATtiny85 Counter/Timer0 Input for Frequency Capture on: February 25, 2014, 11:30:12 am
Update:
I just tried my sketch below using a tuned ATtiny85.

With a input frequence at 54.366 HZ my output was 54592.
Thats an error of 0,4%

Code:
#include <TinyDebugKnockBang.h>

volatile unsigned long Count;
long previousMillis = 0;
long interval = 1000;

ISR(PCINT0_vect) {
  Count++;
}

void setup()
{
  OSCCAL = 0x69;
  Debug.begin(250000);
  Debug.println("Freq......");
  GIMSK = _BV(PCIE);    // Enable pin change interrupt Table 9.3.2
  PCMSK = _BV(PCINT4);  // Enable the interrupt for only pin 4,Table 9.3.4
}

void loop ()   {
unsigned long currentMillis = millis();
  if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;   
    Debug.println("Count  ");
    Debug.println(Count/2);
    Count=0;
  }
} //loop
56  Using Arduino / Microcontrollers / Re: ATtiny85 Counter/Timer0 Input for Frequency Capture on: February 25, 2014, 09:04:25 am
Quote
My results are not as accurate as I'd like. 5% error if my measurements are correct.

The internal oscillator is not very accurate, it can be off by 10%.
You can tune it to be within 1%
57  Using Arduino / Microcontrollers / Re: Using ATTiny84 with DS18B20 temp sensor as temperature logger on: February 24, 2014, 09:42:43 am
I have done it, using ATtimy85, so I can't see why not.

http://forum.arduino.cc/index.php?PHPSESSID=pj61g4bqqengv8m112nh5encg3&topic=216663.0

edit:
I am using this core for tinys
https://code.google.com/p/arduino-tiny/
58  Using Arduino / Microcontrollers / Re: Erratic behaviour with software serial and eeprom, attiny 84, tinyisp on: February 23, 2014, 06:06:58 am
I think the first thing I would consider is tuning the internal osccilator.
If it is too much off it will cause trouble with SoftwareSerial  (or any other serial comm)

You could use TinyTuner2 to do the tuning.

http://forum.arduino.cc/index.php?topic=173408.0
59  Using Arduino / Microcontrollers / Re: Uploading to Attiny with an Arduino on: February 22, 2014, 12:04:34 pm
Quote
Wrong microcontroller found.

This tells you that you have chosen the wrong board, the -F won't help.

I wonder if you are following the right steps, and all of them ?.


1. Upload the ArduinoISP to the Arduino dont't connect the capacitor yet.
2 Connect a 10 µF capacitor from reset to ground on the arduino (negative side to ground)
3. Open the blink sketch and change pin13 to pin3
4. select Tools -> board -> Attiny85@1MHZ (leave the serial port as it is)
5. Select Tools -> Programmer -> Arduino as ISP
6. Select File -> upload using programmer
7. Connect a LED with resitor to pin PB3

Now you should have a blinkining Led on your Attiny85
60  Using Arduino / Microcontrollers / Re: Uploading to Attiny with an Arduino on: February 22, 2014, 08:02:08 am
First you will have to install the specific files for the tiny, called a core.

I can recommend this one:

https://code.google.com/p/arduino-tiny/

As you see there is a version for either IDE version 1.0x or 1.5.x
Follow the read.me file when you install the files

Then you just follow these steps:

http://www.ernstc.dk/arduino/attiny85.html
Pages: 1 2 3 [4] 5 6 ... 71