Homemade Arduino Schematic

Hi All!
I want to say I really appreciate all the support this forum has given me, there are some great people on here.
I am currently designing a custom PCB that integrates an MPU6050 chip with an ATMEGA328P-PU. The idea is that the accelerometer values will be sent over bluetooth to a computer where they will be mapped onto different frequenices, enabling the user to make their own music by moving the device.
I have laid out a schematic and if anyone has any time, I would be grateful if they could point out any obvious errors or areas where I could improve it. I'd be grateful for any input!

The general layout:
Headers - It has three headers. One to allow it to be programmed by an FTDI module, another to be powered by a 9V battery, and a final one to connect to a HC-05 bluetooth module.
Voltage regulators - It has a 5V voltage regulator to supply the ATMEGA and a 3.3V regulator to feed to the MPU6050.
Power selection: I have added a comparator circuit - equivalent to the arduino UNO one - to select between the battery and the FTDI module. (When the battery voltage/2 is less than 3.3V it will switch to be powered by the FTDI (I have essentially just replaced the USBVCC on arduino uno with FTDI voltage)
The other areas include; a potential divider circuit which is needed between the TX pin of the ATMEGA and the header pin feeding into the RX pin of the HC-05. A ceramic resonator circuit for the ATMEGA, and a reset circuit.
I have attached the 4 parts to the schematic because the resolution of the whole thing was poor.




There are notes at the top of the schematic for any guidance.
You can ignore the italics underneath components they are for my reference.

If you are short on time; here are the key areas to look at:

  • Power selection circuit
  • Reset Circuit
  • Voltage regulator circuit - checking I can use RAW (voltage from the battery) as the input.

Questions:

  1. Did I need the comparator circuit? I included it because I was worried that when the FTDI module was plugged in, since it would feed directly to +5V, it would compete with the output of the 5V regulator circuit (from the battery)
    and damage it by sending a higher current back through. If I don't have the comparator, what would happen if I plugged both the battery and FTDI module in at the same time? Is there a better way to choose between what powers the board? I was cautious of using a diode on the ouput of the regulator because I already had one at the input and did not want another voltage drop.

  2. The power selection package comes with two op amps - U4A and U4B on my board. Since I only needed one of the op amps, I just copied what the arduino uno did with the other and used it for the 'blink LED' circuit. However I did not even want this. Is there a way to disconnect it completely so I can save space?

  3. Is my reset circuit correct? I did not want a reset button but I was worried I still needed a ground for the capacitor to discharge through.

  4. Does anyone know what the MNT connections are on the battery header. It is a surface mount 2POS header, but I was wondering why it had 4 connections. Here is the link B2B-PH-SM4-TB(LF)(SN) Jst (japan Solderless Terminals), Pin Header, Wire-to-Board, 2 mm | Farnell UK

Obviously this is a tremendous amount of information and I am not expecting anyone to read it all. So any response about anything you can point out is wrong or needs improving would be awesome.
Thanks!

Where is the Bluetooth ?
Would a ESP32 be better ? Or a ESP32-C3

The DTR via the capacitor can put the RESET pin into HV (High Voltage) programming mode and that can corrupt the Flash. If you look at the schematic of the Arduino Uno, then you see a diode there.

Do you have a 3.3V or a 5V I2C bus ? Both are not good.

Can you buy the ATmega328P ? When is it expected to arrive ? Over half a year ? Are you sure ?

The MPU-6050 is outdated, noisy and no longer made. I think you pay extra for those that are still available. If you buy it from Ebay/AliExpress/Amazon, then they are counterfeit.

Have verified the function by a working prototype on, for instance, a breadboard?

1 Like

Run the ATmega on 3.3V and all the troubles with interfacing 3.3V sensors or the radio go away.

There is no good reason to have the 5V regulator on the board.

As pointed out above, the MPU-6050 has long been obsolete and you can only buy cheap clones or outright counterfeits. Use a modern 6DOF sensor from a reliable source instead.

Hey thanks for the detailed reply!
I have updated the reset circui, do you think this is more suitable?
reset

Regarding the I2C bus line, why does this pose a problem? Isn't the bus line necessary to connect the two chips, what other way would I do it?

Yes I am finding out the MPU6050 is noisy!

Thanks.

Not yet I haven't got all the components.
Thanks for the reminder though.

Thanks for this suggestion. I will look into it

With the protection diode at the RESET is better :smiley:

If the 3.3V sensor has a I2C bus for which SDA and SCL are either 0V or 3.3V and the ATmega chip needs 3.5V to see it as a high level, then it is outside the limits of the datasheet. It will work in real life but you lost the noise margin. The ATmega chip has internal pullup resistors to 5V, which leak current into the SDA and SCL of the sensor.

Good idea. 5V will very soon be a thing of the past for MCUs.

The nano IOT has a built in acceleration chip and blue tooth built in , worth a look as it will do most (all) of what you want

Glad to see a potential divider for the HC-05 RX. I never used to bother with it and never had any issues, but recently I've changed to HC-08's (HC-05 are rapidly becoming obsolete) and you definitely need it for the HC-08 !

I also found it to be useful to connect the HC-05 (or HC-08) Status pin to an input on the 328 just so my software would know if the bluetooth is online or not rather than wasting time with software serial polling/sending fresh air. Might be worth considering.

By the way, I believe that resonator is also obsolete. If this is a production board rather than a one off then it might be worth looking for an alternative, or even sticking to the tried and tested HC49S package crystal and a couple of 0603 22pF's ... at least that gives you supply options without a board change being necessary.

Just one more thing. You haven't included an ICSP header anywhere. You can program the 328 through your FTDI but you can't burn the bootloader that way. If you're planning to burn the bootloader externally it will be fine but if you want to do it on the board its way easier if you include an ICSP header even if its not a standard layout.

Gareth

Hi Koepel
I have moved the diode to the RESET side thanks.

Regarding the SDA/SCL bus, it does work in practice as I have prototyped the MPU6050 with an arduino UNO containing the ATMEGA329P-PU. So are the effects in real life just that the data from the MPU6050 is degraded/noisy if the logic high for the ATMEGA is above the voltage range of the MPU6050?

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