Using LCD Pi Plate with Grove Pi

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
nexusnet
 
Posts: 21
Joined: Fri Jan 10, 2014 4:32 pm

Using LCD Pi Plate with Grove Pi

Post by nexusnet »

Has anyone used the RGB (or other) LCD Pi Plate with a Seeedstudio Grove Pi? i2cdetect shows both units, but also shows a UU entry in line 30 that I don't understand. Additionally, while the colors work when I run the sample python script, the characters print as garbage/symbols. Previously when I used the LCD Pi Plate alone, it worked as specified - characters for button names were readable.

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: Using LCD Pi Plate with Grove Pi

Post by adafruit_support_mike »

The 'UU' symbol means 'in use'. It means that some process has already told the kernel it wants to talk to a device using that address, so `i2cdetect` skips over that address in its scan to avoid screwing up an existing data connection.

WRT the garbled characters, I'm not sure what could be going wrong. Data goes to the LCD through an MCP23107's I2C connection, so the three most likely points of failure are:

- The physical connection: check your connections to make sure they're solid
- The electrical behavior: try adding 1k pull-up resistors to SDA and SCK and see if that helps
- The data transmission: for that, you'll have to check with Seeed.

User avatar
nexusnet
 
Posts: 21
Joined: Fri Jan 10, 2014 4:32 pm

Re: Using LCD Pi Plate with Grove Pi

Post by nexusnet »

Thanks Mike! I took the "should have done this before" next step and tested the pi plate without the GrovePi. Same bizarre charaters. The plate did work a few months ago when I first built it. I then set it aside to work on other pi projects. The RasPi board may or may not be the one with which I originally tested the plate - not sure, as I have several. As all of my Pi's seem to work, I'll assume for the moment that isn't the cause. The o/s and other software have changed quite a bit - updated packages multiple times, and recently upgraded the o/s itself b/c I received my first B+ Pi. So I went around to all of my pi's and upgraded. Are there any known issues with the latest (post June 20 / B+ introduction) version of Raspian and the RGB pi plate? Wanted to ask.

I've not done a proper test to isolate out the Grove packages - will see if I have the SD card that I original used (not too likely) or may create a new o/s without the grove installation

I'll examine all connections under a magnifier tomorrow. Pin yutz happens!

Could you explain the additional pull up resistors? I assembled the kit as received from Adafruit - didn't need to add anything, and didn't know enough to mess with the circuit anyway. I get the basic idea of what pull-ups do, but could you help me understand why this would make a difference over the "out of the box" kit? I don't have enough electronics experience to figure out the "why", but want to understand so I know better what I'm doing.

Thanks!!

Robert

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: Using LCD Pi Plate with Grove Pi

Post by adafruit_support_mike »

Every digital logic circuit has two voltage levels: HIGH and LOW.

To make that happen, every logic gate has two parts: a pull-up network, which provides a controllable path to VCC, and a pull-down network that provides a controllable path to GND. When either network is active, the resistance through it (and to the appropriate rail) is low. When either network is inactive, the resistance through it is high.

For that kind of hardware, making the pull-up network active and the pull-down network inactive sends the circuit's output HIGH. Deactivating the pull-up network and activating the pull-down network sends the output LOW.

(for the sake of completeness, deactivating both networks at the same time produces a high resistance in either direction, more or less disconnecting the gate's output from the rest of the circuit. That's called 'tristating' a pin or 'high-Z mode'. Activating both networks at the same time creates a condition called 'shoot-through' which basically shorts the VCC and GND rails together, and is usually bad news).

The terms 'high resistance' and 'low resistance' are only defined relative to each other. In practice, they combine to mean the high one is much larger than the low one.. where 'much more' usually means a factor of 10 or more.

The I2C signal protocol allows multiple devices to share the same wire by taking some liberties with the definitions above.

I2C devices use what are called 'open drain' outputs. You have a mosfet whose source is connected to GND, and whose channel resistance is controlled by the gate voltage. Sending the gate voltage high makes the channel resistance low, sending it low makes the channel resistance high. By the definition above, that's a pull-down network.

No I2C device has a pull-up network though. That's necessary to avoid conditions where one device is trying to pull the bus HIGH while another is trying to pull the bus LOW (creating a shoot-through condition between the two devices). Not only is that bad for the hardware, it plays merry hell with the logic signals.

Instead, the I2C bus as a whole has a pull-up resistor. Now, granted a fixed resistor's value isn't exactly controllable, but mosfets allow us to arrange things so the definitions of "high resistance" and "low resistiance" work out they way they should for both signals. The average mosfet's on-resistance is a couple of ohms, which is much lower than, say, a 4k fixed resistor. The average mosfet's off-resistance is somewhere around 10M, which is much larger than the same 4k fixed resistor. When the mosfet is conducting, it provides a suitably low-resistance path to GND. When the mosfet isn't conducting, the resistor provides a suitably low-resistance path to VCC.

Since the resistor is always 'on', turning the mosfet on does allow current to flow straight to GND, so technically we have a shoot-through condition. The resistor limits the current to a level that won't cause any problems though, so we can live with that.

The single pull-up network and multiple pull-down networks turn an I2C bus into a large, distributed OR gate. If any mosfet is conducting, the whole bus will see a LOW voltage. If none of the mosfets are conducting, the whole bus will see a HIGH voltage. The convenient bit is that having multiple mosfets trying to pull the line LOW doesn't create any problems.. we just have a redundant low-resistance connection to GND that doesn't change anything imporant.

None of that is too mind-bending, but for real I2C networks we have to deal with the source of all delays in logic circuits: capacitance.

A mosfet is basically a resistor controlled by a capacitor (applying gate voltage pulls electrons directly under the gate insulation, and those electrons form a conductive path through the mosfet). Capacitor voltages can't change instantly though. They rise and fall based on the amount of current that flows into or out of them.

The I2C bus's pull-up network, being a resistor, limits the amount of current available to charge the gate capacitance of all the I2C devices connected to the bus. Increasing the pull-up resistance lowers the amount of current that can flow into the capacitor, making it take longer for the mosfet to reach the gate voltage where it starts conducting.

It also takes some current to expand/collapse the magnetic field created around the wire any time current flows through it, which gives us another delay term.

For long or large I2C networks, the inductive losses through the wire can be big enough to mess up the HIGH/LOW signal levels.

Almost every problem in electronics can be solved one of two ways though: throw more hardware at the problem, or send more current through the exising hardware. Increasing the current available from the pull-up resistor makes it possible for the I2C bus to transmit logic signals better and farther.

Putting resistors in parallel gives you more paths to VCC, lowering the effective resitance of all the resistors in parallel. That lower resistance allows more current to flow into the I2C bus. That reduces the inductive effects in the wire that can interfere with signals, and charges the all the gate capacitors more quickly.

Functionally, lower pull-up resistance means faster and more reliable data transmission on an I2C bus. Slapping in another couple of resistors is cheap and easy, so it's a good thing to test any time you have I2C going wonky.

User avatar
nexusnet
 
Posts: 21
Joined: Fri Jan 10, 2014 4:32 pm

Re: Using LCD Pi Plate with Grove Pi

Post by nexusnet »

Thanks Mike! Detail re the i2c bus much appreciated. That helped me put together a bunch of stray bits in addition to understanding the role of the added resistor.

The cause of my problem, of course, was the simplest of all the alternatives. One of my original solder joints had "gone bad" - i.e. I did a sloppy job of assembly and ended up with a cold joint that didn't last thru the minor jiggling of connection and disconnection. Found the suspect under the magnifier. Re-soldered. Nice bright joint now and... surprise, correct text is displayed.

It's truly amazing what happens to electrical circuits when joints are properly soldered. So in a manner of speaking, the problem got fixed by removing a "large air gap resistor" from the circuit! :)

Thanks for your patience and assist!

Robert

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: Using LCD Pi Plate with Grove Pi

Post by adafruit_support_mike »

That's what we do. ;-)

Glad to hear you have it working. Happy hacking!

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”