Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Sensors / Re: Dallas temperature sensor DS18S20 with the ATmega32-16PU on: May 19, 2014, 03:21:42 pm
Thanks michinyon for your explanation.

No, there is no output about that it detected a one-wire device.

Just a remark for my setup.
I use an UBSTinyISB to flash the controller which is an ATmega32-16PU and you find the corresponding datasheet here:

When I looked at your answer I think you mixed up the ATmega32-16PU with the ATmega328P. The latter uses PD0 and PD1 for RX/TX, respectively and is used within the Arduino.
2  Using Arduino / Sensors / Re: Dallas temperature sensor DS18S20 with the ATmega32-16PU on: May 18, 2014, 11:31:58 pm
No, that didn't help.
When I use ...

#define ONE_WIRE_BUS 12

and connect it to pin #12 there is no response.

I tried it with other pins, for example #0, #1 without success.

When you take a look into the pins_arduino.h of the mega32 library which I use you see the following array:

const uint8_t PROGMEM digital_pin_to_port_PGM[32] = {
PB,  // PB0 ** D0
PB,  // PB1 ** D1
PB,  // PB2 ** D2
PB,  // PB3 ** D3
PB,  // PB4 ** D4
PB,  // PB5 ** D5
PB,  // PB6 ** D6
PB,  // PB7 ** D7
PD,  // PD0 ** D8
PD,  // PD1 ** D9
PD,  // PD2 ** D10
PD,  // PD3 ** D11
PD,  // PD4 ** D12
PD,  // PD5 ** D13
PD,  // PD6 ** D14
PD,  // PD7 ** D15
PC,  // PC0 ** D16
PC,  // PC1 ** D17
PC,  // PC2 ** D18
PC,  // PC3 ** D19
PC,  // PC4 ** D20
PC,  // PC5 ** D21
PC,  // PC6 ** D22
PC,  // PC7 ** D23
PA,  // PA7 ** A0 D24
PA,  // PA6 ** A1 D25
PA,  // PA5 ** A2 D26
PA,  // PA4 ** A3 D27
PA,  // PA3 ** A4 D28
PA,  // PA2 ** A5 D29
PA,  // PA1 ** A6 D30
PA,  // PA0 ** A7 D31

Now you can see why I suspected that it has to be pin # 18 at the ATmega. D12 is mapped to PD4 which is pin #18 at the ATmega.

It seems that there is another reason why it does not work.
3  Using Arduino / Sensors / Re: Dallas temperature sensor DS18S20 with the ATmega32-16PU on: May 18, 2014, 12:02:21 am
you need to tell the software which pin you connected to .   12 or 18 ?

When I use the famous blink sketch and put it like this ...

int led = 12;

... it blinks. So, I think the software already got the right pins.

Or, whereabout in the code is it necessary ?
4  Using Arduino / Sensors / Dallas temperature sensor DS18S20 with the ATmega32-16PU on: May 17, 2014, 02:26:32 pm
I want to use the ATmega32-16PU together with a Dallas temperature sensor DS18S20.
I connected the data line of the DS18S20 to PIN 18. Within the code I use:

#define ONE_WIRE_BUS 12

See attached sketch. It's the the one that comes with the Arduino Library for Dallas Temperature ICs.

The answer I get on serial is the following:

Requesting temperatures...DONE
Temp C: -127.00 Temp F: -196.60

Whe I pull out the data line I get the following answer:

Requesting temperatures...DONE
Temp C: 0.00 Temp F: 32.00

So I know at least it's the right pin.

I know the sensor is ok because I checked it with an Arduino UNO just after the trial with the ATmega32-16PU.

Are there any incompatibilities with OneWire or is it the wrong port I used at the ATmega32-16PU ?

Thanks for your help.
Regards, AgeBee
5  Using Arduino / Microcontrollers / Re: pin mapping of the ATmega32-16PU on: May 12, 2014, 03:19:36 pm
Thanks CrossRoads for your quick reply.
My fault was that I looked up D31 in the picture and thought that this is the pin I have to hook up the input of the poti.

I should have looked up the line where it reads

PA,  // PA1 ** A6 D30

in pins_arduino.h (line 129) seeing that this the one before the last which is physical pin 39 (PA1).
6  Using Arduino / Microcontrollers / pin mapping of the ATmega32-16PU on: May 12, 2014, 10:11:44 am
I would like to get your help on the pin mapping of the ATmega32-16PU.
I use the library from here together with the an USBTinyISB to program this processor with the attached sketch.
My hardware setup is pretty easy (see attached picture).
There is a LED attached to pin 19 of the ATmega32-16PU and a potentiometer attached to +5 V and ground with the slider going to pin 39. I can now adjust the blink rate.
However, that does not match with the pin mapping which I find the pins_arduino.h which reads like this:
                        ATMEL ATmega32
     (XCK/T0) D0 PB0 01|        |40  PA0 AI7 D31 (ADC0)
         (T1) D1 PB1 02|        |39  PA1 AI6 D30 (ADC1)
  (INT2/AIN0) D2 PB2 03|        |38  PA2 AI5 D29 (ADC2)
  (OC0/AIN1) D3 PB3 04|        |37  PA3 AI4 D28 (ADC3)
       (SS) D4 PB4 05|        |36  PA4 AI3 D27 (ADC4)
     (MOSI) D5 PB5 06|        |35  PA5 AI2 D26 (ADC5)
     (MISO) D6 PB6 07|        |34  PA6 AI1 D25 (ADC6)
      (SCK) D7 PB7 08|        |33  PA7 AI0 D24 (ADC7)
                 RESET 09|        |32  AREF
                   VCC 10|        |31  GND
                   GND 11|        |30  AVCC
                 XTAL2 12|        |29  PC7 D23 (TOSC2)
                 XTAL1 13|        |28  PC6 D22 (TOSC1)
          (RXD) D8 PD0 14|        |27  PC5 D21 (TDI)
          (TXD) D9 PD1 15|        |26  PC4 D20 (TDO)
        (INT0) D10 PD2 16|        |25  PC3 D19 (TMS)
        (INT1) D11 PD3 17|        |24  PC2 D18 (TCK)
        (OC1B) D12 PD4 18|        |23  PC1 D17 (SDA)
        (OC1A) D13 PD5 19|        |22  PC0 D16 (SCL)
        (ICP1) D14 PD6 20|        |21  PD7 D15 (OC2)

Why is the pin number in the sketch (const int potPin = 31;) not pin 40 at the ATmega32-16PU ?
Thanks for your help in advance.
Regards, AgeBee
7  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.
#include <SoftwareSerial.h>

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

int led = 13;

void setup() {               

  while (!Serial);

  pinMode(led, OUTPUT);   

void loop() {
  digitalWrite(led, HIGH);   
  digitalWrite(led, LOW);   
8  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:

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.
9  Using Arduino / Microcontrollers / Arduino Micro with XBee on: April 12, 2014, 05:40:17 am
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 ..

while (!Serial) {};

recommended for the Arduino Micro.

Complete coding is as follows:

void setup() {
  while (!Serial) {};   

void loop()

I suspect here some specialities with the Arduino Micro.

Thanks for your help.
Regards, AgeBee
10  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
11  Using Arduino / Microcontrollers / Re: ATMega328P-PU with the USBTinyISB on: April 10, 2014, 12:13:24 am
thanks mart256 and Ray for your interest in my problem.

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 ?

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
12  Using Arduino / Microcontrollers / Re: ATMega328P-PU with the USBTinyISB on: April 06, 2014, 12:16:43 am
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
13  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.
14  Using Arduino / Microcontrollers / ATMega328P-PU with the USBTinyISB on: April 04, 2014, 03:48:29 am
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)
GND -> GND (PIN 8)
SCK -> SCK (PIN 19)

I use the following entry in boards.txt:



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 ?
15  Using Arduino / Microcontrollers / Re: Arduino Micro with MicroSD card breakout board (Adafruit) on: April 01, 2014, 03:30:01 pm

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
Pages: [1] 2 3 4