Sensor With ATMega328

Hello
Hello partners
I am making a sensor with the Atmega328 and I want to put it on a PCB.

I have seen videos, even on the arduino page there are the steps to load the program to a microcontroller.
My question is the following, I can load the program in my microcontroller with the official electronic configuration. And then remove the microcontroller and put it on a PCB, there on the PCB I designed it so that it had the reset button, so that when I install the components and connect the power to the sensor, I hit the reset button and this program begins to run .

Is this practice okay?

Yes

1 Like

Thanks <3

Hello Ignacio,
I'm doing a similar project - designing a PCB for an ATMEGA16U2, so I here's a few tips to help you get started :slight_smile:

If your plan is to remove the ATMEGA328P from an Arduino, like this and place it in an 28 Pin IC Base on your PCB,

Then you'd need to add a crystal oscillator like this for the 16Mhz clock, also it's a good idea to use a voltage regulator to give 5V to the VCC Pin.

Also it's best not to leave the Reset pin floating so use a pull-up resistor and an optional pushbutton, if you'd like.

That's all I can think of now, this is my first post on the Arduino forum, I've been using it for years and today I thought it's time I started to give back to the community.
So good luck on your project and have a good day!

Supun

1 Like

Thank You, for you help.Have a nice day

So Bad I have this problem.
I follow this steps

And yes my microcontroller have the boatloader Uno

Hello,
Sorry I didn't see your reply till today, I ran into a problem with my project, fixed it now. :grin:

So it seems the error code 0x09 means the computer can't talk to the microcontroller.
There's a couple of things that come to mind that you could try.

First make sure you selected the correct board AND processor from Tools -> Board and Tools -> Processor.
If you're programming an ATMEGA168, Duemilanove and Nano boards used to have them so make sure the processor is correctly selected in Tools -> Processor, the default is processor is ATMEGA328, change that to ATMEGA168.

Another thing I would make sure is that all the connections are working, use a multimeter in continuity mode (beep mode) to check all the connections, especially the crystal.

I think you already knew this, just making sure, :slight_smile:
Is the crystal oscillator 16Mhz ? Because the Uno bootloader is designed for a 16Mhz clock. The ATMEGA168 can run on other frequencies of course, but you'd need to change the bootloader.

If nothing works, you could program the ATMEGA through SPI (MOSI, MISO, CLK), but it'd be nice to figure out what went wrong with this approach.

It's been 3 days, probably you've solved this problem by now, so good luck with your project and have a nice day!

Supun

1 Like

Hi thanks for answer. And dont worry haha
I hve other problems in my project So I still haven't been able to fix it. My arduino is the UNO R3