How to setup Arduino to 8mhz properly?


I have uploaded optiboot bootloader to my nano via ISP. My arduino IDE detects the board as optiboot 8MHz.Also I have selected the optiboot on 32 pin cpu (I have a 328p-au) in the ide.Ok.

But millis() is not accurate (my 1min counter (at 16mhz), only count 48.5sec in order a min when running at 8mhz.
Also IRremote works in a unreliable mode, sometimes receives ok and other times, don´t receive anything. At 16mhz all work as expected.

I should configure something more? What´s the problem with IRremote?

Thanks in advance!

Why do you need this specific bootloader?

@anon77129126 , what are the other ways to configure the 328p to 8mhz, with accurate millis() ? Please could you provide me any example or a link?

This forum post should help.

Run the ATmega328 from an external 8Mhz resonator or crystal.

@srnet , an external oscillator adds components and increments price, the internal clock would be perfect for my project if IRremote is working in a reliable form.

install the MiniCore Boards.
burn a bootloader with internal 8Mhz

Hello again, I tried a lot of things and finally I found that the IRremote problem is produced by a bjt NPN attached to pin 6 in PWM mode, the transistor is BC547 (max 100mA) and it is used to power (with GND) a 5v@200mA fan, and also was added a transients protection diode between GND (from the bjt output) and +5V . If change the bjt, resistor, fan and the diode, and if I connect a led with the mandatory resistor, all work as expected both 16Mhz and 8Mhz (except millis, that is not accurate, isn´t a problem). So the internal clock is not the problem, it´s hardware problem.

This will be posted in the hardware section, in adittion, if anyone can tell me a theory of what is happening would be great :slight_smile:


Don’t double post !!!!!

You need to post a circuit diagram - sounds like you are powering stuff from the Arduino itself , a common cause of problems

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.