I am using the Arduino IDE version 1.8.1 and want to upload a sketch to an old ATMEGA168 I have found. Which board should I select in the IDE? I have tried the Uno and Duemilanove but neither work. Alternatively, how do I add the ATMEGA168 board to the IDE?
There are a bunch of ATmega168 boards. Which to chose depends on the clock speed of your ATmega168 (16 MHz or 8 MHz). If you're trying to upload over a USB to TTL serial adapter, it also depends on the speed at which your bootloader communicates at. If you don't know that, you could connect an ISP programmer and do a Tools > Burn Bootloader, after which you will know which bootloader is on it but you need to make sure the board you have selected has a matching configuration to your hardware. So, without more information, we can't give you an answer.
It is possible to add a new board to the IDE. You can find the documentation here:
However, there is already a nice hardware package that supports most any hardware configuration for the ATmega168 so you might consider using that instead:
If you're trying to upload over a USB to TTL serial adapter, it also depends on the speed at which your bootloader communicates at.
I'm sorry but you've thrown me there. I am trying to upload a sketch from the Arduino IDE 1.8.1, over USB, to a ATMEGA168. Just like I upload sketches to my Arduino UNO, Mega and Leonardo. I have never had to be concerned about the USB to serial adaption with those boards.
Then there is a USB to serial adapter on the board.
Where did this board come from? Is it something you made yourself? If so, then presumably you would know whether it uses the internal oscillator or an external clock source (and what the speed of that clock is). Is it something you bought? If so, then tell us what it is.
It is an old ATMEGA168 16Mhz board that was given away with a book about programming the Arduino published by the German publisher Franzis. https://www.amazon.co.uk/Franzis-Arduino-Tutorial-Kit-Manual/dp/3645652795.
I've found the solution now: You have to select the "Deumilanove or Diecimila" board and then another item opens in the menu for you to select the Processor "ATM168".