How do I block ground?

Hi All,

I bought a 8x8 LED matrix to play with. It has 8 row pins and 2x 8 column pins (a set for red and one for green). To light up a pixel I need to set a column pin to VCC and a row pin to ground.

Now I know how to set an output pin true to provide the column pin with juice. But how do I conditionally set an pin to ground?

I’m using the gadgeteer with IO60P16 module. Now I don’t know the slightest thing about resistors and hardware in general, but I created this application:

        IO60P16.InputPort ip = null;

        public void Go()
            IO60P16.ResistorMode r1 = IO60P16.ResistorMode.ResistivePullDown;
            IO60P16.ResistorMode r2 = IO60P16.ResistorMode.ResistivePullUp;

            bool up = false;

            while (1 == 1)
                if (up)
                    ip = new IO60P16.InputPort(IO60P16.IOPin.Port0_Pin0, r1);            
                    ip = new IO60P16.InputPort(IO60P16.IOPin.Port0_Pin0, r2);            
                up =! up;

I thought setting the ground pin to ResistivePullDown should pull the pin down and make it function like a ground pin while setting the pin to ResistivePullUp would not. But I guess I’m making an error here, because if I set 3.3v to the column pin and connect the row pin to this IOPin.Port0_Pin0 pin the led always lights up. So It’s always functioning as ground pin.

I also could not find a way to change the resistor mode after creating the instance so I had to dispose the object and create a new one?

I also tried other resistormode’s, but I think I’m just not getting the picture here. Is it even possible to set a pin conditionally to ground? I’ve read about tristate pins, is that the one to use? The IO60P16 does not seem to support that, but I think my FEZ Panda 2 does so I might switch there again if that’s the case.

Thanks again for helping me out!

You will need some external elecwizardry like a couple of MAX7221 drivers.
You cannot do it with just a FEZ and io60

@ andre.marschalek - have a look at the schematic here and it will give you an idea on the issue

Ie rows are common cathode and columns are common annode so the trick is how to turn on a single led in a row or column.

@ andre.marschalek - yes…it has the extra elecwizardry

@ andre.marschalek - its red and green so there are actually 128 LEDs…hence why you need led drivers running via spi or similar to turn on individual LEDs without needing a pin each.

Hi All,

Thanks for the quick help again! And my apologies for the late response… work cought up with me. This seems a lot more complex than I hoped for :-). I can light up a single led by providing the voltage on the column and the ground to the row. But if I want to light up another led on a different row it will also show the one in the row I’ve set the ground to as well.

So I thought I’d make something set the LED’s really quick one by one to create the image I want, but that would also mean conditionally grounding row pins. And this needs extra elecwizardry :-). That probably explains why my LED Matrix was only 7 euro’s and the one including the fancy stuff is about 30 dollars.

EDIT: Could this be done with a MOSFET? I don’t know a lot about them, but it seems that I could control the gate (ground) with a pin signal? I found some MOSFET’s around 13 cents, so 8 MOSFET’s could help conditionally set 8 ground signals?

Thanks again for helping me out!

Can this be done using a tristate pin? In Hi-Z mode there is essentially no connection, set to TRUE it’s 5v, set to FALSE it’s GND… I’d still be worried that you need to worry about power draw though.

nope - you need the elecwizadry…

Is this similar?

@ Brett, I thought this should work as well with the HI-Z mode. Unfortunatly I don’t seem to have a tristate port on the IO60P16 board, but I do have this on FEZ. Did not get it to work though, so I guess Justin is right and I need the elecwizadry. I don’t understand why though :slight_smile:

@ HughB, Amazing that IanLee always seems to have created something functional already :-). But I do think his LED matrix is different. It seems as if it is lighting up each LED in turn (by providing power to the LED to turn it on).

I can’t do that with this LED matrix. Not each LED has a power and a ground. There are 8 power pins for the 8 columns, and 8 ground pins for the rows. I got the image from, it explained to me how the matrix should work.

I can provide power to a column and ground to one of the rows to light that column within that specified row. But if I ground that row to light that specific pixel and I want to light another pixel on another row, I need to remove the ground from the first pixel otherwise the new pixel will light up on that row as well.

So I do need some way to terminate the ground wire. I’m afraid I need the elecwizadry… and that would make the matrix too expensive for my new project.

Edit: Within the image R is to light the RED light and G is to light the green one. This is the matrix:

Reading the comments on that Sparkfun page, they are scanning through pixels and turning them on (and then off) one at a time very quickly. I’m not sure if NETMF will do this fast enough to avoid flicker, but it’s worth trying.


@ mammaplank - actually, what you are describing is exactly the way my LED is built. All you need is a transistor between your pin and your ground pins and voila you have tri-state. It only costs a few cents :wink: From the video, you can see how I have the cube setup. The three transistors are what enable/disable the levels.

NETMF is plenty fast. The real trick is going slow enough that you can get enough power to your LED long enough to make it bright. That’s where using transistors on all the pins to switch higher voltage would be a benefit. My LED cube was just a quick test. Everything is powered directly from the FEZ which isn’t ideal if you’re interested in brightness.

@ Pete, it’s not possible to set them one by one without conditionaly setting ground.

@ Ianlee74, guess you figured out the solution to my problem again :-). Thanks. I’ll look deeper into the LED cube and see if I can figure out how it works with those transistors. It’s not on software & sawdust? I will try to build the princess wand soon :-).

@ Ianlee74, guess you figured out the solution to my problem again :-). Thanks. I’ll look deeper into the LED cube and see if I can figure out how it works with those transistors. It’s not on software & sawdust?[/quote]

No magic there. It’s been documented a hundred times. It’s a standard LED multiplexed array. Here’s an example except instead of using the ICs, I just had every resistor connected directly to a pin.


My code is located here:

Everyone needs a princess wand!