Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: digitalRead oszillates: GND-problem?

  1. #1

    digitalRead oszillates: GND-problem?

    Hi!

    Some pins of my Teensy3.5 give random output even with internal pullups enabled. Here is a diagram of my project:

    Click image for larger version. 

Name:	diagram.jpg 
Views:	28 
Size:	33.8 KB 
ID:	13986

    There are 2 metal enclosures (relatively big), one of them contains the PSU. Plus and minus of the PSU go to both teensies (minus goes to GND), so the Teensies GNDs are not connected to mains earth. One enclosure is connected to mains earth, the other enclosure is connected to the first enclosure. The USB cable shields are only connect at one side, so no connection of the shield to GND (but all 4 USB lines are connected, and the VUSB pad is disconnected).

    Now, if I connect the Teensy3.5 via USB to my PC some pins (not all) start to flip randomly. It seems I can stop this by connecting GND to mains earth (marked in red), but I am not sure if it's OK to do so...

    Please let me know how to best layout the GND and earth connections!

  2. #2
    To update this topic: I have a bunch of sensors, PSUs, drives, buttons, encoders, displays, LEDs etc. connected to the Teensies and could not totally solve the problem by working with the GND connections. Instead it turned out that I had I2C wires too close to those randomly flipping pins. I changed to a lower I2C speed and moved the pins from the wires away (as I could not move the I2C wires already soldered I just used different pins which are farer away from where the I2C wires run). The situation seems stable so far.

    I am surprised to learn that relatively short wires from the I2C pins could disturb input_pullup pins such that the readings flip randomly.

    The question remains which layout of grounding should be used in projects like shown in my diagram...

  3. #3
    Apart from re-thinking the earth/gnd concept I found a solution to emi-protect pins, i.e. for reading buttons over long and noisy lines, see here.

  4. #4
    Senior Member
    Join Date
    Oct 2015
    Location
    Roma (IT, EU)
    Posts
    336
    Internal pullups are quite weak (in Teensy 3.2 they are about 33K if I remember well; Teensy 4.0 should be around 100K. Don't know the specific value for 3.5, but you get the idea).
    They may be too weak for your purposes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •