Hey guys,
So I’ve made a custom board for a project, based on the Arduino Pro Mini. It’s a simple ATMEGA328 (tried with 328P and PB) connected to a VL53L0X sensor via i2C. Based on the input of a trimmer and the sensor, a motor is triggered (I’m using a LED for now).
It does work on the beginning, but after a while the board starts to reboot. It gets back working again after messing with some components (until fail again), but I could not identify what is exactly. The problem appears on every board that I’ve built.
Could be something related to the regulator and capacitors, I tried different value but I couldn't make it work.
If anyone have any suggestion, I would be grateful, Thanks
Your diagram shows a 5v input to the regulator which has an internal voltage drop of about 0.6v so I would check the actual output voltage of the regulator under load, it may be the voltage is dropping out or dropping below the MCU requirement. The reg is specified for 5v out at 6v in (datasheet).
There may be something in your code that is causing the VL53 to stop sensing - can't tell without the code.
A couple things that can cause your micro to reset by itself:
- Somehow its supply voltage falls below the brown out detection voltage. This seems like the likeliest thing, if you take into account the lack of decoupling caps right next to the ATmega328 and the dropout voltage of the regulator as mentioned by the last couple commenters.
Do you know what the BOD setting is on the bootloader you're using? On the pro mini 8 Mhz it's 1.8V, but you've got a 16 Mhz crystal so you probably aren't using that one. If you're using a standard Uno bootloader your BOD setting is 2.7V. You could hit that V if the motor is causing your rail voltage to droop when your motor slurps up big gulps of current from your power supply.
If this IS happening, try adding bigger decoupling capacitors, maybe supply your motor from a separate supply and potentially change the brown out detection voltage to 1.8V by changing the fuses (if you do this one you might wanna drop the frequency from 16 Mhz because 1.8V isn't even close to being enough to run the ATMega328 at 16 Mhz, so you might run into problems before the BOD kicks in).
By the way, I don't know of it causing resets, but 16 Mhz is not officially supported if you're feeding the micro anything less than 4.5V either. What is Vcc? It looks like U4 is a 5V regulator, but you're feeding 5V into it. You're not going to get 5V out of it . . .
- Your reset line might be picking up noise. I've had some micros in very noisy environments where a 10k pullup wasn't enough to prevent random resets. Motors can be quite noisy. Try a 1k instead or something.