Author Topic: I2C touch and OLED PCB design  (Read 1261 times)

0 Members and 1 Guest are viewing this topic.

Offline metaphaseTopic starter

  • Newbie
  • Posts: 4
  • Country: gb
I2C touch and OLED PCB design
« on: September 12, 2021, 03:24:05 pm »
Hi folks - would greatly appreciate any expertise/suggestions on solving this problem!  In particular have I done anything glaringly stupid when it comes to my PCB design?  :-[

I'm trying to get touch control working with an OLED screen, controlled by a Raspberry Pi Zero W.  This is via a custom PCB for touch & OLED, connected via a short (~5cm) ribbon cable from the first 8 pins of the Pi.  The Pi has built-in 1k8 pull-up resistors on the SDA & SCL lines.

The screen is an SSD1306 screen running over I2C (using luma.oled), it's worked well for a few months when used in conjunction with touch control using an AT42QT1070 in standalone mode with three keys tied to GPIO pins.  However I’m now putting the setup in a plastic enclosure and the sensitivity in standalone mode isn’t sufficient to detect the touch, therefore I need to run the touch controller in comms (I2C) mode (I2C), as that lets you adjust the sensitivity.

i2cdetect shows both devices fine (0x3c for the screen, 0x1b for the touch controller). I have a Python script to control the screen and another for touch control. However I'm now finding if I load the screen script it will start the screen and update fine but then after a few seconds it will then crash out with an I/O error.  I've tried a different screen but no change and if I put it back on an old board (similar design but with the touch control in standalone mode) it works OK.

It seems that if I just run with the screen connected or just with the touch controls it works OK (I can interrogate the registers, pull touch sensor readings, etc.) but when both are connected I'm running into issues, despite both showing up correctly and both working to some extent before they abort.

On my breadboard layout (I created one for this VQFN package - unfortunately the larger 14-pin SOIC I had used previously seems to be out of stock thanks to the worldwide chip shortages!) they seem to both work OK at the same time, so I’m worried I’ve done something stupid with my PCB design! As I say I can interrogate the registers on the AT42QT1070 OK, it’s more like something destabilises the I2C bus when I’ve got the screen running too?

My KiCAD PCB layout for the main board is attached (the weird board outline is due to other components/fixings in the case I have to work around), I've also attached the breakout I designed for the breadboard.  Both are standard 2-layer FR4 boards, manufactured by JLCPCB.

I've read through the NXP/Philips I2C design spec as well as the Atmel touch control guidance and have tried to balance things as best I can - e.g, no ground plane around the touch controls, cross touch over other lines at 90 degrees, short ribbon cable from Pi to this PCB.  I'm wondering if I need a different routing of the I2C SDA/SCL lines or more ground plane around them?  Should I run separate connections for these lines from the IDC pins to the OLED and to the touch controller rather than join them en route as I've done here?  I've not quite worked out how to calculate parasitic capacitance, etc. but can't imagine I've gone above the 400pF limit with just two slaves and fairly narrow/short traces?  Unfortunately I don't have an oscilloscope which I understand would be helpful to look at the signals better and see if there are any issues there.

Please just say if any more info would be useful and thanks in advance for any help!…
« Last Edit: September 12, 2021, 03:29:43 pm by metaphase »
 

Offline hermit

  • Frequent Contributor
  • **
  • Posts: 482
  • Country: us
Re: I2C touch and OLED PCB design
« Reply #1 on: September 15, 2021, 09:08:55 pm »
No direct answer here but an anecdote of sorts.  When I was in school a teacher, who was an engineer at local  plant of a large company, said they had a new process control panel installed.  It would work for a while and then 'go berserk'.  Turns out the company developing it had never tested it inside the case it was installed with because it was much easier to check things when it was outside the case.  The fix was a one pico farad capacitor to the chassis.

Being a multi million dollar operation it was worth their while (mandatory really)  to have a team of engineers trouble shoot the thing and come up with a resolution.  You may have to just try a few things like lining the case with aluminum foil and seeing if that helps.  Good luck.
« Last Edit: September 15, 2021, 11:24:38 pm by hermit »
 

Offline hermit

  • Frequent Contributor
  • **
  • Posts: 482
  • Country: us
Re: I2C touch and OLED PCB design
« Reply #2 on: September 21, 2021, 08:25:01 pm »
No updates?
 

Offline metaphaseTopic starter

  • Newbie
  • Posts: 4
  • Country: gb
Re: I2C touch and OLED PCB design
« Reply #3 on: September 21, 2021, 08:43:43 pm »
No updates?
No other replies so far apart from yourself!  Have done some redesign work and awaiting replacement boards to see how it goes. Have also tweaked the Python code to try and recover more gracefully if the I2C bus does run into issues and have shorted the ribbon cable from Pi to PCB from 10cm to 5cm (although suspect it won't make that much of a difference!)
 

Offline perieanuo

  • Frequent Contributor
  • **
  • Posts: 838
  • Country: fr
Re: I2C touch and OLED PCB design
« Reply #4 on: September 22, 2021, 05:32:21 am »
hi,
did you saw page 12 on that pdf you pointed?
Quote
CAUTION: A regulator IC shared with other logic can result in erratic operation and is
not advised.
A single ceramic 0.1 µF bypass capacitor, with short traces, should be placed very
close to the power pins of the IC. Failure to do so can result in device oscillation, high
current consumption and erratic operation.
you are using a ground plane on bottom? cause i don't understand the gnd connection for C1
they clearly pointed the Vcc for that sensor ic needs to be separate from other. imho, he can be the same, but with impeccable layout. that exclude using raspi and his connectors, but if you wanted like this...i saw the same problems with one project with arduino board, i redesigned that incorporating arduino and sensors, all worked fine (the power/signals routing from ardu board to the sensors they had a mess cause of that 'prototype' approach)
also, larger bypass cap is mentioned. i recommend 100n+10n near the chip, maybe 1uF also, and careful layout. and testing that proto thorough by simulating voltage variations, spikes...
for me, this power supply pcb design for your touch ic needs to be clarified, then we can move on
« Last Edit: September 22, 2021, 05:36:41 am by perieanuo »
 

Offline perieanuo

  • Frequent Contributor
  • **
  • Posts: 838
  • Country: fr
Re: I2C touch and OLED PCB design
« Reply #5 on: September 22, 2021, 05:44:53 am »
Should I run separate connections for these lines from the IDC pins to the OLED and to the touch controller rather than join them en route as I've done here?
try to separate i2c comm problems from Vcc problems: script some quick interrogation for those 2 ic's and see if the answer from each ic is comming without issue, thay way you decide if i2c comm is faulty or sensor detection is not working well because of vcc (what i suspect you're dealing with is that second one)
 

Offline perieanuo

  • Frequent Contributor
  • **
  • Posts: 838
  • Country: fr
Re: I2C touch and OLED PCB design
« Reply #6 on: September 22, 2021, 05:48:42 am »
page 12:
Quote
Digital switching signals near the sense lines induce transients into the acquired signals, deteriorating the signal-to-
noise (SNR) performance of the device. Such signals should be routed away from the sensing traces and electrodes,
or the design should be such that these lines are not switched during the course of signal acquisition (bursts).
you have parallel lines for pad1, move that 4-way connector aside
anyway, i don't understand why you implanted him in that position, seeing the tracks are going to the right, his place is on top-right side or right side of that pcb

[edit]
trying to understand your approach, did you tied reset to vdd? and used pins key1/2/3? they recommend resistor for reset line, a resistor costs cents, with this approach in the future you'll get into problems.
for me, it's logic to use key 0/1/2, reset must be done hardware or hardware+software via i/o pin. no good.
« Last Edit: September 22, 2021, 06:29:49 am by perieanuo »
 

Offline metaphaseTopic starter

  • Newbie
  • Posts: 4
  • Country: gb
Re: I2C touch and OLED PCB design
« Reply #7 on: September 22, 2021, 12:43:44 pm »
Many thanks for replying, @perieanuo
hi,
did you saw page 12 on that pdf you pointed?
Quote
CAUTION: A regulator IC shared with other logic can result in erratic operation and is
not advised.
A single ceramic 0.1 µF bypass capacitor, with short traces, should be placed very
close to the power pins of the IC. Failure to do so can result in device oscillation, high
current consumption and erratic operation.
yes, I've got a decoupling capacitor in place

you are using a ground plane on bottom? cause i don't understand the gnd connection for C1
Yes - there's a ground plane around the touch IC/resistors/capacitor - I'd just put KiCAD in outline mode for the ground plane to make it easier to see the other traces, but it's the hatched outline
they clearly pointed the Vcc for that sensor ic needs to be separate from other. imho, he can be the same, but with impeccable layout. that exclude using raspi and his connectors, but if you wanted like this...i saw the same problems with one project with arduino board, i redesigned that incorporating arduino and sensors, all worked fine (the power/signals routing from ardu board to the sensors they had a mess cause of that 'prototype' approach)
I'm afraid I don't quite understand? I've only got one power source coming into the Pi (USB) and am using the power from it?
also, larger bypass cap is mentioned. i recommend 100n+10n near the chip, maybe 1uF also, and careful layout. and testing that proto thorough by simulating voltage variations, spikes...
for me, this power supply pcb design for your touch ic needs to be clarified, then we can move on
the power supply is just from the Pi - I've got at 0.1uF near the chip as per the datasheet, the Pi has its own on-board caps
try to separate i2c comm problems from Vcc problems: script some quick interrogation for those 2 ic's and see if the answer from each ic is comming without issue, thay way you decide if i2c comm is faulty or sensor detection is not working well because of vcc (what i suspect you're dealing with is that second one)
the sensor itself seems to be working OK, the issue has more been the screen stopping working due to an i2c comms error
page 12:
Quote
Digital switching signals near the sense lines induce transients into the acquired signals, deteriorating the signal-to-
noise (SNR) performance of the device. Such signals should be routed away from the sensing traces and electrodes,
or the design should be such that these lines are not switched during the course of signal acquisition (bursts).
you have parallel lines for pad1, move that 4-way connector aside
anyway, i don't understand why you implanted him in that position, seeing the tracks are going to the right, his place is on top-right side or right side of that pcb

[edit]
trying to understand your approach, did you tied reset to vdd? and used pins key1/2/3? they recommend resistor for reset line, a resistor costs cents, with this approach in the future you'll get into problems.
for me, it's logic to use key 0/1/2, reset must be done hardware or hardware+software via i/o pin. no good.
Thanks - I'd noticed that too re parallel lines so have moved that and am trying to route it separately now
Unfortunately the layout is quite constrained - the OLED connector has to be placed where it is (which determines where the touch controls) and due to other boards in the box I didn't have enough space on the left of the PCB for the other circuitry, hence why it is over on the right.

My new boards are arriving soon so will see how they are.  Thanks again for replying.
 

Offline perieanuo

  • Frequent Contributor
  • **
  • Posts: 838
  • Country: fr
Re: I2C touch and OLED PCB design
« Reply #8 on: September 23, 2021, 08:27:54 am »
it's simple, they say touch IC paragraph 3.4 (Power supply) you should use separate regulator for Vdd pin.
how, that's your problem, maybe some other 3v3 regulator powering from 5V raspi rail.
it's not my oppinion, it's their yellow marked phrase :) otherwise they said 'erratic operation'
in your place i'll use wider tracks, you have nothing but space on that pcb
 

Offline metaphaseTopic starter

  • Newbie
  • Posts: 4
  • Country: gb
Re: I2C touch and OLED PCB design
« Reply #9 on: September 23, 2021, 10:59:13 am »
it's simple, they say touch IC paragraph 3.4 (Power supply) you should use separate regulator for Vdd pin.
how, that's your problem, maybe some other 3v3 regulator powering from 5V raspi rail.
it's not my oppinion, it's their yellow marked phrase :) otherwise they said 'erratic operation'
in your place i'll use wider tracks, you have nothing but space on that pcb
interesting, thanks - I had spotted the bypass cap bit in that warning box but hadn't realised about the separate regulator. The IDC pins I pull across from the Pi do have a 5V line as you say so I suppose I could add a regulator to create a separate 3.3V supply for either the touch control or the OLED screen.  I've never used regulators before but presume it's quite easy - perhaps this sort of component?? https://docs.rs-online.com/b505/0900766b813299bc.pdf - it looks like they need input and output capacitors too?

do you mean wider spacing between the tracks or thicker tracks? I've tried to do thicker tracks for the 3.3V but tried to keep thin for other things as I thought that was better. I've definitely tried to space out the tracks on a revised layout - they're hopefully arriving early next week so will see how they are!
« Last Edit: September 23, 2021, 11:10:42 am by metaphase »
 

Offline perieanuo

  • Frequent Contributor
  • **
  • Posts: 838
  • Country: fr
Re: I2C touch and OLED PCB design
« Reply #10 on: September 23, 2021, 02:54:24 pm »
i'll use something like cheapest ldo possible (that 1117 have 1.2v dropout, it's a little bit at limit), i saw on farnell uk this one https://uk.farnell.com/microchip/mic5317-3-3ym5-tr/ldo-fixed-3-3v-0-15a-40-to-125deg/dp/2920683 or if you want stability 100% take TI ldo like LP2950-33LPRE3 or whatever you preffer, i avoid microchip for regulators, but it should work. i prefer ti, lt, rohm, ad, diodes.
choose some ldo with small drop and no fancy capacitor requirements
but just for test, use what you got in your lab, even the old 7805 can be set to output 3v3 for testing that supply issue, or some lm317 :)
try wider tracks at least for supply and more spacing between them and avoid parallelism, the board is not so small
 
The following users thanked this post: metaphase


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf