Show Posts
Pages: [1] 2
1  Using Arduino / Microcontrollers / Re: Arduino on an ATmega64M1 on: February 11, 2014, 04:06:17 pm
Please someone give me a little bit more help.

Cu kami
2  Using Arduino / Microcontrollers / Re: Arduino on an ATmega64M1 on: February 10, 2014, 10:22:47 am
Hi,

thanks a lot for the really good answer and the nice introduction of the use of Arduino.

I just look through the different files and found out, that it is a little bit complicated for me.

How can i put the new informations about the µC in the optiboot files? What do i have to change?

How can i find out the different information about the Atmega64M1 for the boards.txt. Is there someone how can give me this change from the datasheets?

Thanks a lot for the help.

Cu kami
3  Using Arduino / Microcontrollers / Arduino on an ATmega64M1 on: February 08, 2014, 11:32:41 am
Hi,

i would like to change a Arduino Nano Board 3.0 from an Atmega328p to an Atmega64M1.

Can someone please help and answer this questions:

1. Which Fuses should i set?
2. How can i use the bootloader?
3. How can i integrate this new board in the arduino Hardware list?

Thanks a lot.

Cu kami
4  Using Arduino / Sensors / Strange Problems with IRsensor. on: December 31, 2013, 09:25:34 am
Hi,

i am using a Zytemp TN168
(http://www.zytemp.com/products/tn168.asp). As shown on the Picture i connected it to a Mega 2560 Arduino Board. i used this new libs:

https://github.com/freetronics/IRTemp

to read out the 3 data pins.

At the first time everything works fine.I uploaded this code:

Code:
/*

    File: readTemperature.ino
    Version: 1.0
    Author: Andy Gelme (@geekscape)
    License: GPLv3 *
    For more information see www.freetronics.com/irtemp *
    IRTemp library uses an Arduino interrupt:
    If PIN_CLOCK = 2, then Arduino interrupt 0 is used
    If PIN_CLOCK = 3, then Arduino interrupt 1 is used */

#include "IRTemp.h"

static const byte PIN_DATA = 2;
static const byte PIN_CLOCK = 3; // Must be either pin 2 or pin 3
static const byte PIN_ACQUIRE = 4;

static const TempUnit SCALE=CELSIUS; // Options are CELSIUS, FAHRENHEIT

IRTemp irTemp(PIN_ACQUIRE, PIN_CLOCK, PIN_DATA);

void setup(void) {
Serial.begin(9600);
Serial.println("IRTemp example");
Serial.println("~~~~~~~~~~~~~~");
}

void loop(void) {
float irTemperature = irTemp.getIRTemperature(SCALE);
printTemperature("IR", irTemperature);

float ambientTemperature = irTemp.getAmbientTemperature(SCALE);
printTemperature("Ambient", ambientTemperature);

delay(1000);
}

void printTemperature(
char *type,
float temperature) {

Serial.print(type);
Serial.print(" temperature: ");

if (isnan(temperature)) {
Serial.println("Failed");
}
else {
Serial.print(temperature);
Serial.println(SCALE == FAHRENHEIT ? " F" : " C");
}
}

After this i get good values from the sensor.

But if i disconnect the Board from the USB i always get FAILURE.
The only way to repair it is, to change all pins for example to 7,8,9 than i upload the data and the Controller is working. but if i disconnect USB i get the same problem.
If i only reset the Board. There is no Problem. Only the Power Up makes this problem.
Here is a picture of my Wiring:

http://picpaste.com/Foto-navNvrWt.JPG

Please help me.

cu kami83
5  Using Arduino / Programming Questions / Re: Interrupt Handling with Arduino Atmega 328 on: December 30, 2013, 05:40:43 am
Hi,

i just found out something new. The Code is only working on my 2560 Board, when i upload it for the first time. After disconnecting the power and restarting i just get the message of the Serial console but no new values. Only after uploading the code it works?

Why can someone help me?

Cu kami
6  Using Arduino / Sensors / Re: Zytemp TN9 Overview on: December 30, 2013, 05:10:26 am
Hi,

i have got some problems using this code with a Atmega 328 SMD-Kit.

Maybe someone can help me i discribed my problem here :

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

Thanks a lot.

Cu kami
7  Using Arduino / Programming Questions / Interrupt Handling with Arduino Atmega 328 on: December 30, 2013, 05:05:34 am
Hi,

i am trying to use this code :

Code:
byte n = 0;                 // Interrupt Bit Count
volatile byte pos = 0; // Values Position Count
volatile byte values[5] = {
  0,0,0,0,0};                                                 // Values to be stored by sensor
byte cbit = 0;         // Current bit read in

boolean irFlag = false; // Flag to indicate IR reading has been made
boolean ambFlag = false; // Flag to indicate ambient temp reading has been made


byte irValues[5] = {
  0,0,0,0,0};                                // Variable to store IR readings
byte ambValues[5] = {
  0,0,0,0,0};                                       // Variable to store Ambient readings

const int len = 5;               // Length of values array
const int clkPin = 3;                       // Pins
const int dataPin = 2;
const int actionPin = 4;

void setup(){
  Serial.begin(9600);

  pinMode(clkPin, INPUT); // Initialize pins
  pinMode(dataPin, INPUT);
  pinMode(actionPin, OUTPUT);
  digitalWrite(clkPin, HIGH);
  digitalWrite(dataPin, HIGH);
  digitalWrite(actionPin, HIGH);

  Serial.println("Type to Start...");                 // Wait for input to start
  while(!Serial.available());
  Serial.println("Starting...");
  Serial.println("IR (C), Ambient (C), Time Since Start (ms)");

  attachInterrupt(1,tn9Data,FALLING);          // Interrupt
  digitalWrite(actionPin,LOW);   // Make sensor start sending data
}

void loop(){



  if(pos == len && values[0] == 0x4C){         // If sensor has sent IR packet...
    for(int i = 0; i < len; i++){                 // Store values to irValues
      irValues[i] = values[i];
    }
    irFlag = true;                        // Indicate IR reading
    pos = 0;
    digitalWrite(actionPin,LOW);        // Make sensor start sending data
  }

  if(pos == len && values[0] == 0x66){       // If sensor has sent ambient packet...
    for(int i = 0; i < len; i++){               // Store values to ambValues
      ambValues[i] = values[i];
    }
    ambFlag = true;               // Indicate Ambient reading
    pos = 0;
    digitalWrite(actionPin,LOW);      // Make sensor start sending data   
  }

  if(pos == len && values[0] == 0x53){      // If sensor has sent junk packet
    pos = 0;
    digitalWrite(actionPin,LOW);     // Make sensor start sending data   
  }

  if(irFlag && ambFlag){ // If successful IR and Ambient reading...
    digitalWrite(actionPin,HIGH); // Make sensor stop sending data.  Because Timing is weird, I want to ensure the interrupts do not happen during this section.   
    word tempword = 0;  // Next 4 lines isolate temperature component of values
    tempword = tempword | irValues[1];
    tempword = tempword << 8;
    tempword = tempword | irValues[2];
    if(tn9Check(irValues)){ // If checksum is valid, print IR temperature
      //Serial.print("IR = ");
      Serial.print(int(tempword)/16.0 - 273.15);
      Serial.print(", ");       
    }
    else{         // If checksum isn't valid, print impossible temp
      //Serial.print("IR = ");
      Serial.print("-273.15, ");
    }

    tempword = 0; // Isolate temperature component again for ambient
    tempword = tempword | ambValues[1];
    tempword = tempword << 8;
    tempword = tempword | ambValues[2];
    if(tn9Check(ambValues)){ // If checksum is valid, print ambient temperature
      //Serial.print("Amb = ");
      Serial.print(int(tempword)/16.0 - 273.15);       
    }
    else{ // If checksum isn't valid, print impossible temp
      //Serial.print("Amb = ");
      Serial.print("-273.15");
    }
    irFlag = false; // Reset flags
    ambFlag = false;
   
    Serial.print(", ");
    Serial.println(millis());                           // Print time for logging purposes
    delay(2000);      // Simulate other sensors or code
    digitalWrite(actionPin,LOW);              // Make sensor start sending data 
}


}


void tn9Data(){ // Interrupt Function
  cbit =  digitalRead(dataPin); // Read bit
  if(pos >= len) pos = 0;         // Keep index below 5
  values[pos] = (values[pos] << 1) | cbit;         // Store to values
  n++; // Increment bit count
  if(n == 8){ // Increment position count based on bits read in
    pos++;
    n = 0;
  }
  if(pos == len){ // If complete "packet" sent, stop sensor from sending
    digitalWrite(actionPin,HIGH);  // again until main loop allows it.
  }
}


boolean tn9Check(byte tn9Values[]){ // Checksum calculating function
  int mcheck = (int)tn9Values[0] + (int)tn9Values[1] + (int)tn9Values[2]; // Checksum calculation
  int scheck = (int)tn9Values[3];        // Checksum sent by sensor
  boolean crc = false; // Initialize return value
  if(mcheck > 510) mcheck = mcheck - 512;         // Handle sensor byte rollover
  if(mcheck > 255) mcheck = mcheck - 256;         // Handle sensor byte rollover
  if(mcheck == scheck) crc = true; // Check checksum
  return(crc); // Return
}

I tested it with a Mega 2560 and it works fine but if i use the same pins and a Atmel 328 SMD-Kit from Jeelabs http://jeelabs.com/products/smd-kit
It is not working. Could it be an interrupt problem?

Can someone please help me? Where are the difference between Mega 2560 and Atmel 328?
I got the code from this post: http://forum.arduino.cc/index.php?topic=84705.0

Thanks a lot.

Cu kami
8  Community / Exhibition / Gallery / Re: Arduino and MLX90620 16X4 pixel IR thermal array on: April 07, 2013, 08:00:52 am
Hi,

thanks a lot for the answer. I am still thinking about buying the MLX90620 or the Grideye?

Cu kami
9  Community / Exhibition / Gallery / Re: Arduino and MLX90620 16X4 pixel IR thermal array on: February 21, 2013, 06:42:37 am
Hi,

just got the chance to order a Panasonic GRID-Eye AMG8851 (5 Volt) or AMG8831 (3.3 Volt).

What did you think which one is better the MLX or the GRID-Eye?

Thanks a lot.

Cu kami83
10  Community / Exhibition / Gallery / Re: Arduino and MLX90620 16X4 pixel IR thermal array on: January 10, 2013, 02:33:55 pm
Hi,

i would like to make good picture for a distance like 1-2 meters. What is with a Lens? Do i need one?

Thx a lot.

Cu kami
11  Community / Exhibition / Gallery / Re: Arduino and MLX90620 16X4 pixel IR thermal array on: January 10, 2013, 09:47:53 am
Hi,

anyone who can tell me if i should use the 60° or 40° FOV??
And should i need a Lens?


Thanks a lot.

Cu kami
12  Community / Exhibition / Gallery / Re: Arduino and MLX90620 16X4 pixel IR thermal array on: January 10, 2013, 03:20:23 am
HI,

i have found an distributor for Germany. Which type of sensor of the MLX 90620 should i use the 60° or 40°?

Thanks a lot.

Cu kami
13  International / Deutsch / Arduino: Button drücken wird nicht erkennt. Nur der Interrupt wird ausgelöst on: December 21, 2012, 09:06:43 am
Hi,

ich habe hier einen ATtiny84 mit einem simplen Taster dran:

http://www.mikrocontroller.net/wikifiles/8/8a/Taster.gif

Ich habe folgenden simplen Code zum Testen geschrieben und lasse mir das alles per Serial ausgeben:

Code:
#include <JeeLib.h>
#include <avr/sleep.h>
#include <avr/interrupt.h> 

#define DIO1 10  // d10

static void setPrescaler (uint8_t mode) {
    cli();
    CLKPR = bit(CLKPCE);
    CLKPR = mode;
    sei();
}
int buttonState = 0;     
ISR(WDT_vect) { Sleepy::watchdogEvent(); }

ISR (PCINT0_vect) {

Serial.println("Ubt");
     
}


void setup()   {
setPrescaler(0); // div 1, i.e. speed up to 8 MHz
         Serial.begin(38400);
      Serial.print("ack13 \n");
   
      pinMode(DIO1, INPUT);       //set the pin to input
PCMSK0 |= (1<<PCINT2); //  tell pin change mask to listen to (DIO1)
digitalWrite(DIO1, LOW);
GIMSK  |= (1<<PCIE0); // enable PCINT interrupt in the general interrupt mask
 
      //sei();
 
}
 
void loop() {
  buttonState = digitalRead(DIO1);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED on:   
     Serial.print("1 \n"); 
  }
  else {
    // turn LED off:
     Serial.print("2 \n");
  }
  //Serial.println(inttime);
  delay (500);
 
 

 
}

Mein Output in hterm sieht nun so aus:

Code:
ack13
2
2
2
2
2
2
UUbt
bt
2
2
2
2
UUUUUbtUUbUUUUUUaUUbUUUbt
bt
bt
t
bt
2
2

Was mich nun stört ist das egal ob der Schalter betätigt ist oder nicht er immer nur LOW ist und nie HIGH ist. Aber ich jeden Interrupt auf dem Pin angezeigt bekomme. Was mache ich falsch?

Gruß kami83
14  International / Deutsch / Re: Entprellen von Schalter mit Interrupt und PinChange on: December 18, 2012, 02:57:03 am
Hi,

okay wie sollte ich das denn am besten aufbauen? Also per Software geht das echt nicht?

Wie muss ich RC auslegen?

Gruß kami
15  International / Deutsch / Entprellen von Schalter mit Interrupt und PinChange on: December 18, 2012, 02:34:20 am
Hi Leute,

ich habe hier folgendes Problem ich habe unter Arduino einen Attiny84 so programmiert, das er über einen simplen Schalter einen Interrupt auslöst.

Der Schalter wird nun geschlossen und geöffnet. Ich frage nur auf PinChange ab. Also beim Betätigen des Schalter wird der Interrupt gestartet.

Nun möchte ich gerne jeweils eine Ausgabe durch den Controller bekommen für folgende 2 Tätigkeiten:

1. Der Schalter wird geöffnet und wieder geschlossen.
2. Der Schalter wird nur geöffnet und bleibt offen stehen.

Problem dabei ist nun das der Schalter auch klappern kann, als relativ schnell auf und zu springen kann. Das soll durch den Controller nicht ausgewertet werden.

Ich habe dafür bisher folgenden Code unter  Arduino geschrieben:

ISR (PCINT0_vect) {
volatile unsigned long now;
  now = millis();
  if (now < inttime) { return;}
 
  inttime = now + 2000;
  flag=1;
   
     
}

void setup()   {
      setPrescaler(0); // div 1, i.e. speed up to 8 MHz
     

      delay(500);
       
      ADCSRA &= ~ bit(ADEN); // disable the ADC
      bitSet(PRR, PRADC); // power down the ADC
      PRR = bit(PRTIM1) | bit(PRUSI) | bit(PRADC); // only keep timer 0 going
       
      pinMode(DIO1, INPUT);       //set the pin to input
      digitalWrite(DIO1, HIGH); //use the internal pullup resistor
      PCMSK0 |= (1<<PCINT2); //  tell pin change mask to listen to (DIO1)
      GIMSK  |= (1<<PCIE0); // enable PCINT interrupt in the general interrupt mask

      sei();


 
}


Der Rest des Codes ist unerheblich.

Wer hat da eine gute Idee wie man das Entprellen vernünftig wegbekommt?

Vielen Dank.

Gruß kami
Pages: [1] 2