PCB / I2C / 3x Chips / A lot of components

So I'm designing a PCB on paper not get on Eagle and it's my 1st time combining 3 atemga chips
in a single board but let's start from the basics 1st

A single chip in my case gonna use ATmega328 use 16Mhz crystal, 2x ceramic capacitors 22p,
1k resistor from Reset pin to +5v or adding a button as a reset button, connecting all GND and +5V together.

Now this is the basic components and setup to use self atmega328 on a pcb, in my case I'm gonna use 3x on a single board, now because I'm gonna use I2C as well in between them should I connect ? :

  • All +5v,GND (from all 3x chips) together ?
  • Should I add 4.7k resistors to +5v to A4 and A5 (as I'm gonna use I2C with all of them) ?
  • Should I make a single RESET button for all 3x or should I keep a individual reset button for each of
    them ?
  • Should I add individual +5v regulator for each one?
  • If I add more than one +5v regulator (and connected together) they gonna be
    for example 800mA + 800mA = 1600mA and devide the amps equal?
  • -> Or should I put individual regulators for the ATmegas and individual regulators for the components?
  • If I add 4.7k resistors as pull up resistors A4,A5 for the 3x atmegas will that affect my other sensors in the I2C ?

-> (I tested the I2C without 4.7k pull up resistors and they worked well without problem).

Well that's the most common questions that I'm not 100% what to do and if I'm right.

Thanks,
D.60

Always connect the grounds.

I'd use one regulator for all unless they need to run at different voltages. Yes, use pullup resistors.

Whether to tie the reset lines together depends on your requirements.

Always connect the grounds.

even the grounds in the components all of them together?

I'd use one regulator for all unless they need to run at different voltages.

I got only 800mA smd regulators so I'm afraid not hot heat them up, would be nice to use one regulator for the ATmegas and one for the other components?

Yes, use pullup resistors.

I got other sensors wired in I2C, the 4.7k resistors will not affect the modules that got already pullup resistors?

Whether to tie the reset lines together depends on your requirements.

I'm using a micro sd card module and when I unplug and plug back the sd card i need to reset the chip, should i connect them all together to a single reset button or a individual one (?), in case there is a bug in I2C or something :smiley:

Three 328P on one board seems like a lot. Why not use a bigger chip if you need more inputs and outputs? SMD soldering is easier than through-hole if you have a professionally made board with soldermask. Custom PCBs are very cheap these days.

Ordinarily things that need to communicate within one PCB must have a common power supply, if only to make sure they all get powered up at the same time instead of random order. What else do you have (that you're not telling us) that is using that much power that you need three supplies?

Three 328P on one board seems like a lot. Why not use a bigger chip if you need more inputs and outputs? SMD soldering is easier than through-hole if you have a professionally made board with soldermask. Custom PCBs are very cheap these days.

To be more clear it gonna be 2 on one PCB and the 3rd one to a bellow PCB as shield. I don't have money or time to buy a bigger chip right now I know they exist like the ATMega644, or smd ones. I don't have big experience with smd yet and the necessary tools, the only smd parts that I soldered till now is leds, regulators and diodes nothing more. I create my own PCB, single or double side even double side shields 8 out of 10 they get out perfectly.

Ordinarily things that need to communicate within one PCB must have a common power supply, if only to make sure they all get powered up at the same time instead of random order.

That's for sure, I'm gonna power all 3 chips with a single battery.

What else do you have (that you're not telling us) that is using that much power that you need three supplies?

I got over 6 modules/sensors, servo motors, leds, some of them are running thru I2C some of them running individually to a chip and sending data to other chips thru I2C.

Because I got several modules and servo motors I'm thinking to put more than 2 +5v regulators and power the servo motors individual from separated regulator, I don't want a single +5v 800mA regulator to power up everything. I got other modules that gonna run on +3.3v .

As DrAzzy said, I'm gonna connect every GND together. I'm not sure about I2C pullup resistors and to use a single button as reset to all ATmegas together.

Any ideas or suggestions will be nice.

Edit:

I don't have the equipment to bootload / test codes on smd chips sockets
like this one :

If i had that and many other tools my projects would be much smaller and nice looking

I need at least a smd socket, heat station soldering iron/hot gun, I can work even with a soldering iron soldering smd's, need as well soldering mask, the green one, pen flux and many smd components, like resistors, capacitors, diodes..etc

So you know - don't connect the output of two regulators together. Due to process variation, they won't quite agree on what the target voltage is, and will either fight eachother, or the load may not be split evenly.

The ATMega x4 series (324/644/1284) are available in DIP-40 through-hole package.

You don't need one of those stupid sockets to work with SMD parts - you solder them straight down onto the board, and put an ISP header onto the board so you can bootload them that way. I don't like those sockets, the length of the conductor before it gets to the board where you can put the decoupling caps onto it makes me uncomfortable, and they're expensive too.

Are you saying you're making the PCBs at home, etching yourself? I did that for a while, and that was what got me to switch to SMD, because by far the hardest part was always drilling the goddamned holes. Now I default SMD, and only use TH if I have to, even though I have boards made professionally now (it really was insane doing it myself, assuming any reasonable value for my time - not to mention the quality of the result) Before I did the opposite, and disliked working with SMDs.

So you know - don't connect the output of two regulators together. Due to process variation, they won't quite agree on what the target voltage is, and will either fight eachother, or the load may not be split evenly.

Connecting the GND of the regulators together but not the VCC ones, right?

You don't need one of those stupid sockets to work with SMD parts - you solder them straight down onto the board, and put an ISP header onto the board so you can bootload them that way.

That's a good idea for a personal project but I'd like when I create a project PCB to be clean and do only what is mentioned to do with no extra hearers/pins/components :slight_smile:

The ATMega x4 series (324/644/1284) are available in DIP-40 through-hole package.

It's nice to have more pins but for example I got in my project 2 modules that need to be connected to MOSI, MISO, SCK..etc I'm not able to connect both on same pins that why i needed 2 chips and communication thru I2C.

Are you saying you're making the PCBs at home, etching yourself? I did that for a while, and that was what got me to switch to SMD, because by far the hardest part was always drilling the goddamned holes. Now I default SMD, and only use TH if I have to, even though I have boards made professionally now (it really was insane doing it myself, assuming any reasonable value for my time - not to mention the quality of the result) Before I did the opposite, and disliked working with SMDs.

Yes, I chose to create at home all my PCB because I create them when I want and how I want, I can create maximum 2x PCB 10cm x 10cm per day, designing, printing, etching, drilling, soldering and that depends on the complexity, double side, vias, different holes dimensions ..etc At the beginning i was drilling with a hand (wall) drill with the plug and drill battery, standing all the time and trying to drill taking me over an hour to drill 50~80 holes :smiley: and my back hurting as hell but after a while I got a dremel for the holes and I drill them pretty fast, over 100 holes per 5~10minits, I'm satisfied a lot with the new dremel.

I'm a student, finishing in few weeks, I'm gonna upgrade in the future to smd PCB's but I need more tools, I'd like to solder smd's with hot gun and soldering paste, i'd like to try the soldering mask as well, I'm doing soldering mask by transfering 2nd time the modified printed circuit :smiley: bad ass looking black mask PCB's

Just a question, why so many ATM? You need the processing power? Coz for i/o we have those supercheap 23017 i2c's with lot of legs. Also for simple things the lesser atms can be used with their internal oscillator (like drive 7 segment LED etc...) then connect i2c.
As for connecting i2C, you put only ONE set of pullup resistors on the whole bus not 3 sets, if that was the question. anything 4.7k-10k. And use one power source and regulator for your electonics then other for heavy stuff like the servos.

Hi,
What is the application and how many sensors, servos, etc do you have, that requires 3 x 328's?

Tom... :slight_smile:

Over 6 modules...

How far over?

...Need two modules on MOSI/MISO pins.

You do know that SPI is a bus?

...Dremel...

It sounds like you are quite experienced at making PCBs and you have a reasonable workshop set up. What was the original question again?

Just a question, why so many ATM? You need the processing power?

I'm using 3 ATmegas for a reason,
1st Because I need MOSI, MISO, SCK pins (13,12,11,10,9) for a device
2nd I have a 2nd module that need same pins MOSI, MISO..etc exactly same pins so I can use 2 modules
on a single chip
3rd I need PWM pins, the 1st and 2nd chip got only 3x PWM pins, now you may say you can use pwm from both chips but I will better add a 3rd chip to use all PWM in a single chip single code.

My 1st and 3rd chip got already over 25kb of flash code so that's the main reasons why I need 3x ATmegas328 :smiley:

As for connecting i2C, you put only ONE set of pullup resistors on the whole bus not 3 sets, if that was the question. anything 4.7k-10k. And use one power source and regulator for your electonics then other for heavy stuff like the servos.

I got that, 1x 5v 800mA regulator for I2C ATmegas and separated regulator for servos but the main question which still didn't got answer,

If I use 4.7k pull up resistors from A4 -> +5V, A5 -> +5V, what about the already integrated pullup resistors on the sensor modules that are connected thru I2C ?

Hi,
What is the application and how many sensors, servos, etc do you have, that requires 3 x 328's?

Hi Tom,

I can't tell you in details/specific components because it's a university project but i can tell you how many components I use, I got 7x modules which they are doing different stuffs they are connected directly thru digital pins and others thru I2C, I got 6x servo motors.
And because as I commented to Oscarko as well, I need 3x ATmegas328 (1st reason because I don't have others chips right now to use :D) and the main reason is because I go so many components that some of them use same pins, other sensors need other pins and cover my PWM's and that's why I need other chips to use PWM for servos..etc

Edit: If you like to hear the project I can post it in this forum after one and half month, it's my own project, my own budged so the university don't have legal copyrights on my personal project :smiley: I can make it free source after I finish :smiley:

How far over?

let me re-edit 7x modules, how far over what? how many I tested and connected already ?
I personaly tested and I always do that before building my PCB's testing everything on breadboard,
I already tested and wrote codes for 5x modules, left only 2x modules and few more functions to write and finish the coding/programming.

You do know that SPI is a bus?

Being honest? :smiley: I didn't knew, I thought the only Bus is the I2C A4,A5..... ow well nvm I will keep going with my project like that, I don't have time for modification, probably in the future, but even if I put in the same Bus the modules that use MOSI,MISO i already I'm out of Flash memory
My Master chip got already 23kb of data and my Slave2 which I got the other Mosi,miso module got 20kb of code, so I think it's kinda impossible even if I use them on the same chip as a bus, out of flash :smiley: memory.

It sounds like you are quite experienced at making PCBs and you have a reasonable workshop set up. What was the original question again?

Work shop? :smiley: are you kidding, I'm a student, people keep telling me that I need atelier/work shop to do what I'm doing but I'm doing all that in my apartament. My room is kinda messy while doing a project but after finishing everything is clean.

Well the only question left in this topic is about the pull up resistors
as I know and read I need 4.7k pull up resistors for I2C between ATmegas but what about the modules that I got as well in I2C ? I'm looking them and they got already integrated pull up resistors. Will that affect the communication?

Each I2C bus only needs one pair of pullup resistors and it doesn't matter where you put them. If a device has them built in then omit them on your board. It also doesn't matter much if there's two sets of pull-ups, so long as the total resistance if the parallel pull-ups is not too low ( or the pullup is "too strong").

Look at all the modules you have. Do the parallel resistor calculation. If too strong, desolder pairs until it's OK.

Each I2C bus only needs one pair of pullup resistors and it doesn't matter where you put them. If a device has them built in then omit them on your board. It also doesn't matter much if there's two sets of pull-ups, so long as the total resistance if the parallel pull-ups is not too low ( or the pullup is "too strong").

Look at all the modules you have. Do the parallel resistor calculation. If too strong, desolder pairs until it's OK.

Ok i will check that out, but if the pullup resistors are ok on the modules then i should leave them and not add anything else I understood right?

Yes, usually it's OK to just leave the pullups on the modules and don't add more. But I2C can be pretty tricky. I've had more problems with I2C than any other form of comms and it's not even one that I use a lot.

So I got 3 modules that use I2C,
1st module got 472 smd resistors as I understood from internet they are
470 x 10^2 ohms, or 47kΩ.
the 2nd one got 222 22.2kΩ and the 3rd one as I saw on the module does not use pullup resistors,
all 3 modules work on +3.3v so in this case I'm gonna have 3 modules and 3 ATmega chips that will use I2C and total pull up resistance is 47 + 22.2 = 69.2kΩ

Is that fine? or not?

1st module got 472 smd resistors as I understood from internet they are
470 x 10^2 ohms, or 47kΩ.

No, 472 = 47 x 10^2 = 4.7k
222 = 2k2, etc

The resistors are in parallel, not series, so the combined resistance is not their sum, the
combined conductance is the sum of individual conductances. About 1k5, which is too low - lose
the 222 resistors if you can, 4k7 is the value to aim for usually. Make sure all the modules
are close together, I2C is not designed for long cable runs.

No, 472 = 47 x 10^2 = 4.7k
222 = 2k2, etc

Yes I'm sorry I miss typed by one digit :smiley: thought it's 47 but it's 4.7

The resistors are in parallel, not series, so the combined resistance is not their sum, the
combined conductance is the sum of individual conductances. About 1k5, which is too low - lose
the 222 resistors if you can, 4k7 is the value to aim for usually. Make sure all the modules
are close together, I2C is not designed for long cable runs.

So should I better unsolder the pull up resistors from the modules, and use directly 2x 4.7k resistors on I2C from 3.3v to A4, 3.3 to A5 ?

I've heard othe people say that they can run up to 5 meters the I2C

I2C is very sensitive to the cable capacitance. Depending on the wire you use, you might get different results. You can also use active pullups instead of plain resistors to push the signal a bit further.

Unless you have an oscilloscope, you won't be able to see what is going on. I still don't trust it for more than 10cm.

I2C is very sensitive to the cable capacitance. Depending on the wire you use, you might get different results. You can also use active pullups instead of plain resistors to push the signal a bit further.

Unless you have an oscilloscope, you won't be able to see what is going on. I still don't trust it for more than 10cm.

Well but the question is, I know what pull up resistors i got on my module, what should I do?
Leave them like that without adding anything and everything gonna work just fine?
or
Unsolder the pullup resistors from the sensor modules and add a directly 2x 4.7k resistors ?

Hi,

Domino60:
Well but the question is, I know what pull up resistors i got on my module, what should I do?
Leave them like that without adding anything and everything gonna work just fine?
or
Unsolder the pullup resistors from the sensor modules and add a directly 2x 4.7k resistors ?

You have just answered your own question.

Leave them like that without adding anything and everything gonna work just fine?
or
Unsolder the pullup resistors from the sensor modules and add a directly 2x 4.7k resistors ?

Be flexible, this is a prototype, make it able to do both.
If you are going to go to production, at this stage try all your options, the time that has been spent on the forum on just this aspect, you could have prototyped it and got an answer.
Tom..... :slight_smile: