Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Microcontrollers / Re: Arduino Micro with XBee on: April 12, 2014, 03:19:47 pm
Found the solution !
Since the Arduino Micro is connected through a USB cable I can't use PINs 0 and 1 since the USB uses them.
I used SoftwareSerial to get me two other PINS, 8 and 9.

Code is like this, I used a LED to check optically.
Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(7, 8); // RX, TX

int led = 13;

void setup() {               

  while (!Serial);

  pinMode(led, OUTPUT);   
  Serial.begin(9600); 
  mySerial.begin(9600);
}

void loop() {
  digitalWrite(led, HIGH);   
  mySerial.println(millis());
  delay(1000);               
  digitalWrite(led, LOW);   
  Serial.println(millis());
  delay(1000);
}
2  Using Arduino / Microcontrollers / Re: Arduino Micro with XBee on: April 12, 2014, 02:39:57 pm
Two remarks:
1) I made a mistake in the coding. It must read:

Code:
while (!Serial) ;

However, this  does not change the result, i.e. I still can't see any output at the second XBee.

2) I see the TX LED flashing on the Arduino Micro.

So, it seems to me, that the data do not reach the XBee.
3  Using Arduino / Microcontrollers / Arduino Micro with XBee on: April 12, 2014, 05:40:17 am
Hi,
I can't get an XBee talking when hooked up to the Arduino Micro. I know this because I do not see another XBee at another computer listening to the one connected to the Micro.
I use an XBee Pro S1 connected to the Arduino Micro as shown in the picture attached.


When I connect the XBee with the Arduino UNO it works perfectly and I see the output on another computer. So this is the evidence I connected it properly.
I changed TX and RX already without effect. And I use the line ..

Code:
while (!Serial) {};

recommended for the Arduino Micro.

Complete coding is as follows:

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

void loop()
{
 Serial.println(millis());
 delay(1000);
}

I suspect here some specialities with the Arduino Micro.

Thanks for your help.
Regards, AgeBee
4  Using Arduino / Microcontrollers / Re: ATMega328P-PU with the USBTinyISB on: April 10, 2014, 01:41:34 pm
Hi Ray, mrburnette, mart256,

With Rays ...
ATmega328 on a breadboard (16MHz Xtal)

... I get the answer:
avrdude: stk500_recv(): programmer is not responding

With Rays ...
ATmega328 on a breadboard (8 MHz internal clock)
... I get the answer:
In file included from Blink.ino:10:
Arduino.h:213:26: error: pins_arduino.h: No such file or directory

With my entry mentioned above I get:

avrdude: Error: Invalid -P value: '/dev/ttyS4'
         Use -P usb:bus:device
         
However, I get it on the chip with the command line version:
sudo ./avrdude -c usbtiny -C avrdude.conf -p m328p -U flash:w:Blink.cpp.hex

The quartz and the two capacitors were necessary, however it was not necessary to use the 10 k pull-up from RESET to Vcc. It worked with and also without the resistor. The RES of the USBTinyISB was directly connected to PIN 1 of the ATMega328.

So it seems to me that the problem is in the boards.txt where I do not use the prober values.

Nevertheless it works now.
I'll still keep on working for a solution with/over the Arduino.
Thanks guys for your kind help.
Regards, AgeBee
5  Using Arduino / Microcontrollers / Re: ATMega328P-PU with the USBTinyISB on: April 10, 2014, 12:13:24 am
Hi,
thanks mart256 and Ray for your interest in my problem.

@mart256:
The programmer powers the chip up, yes, that's correct and I wired it up as you described it. PIN 7 and PIN 20 with Vcc and PIN 8 and 22 with GND.
However, I did not use a 10k pull-up resistor for the RESET PIN. I connected it directly to RESET of the ISB 6-pin header (PIN 5). Could this be the solution ?
And yes, the chip flashes properly within the Arduino UNO. In one of my tries I used a 16 MHz quartz together with two capacitors to GND. But this did not help.

I'll try two things tonight. First, the 10 k pull-up resistor and then the 'direct' flash with avrdude, i.e. not using the Arduino UNO between it. Just your posted command line.

You suggested erasing it beforehand. This works with the -e switch, right ?

@Ray:
I got me the USBTinyISB because it was said that it works flawlessly. Actually it did and I can remember using it for the ATMega328 nearly two years ago with the Arduino IDE 1.0.0. But since then a couple of things had changed (at least my operating system, Arduino IDE).

Regards, AgeBee
6  Using Arduino / Microcontrollers / Re: ATMega328P-PU with the USBTinyISB on: April 06, 2014, 12:16:43 am
Ray,
thanks for posting me your settings but neither one did help.
When I used your 'internal' breadboard ATmega328 settings I get the error:

Arduino.h:213:26: error: pins_arduino.h: No such file or directory

When I use the ATmega328 on a breadboard (16MHz Xtal) I get:

avrdude: stk500_recv(): programmer is not responding

There must be one setting which prevents reaching my ATMega328.
BTW, I took another chip and tried with that one. Same negative result. The chip however could flawlessly flashed within an Arduino UNO.

I will keep on searching and let you know when I found a solution.
Regards, AgeBee
7  Using Arduino / Microcontrollers / Re: ATMega328P-PU with the USBTinyISB on: April 05, 2014, 01:01:24 am
Thanks Ray for your response.

Adding power and GND didn't solve the issue.
However, I get another response:
avrdude: stk500_recv(): programmer is not responding

What still troubles me is the fact that it works with ATTiny2313 but not with the ATMega328P. I strongly believe that the entry in boards.txt is wrong.
8  Using Arduino / Microcontrollers / ATMega328P-PU with the USBTinyISB on: April 04, 2014, 03:48:29 am
Hi,
I got the following setup to flash a sketch to the ATMega328P-PU with the USBTinyISB v3.0.
Linux, Arduino IDE 1.0.5, ATMega328P-PU on a separate board with no additional hardware (like the quartz, capacitors), 5 Volts to the Vcc and GND Pins is measured.
The wires go from the USBTinyISB 6-PIN header to the ATMega328P-PU like this.

VTG -> Vcc (PIN7)
MOSI -> MOSI (PIN17)
GND -> GND (PIN 8)
MISO -> MISO (PIN 18)
SCK -> SCK (PIN 19)
RST -> RESET (PIN 1)

I use the following entry in boards.txt:
Code:
atmega328p-16.name=ATmega328p

atmega328p-16.upload.protocol=usbtiny
atmega328p-16.upload.using=USBtinyISP
atmega328p-16.upload.maximum_size=32768
atmega328p-16.upload.speed=19200

atmega328p-16.bootloader.low_fuses=0xff
atmega328p-16.bootloader.high_fuses=0xDE
atmega328p-16.bootloader.path=atmega328p
atmega328p-16.bootloader.file=optiboot_atmega328.hex
atmega328p-16.bootloader.extended_fuses=0x05
atmega328p-16.bootloader.lock_bits=0xFF

atmega328p-16.build.mcu=atmega328p
atmega328p-16.build.f_cpu=16000000L
atmega328p-16.build.core=arduino:arduino
atmega328p-16.build.variant=arduino:standard

I get the following error when I try to upload the sketch:

avrdude: Error: Invalid -P value: '/dev/ttyS0'
         Use -P usb:bus:device

Seems to me that I choose the wrong port. But: When I hook up the ATTiny2313 it works great.
I am not offered to choose a different Serial Port in the menu of the Arduino IDE.
Do the AVCC (PIN 20) and GND (PIN 22) have to be connected additionally ?
How can it be possible that the same hookup does not work for the ATMega328 ? Maybe it's the board entry ??

Thanks for any pointers to solve that problem ?
Regards
AgeBee
9  Using Arduino / Microcontrollers / Re: Arduino Micro with MicroSD card breakout board (Adafruit) on: April 01, 2014, 03:30:01 pm
Hi.

Have another look at your picture and at the comments in your sketch.
I don't know where you got that pinout in your picture, but it shows pins for MISO MOSI and SCK, and you need these pins.
Are you sure you have the right pins ?

The pins that can be found here (scroll down a bit), show that you might have the correct pins, but assigned the wrong functions to it.
In that case you mixed up DO (or MOSI) and SCK.
And that is when i'm just looking at the pin positions of the Micro, and not at the other function descriptions in your picture.

Be sure to use a correct reference when deciding which pins you are going to use.

Hi MAS3,
you were damned right. I had the a wrong wiring. Thank you very much for your help. I really appreciate that.
Just to remind others I attached a picture of the correct wiring.
Regards, AgeBee
10  Using Arduino / Microcontrollers / Re: Arduino Micro with MicroSD card breakout board (Adafruit) on: March 31, 2014, 06:20:41 am
Hi JoeN,
thanks for your reply.
I switched over to the Arduino UNO to check if it's an error with the card or other things. It works perfectly with the Arduino UNO.
So this seems to be an issue with the Micro.
I'll give it another try with another PIN and post my reply here.
Regards, AgeBee
11  Using Arduino / Microcontrollers / Arduino Micro with MicroSD card breakout board (Adafruit) on: March 29, 2014, 03:16:10 pm
Hi,
I try to get the Card Info sketch running which I did not modify besides the line where the chipSelect PIN is choosen.
I put it to: const int chipSelect = 10;   

See the wiring as in attached diagram. The text color of the SD card terminals is red and the text stands close to the Arduino Micro terminals.

When I run the sketch I come into the !card.init section which tells me that something went wrong.

Does anybody has an idea what's wrong here ? Was the wiring correct ? Did I choose the right chipSelect PIN ?
Thank you
Regards
AgeBee


Code:
/*
  SD card test
   
 This example shows how use the utility libraries on which the'
 SD library is based in order to get info about your SD card.
 Very useful for testing a card when you're not sure whether its working or not.
 
 The circuit:
  * SD card attached to SPI bus as follows:
 ** MOSI - pin 11 on Arduino Uno/Duemilanove/Diecimila
 ** MISO - pin 12 on Arduino Uno/Duemilanove/Diecimila
 ** CLK - pin 13 on Arduino Uno/Duemilanove/Diecimila
 ** CS - depends on your SD card shield or module.
  Pin 4 used here for consistency with other Arduino examples

 
 created  28 Mar 2011
 by Limor Fried
 modified 9 Apr 2012
 by Tom Igoe
 */
 // include the SD library:
#include <SD.h>

// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile root;

// change this to match your SD shield or module;
// Arduino Ethernet shield: pin 4
// Adafruit SD shields and modules: pin 10
// Sparkfun SD shield: pin 8
const int chipSelect = 10;   

void setup()
{
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  Serial.print("\nInitializing SD card...");
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
  // Note that even if it's not used as the CS pin, the hardware SS pin
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output
  // or the SD library functions will not work.
  pinMode(10, OUTPUT);     // change this to 53 on a mega


  // we'll use the initialization code from the utility libraries
  // since we're just testing if the card is working!
  if (!card.init(SPI_HALF_SPEED, chipSelect)) {
    Serial.println("initialization failed. Things to check:");
    Serial.println("* is a card is inserted?");
    Serial.println("* Is your wiring correct?");
    Serial.println("* did you change the chipSelect pin to match your shield or module?");
    return;
  } else {
   Serial.println("Wiring is correct and a card is present.");
  }

  // print the type of card
  Serial.print("\nCard type: ");
  switch(card.type()) {
    case SD_CARD_TYPE_SD1:
      Serial.println("SD1");
      break;
    case SD_CARD_TYPE_SD2:
      Serial.println("SD2");
      break;
    case SD_CARD_TYPE_SDHC:
      Serial.println("SDHC");
      break;
    default:
      Serial.println("Unknown");
  }

  // Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32
  if (!volume.init(card)) {
    Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
    return;
  }


  // print the type and size of the first FAT-type volume
  uint32_t volumesize;
  Serial.print("\nVolume type is FAT");
  Serial.println(volume.fatType(), DEC);
  Serial.println();
 
  volumesize = volume.blocksPerCluster();    // clusters are collections of blocks
  volumesize *= volume.clusterCount();       // we'll have a lot of clusters
  volumesize *= 512;                            // SD card blocks are always 512 bytes
  Serial.print("Volume size (bytes): ");
  Serial.println(volumesize);
  Serial.print("Volume size (Kbytes): ");
  volumesize /= 1024;
  Serial.println(volumesize);
  Serial.print("Volume size (Mbytes): ");
  volumesize /= 1024;
  Serial.println(volumesize);

 
  Serial.println("\nFiles found on the card (name, date and size in bytes): ");
  root.openRoot(volume);
 
  // list all files in the card with date and size
  root.ls(LS_R | LS_DATE | LS_SIZE);
}

void loop(void) {
 
}
12  International / Deutsch / Re: Problem mit TimerAlarm on: January 05, 2014, 03:00:40 pm
Grund für die Verwendung von Alarm.delay(...) ist, daß die Alarme ja auch von Deinem gewünschten Delay mitbekommen müssen. Und das ist nur dann gewährleistet, wenn Du den Delay der Alarm-Klasse bekannt gibst.
Letztlich wird das durch iterierten Aufruf der serviceAlarms-Methode in der Klasse TimeAlarms gemacht.
13  International / Deutsch / Re: Problem mit TimerAlarm on: January 05, 2014, 02:45:11 pm
Guten Abend funkedelic,
ja, richtig erkannt. Du mußt Alarm.delay(...) verwenden ansonsten funktioniert der Alarm nicht.
Gruß
AgeBee
14  Using Arduino / Programming Questions / Re: TimeAlarms usage in a class function on: January 01, 2014, 12:14:35 pm
Quote
Do I need to tell Alarm the surrounding namespace ?
No. You need to make the function that Alarm calls static. When the alarm goes off, the Alarm class has no idea which instance of your class it is to call a method for.
Thanks a lot Paul, that helped.
Let me put the reason for your solution in my words so everyone would have a take-away from that case:

If there were more intances of Someclass the program would not know to which instance the call of anotherFunc belongs to.
Therefore the function is made static which has the effect that there is only one method belonging to every instance (if there were more). And now there is no doubt.

Correctly explained ?
15  Using Arduino / Programming Questions / TimeAlarms usage in a class function on: January 01, 2014, 08:01:25 am
Hi,
I get the following error if I use the Alarm.alarmRepeat(...) within a member function of a class declared within my sketch:

Code:
sketch_jan01a.ino: In member function ‘void Someclass::func()’:
sketch_jan01a:16: error: no matching function for call to ‘TimeAlarmsClass::alarmRepeat(int, int, int, <unresolved overloaded function type>)’
/home/agebee/arduino-1.0.5/libraries/TimeAlarms/TimeAlarms.h:69: note: candidates are: AlarmID_t TimeAlarmsClass::alarmRepeat(time_t, void (*)())
/home/agebee/arduino-1.0.5/libraries/TimeAlarms/TimeAlarms.h:70: note:                 AlarmID_t TimeAlarmsClass::alarmRepeat(int, int, int, void (*)())
/home/agebee/arduino-1.0.5/libraries/TimeAlarms/TimeAlarms.h:71: note:                 AlarmID_t TimeAlarmsClass::alarmRepeat(timeDayOfWeek_t, int, int, int, void (*)())

The sketch is here:
Code:
#include <Time.h>
#include <TimeAlarms.h>
     
class Someclass {

public:
  Someclass()
  {
    //ctor
  }
  void func()
  {
    Alarm.alarmRepeat(17,58,00,anotherFunc);
  }
  void anotherFunc()
  {
    Serial.println("anotherFunc");
  }
};

void setup() {
  Alarm.alarmRepeat(17,58,00,call);
}

void loop()
{
  delay(1000);
}
void call()
{
  Serial.println("call");
}

Using Alarm.alarmRepeat in the main part of my sketch works perfectly.

Do I need to tell Alarm the surrounding namespace ?
Thanks for your help.
Pages: [1] 2 3 4