# Atmega328 AU has a low Voltage output pin

For a project I am programming an Atmega 328 AU on a custom made PCB. After a lot of struggles I managed to get a bootloader and a program on the chip. I programmed some IO pins and they seem to work fine. The output pins that I use give: LOW = 0 Volt High = 5 Volt which is desired. However, one pin, pin 9 of the chip, gives: LOW = 0 Volt, HIGH = 1 Volt. The 1 Volt does not trigger my opto-coupler so I would like this pin also to give HIGH = 5 Volt. Is there any way to change this in software?

I use the Arduino IDE for programming.

Thank you guys.

edit: Still not figured out. Ill add some schematics. Note: The supply is not that flat with my own power supply, but I could add a bigger capacitor. However, for the opto-coupler is does not matter and the output will correctly trigger the opto-coupler for the 5V.

• You'll need to show your circuit. How much current does your opto-coupler draw? Have you added current limiting resistors/ – Tom Carpenter Jan 13 at 14:05
• Pin 9 has alternate functions for crystal. Check your clock fuse bits to make sure you have the correct setting. – jwh20 Jan 13 at 14:12
• All my outputs use the same output circuit. A 330 ohm resistor in series with the opto coupler LED and then to GND. Only one output is a plain 1 Volt steady measured at the microcontroller. The microcontroller outputs have steady 5 Volts. – WillyBogard Jan 13 at 14:13
• @jwh20 I see, but I wonder is it possible to alter its function to get a 5 Volt out? – WillyBogard Jan 13 at 14:14
• Yes, check your fuse bits. – jwh20 Jan 13 at 14:24

The package type of ATmega328-AU is Plastic Thin Quad Flat Package (TQFP). The pin configuration is different from the 28 SPDIP package types. On 28 SPDIP package, pins 9 and 10 are crystal input. In this case, you could not be used like Arduino Pin.

On Atmega328-AU is different, you can use Pin 9 like Arduino Pin 5.

Your test code can be like this:

void setup() {
pinMode(5, OUTPUT);
digitalWrite(5, HIGH);
}

void loop() {
}


Thank you all for helping me! I do have the TQFP package. However I found the problem which was actually stupid. The outputs where listed:

pinMode(pinNumberA, OUTPUT); pinMode(pinNumberB, OUTPUT); pinMode(pinNumberC, OUTPUT); pinMode(pinNumberD, OUTPUT);

But I seemed to only have listed 4 outputs out of 5. One of the outputs I forgot. So after seeing lmcapacho's post I did check again so thank you! Problem is solved.