Hello, I have routed I2C lines as shown:
The circuit with resistors and mosfets is a level converter
Here is an image with the front layer visible
Will there be any problems with this? The trace below the I2C lines is the data line of a DHT22 (Digital Humidity and Temperature sensor with single wire communication)
Thanks!
Not sure without seeing a schematic, but you might struggle with MOSFET level shifters on I2C.
The data line has to be bidirectional so that the slave can at least ACK a byte.
Depending on voltages and part specs, you might not need it. A lot of 3.3v micros have 5v tolerant pins for I2C, and a lot of 5v slaves will have a Vih low enough for a 3.3v â1â.
Ahh sheesh, mosfet level shifting for i2c was first proposed in 97 by Philips, who designed i2c a few years prior. Fully bidirectional. Use low vgsth devices.
DSA-492462.pdf (80.9 KB)
3 Likes
Well looks pretty decent, though clearance kinda tight near a sot23 and does your i2c go to wrong pins at the right, or maybe silk is wrong?
I used the DHT on some balloon flights â giant package and a goofy-ass interface but worked pretty well.
There is nothing special about routing I2C, itâs pretty much low speed signals and without steep flanks. If you want to improve it, then move those lines apart from each other to reduce capacitive coupling.
For the rest, your GND plane is quite bad. Pretty much random routing and whatâs left is turned into pieces of GND plane. Learn what the use of a GND plane is, why it is important, and how to do it properly on a PCB. In short, your circuit will probably still work, but itâs horrible for EMC.
Iâm using RPi4 and Arduino. It seems RPi is not 5V tolerant.
Yeah I changed the pins later and forgot to change the silkscreen. Thanks
Well, I used GND vias for that. Donât know if thatâs bad. Can you suggest me how to route (these are all low frequency signals from sensors by the way). or suggest resources where PCB routing is given in detail? Thanks
Oh I need to separate the I2C lines with GND in between? How much space do you suggest?
The first goal concerning GND, is to have a single continuous GND plane on one of the layers (Usually bottom, but because you already have SMT stuff on the bottom layer (Why?) using the Front layer in this case may be a bit simpler. In a 2-layer design this is often not possible. The next best is (already a compromise) to keep all interruptions of the GND plane as few and as short as possible (less then 5mm or so)
Rick Hartley has made an excellent youtube video about GND planes. It is 2 hours and some 9 minutes long, and it is worth watching a few times. That is how important GND planes are in a PCB design.
Using via âstitchesâ to connect a patchwork of GND sections together is far from ideal, but still better then nothing.
Itâs not the âfrequencyâ of signals, but the steepness of signal flanks that counts. Arduino Nano is a fairly old and low speed microcontroller, and itâs edges are not particularly fast, the edges from the Raspi would be a lot faster. For your project, the cables hanging off the board are probably a bigger issue. They both easily pick up noise and work as antennaâs. For a robust / industrial level of PCB design, you have to consider all such things (for example add series dampening resistors and TVS diodes), but for some hobby level tinkering, itâs mostly âmeh, it probably works without such stuffâ.
For I2C the main goal is to reduce capacitive coupling. You do not have to put GND in between the wires, but separating them by a few mm is good practice. With I2C you should also always verify that your pullups are strong enough to ensure data integrity for your signals. If you have an oscilloscope, you should definitely verify this. If you donât have an oscilloscope, consider buying one. (But buy something decent, anything below EUR250 is probably more of a toy then an oscilloscope).
Just a quick question, why not GND on both planes?
As for only components on the bottom side, I thought it might reduce costs. Thereâs just not enough room to fit them all on the top
Thanks for that - Learn something new every day!
I followed your tutorial about database libraries yesterday, and it worked a treat. Well written, with plenty of supplementary screen shots. You should start a whole series of short tutorials - maybe call them the âOh Shishâ series, to be read munching a kebab.
Iâve never really had to mix logic voltage levels, especially on comms buses like I2C.
1 Like
I have used the mosfet level shifter in several designs, it works reliably