Writing to Arduino B's input pin with Arduino A's output pin

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
pmw
 
Posts: 11
Joined: Wed Mar 28, 2012 11:29 pm

Writing to Arduino B's input pin with Arduino A's output pin

Post by pmw »

Hello. My question is the reverse of the question in this thread. I have two Arduino boards, call them UUT and Tester. I want to write to a digital pin of the UUT using Tester.

As per the previous thread, I connected grounds. I am able to successfully read pins of UUT using Tester. But writing to the other board is wonky. Most of the time it doesn't have any effect, even though I measure 5V between board A's output pin and ground during the write. Usually, another pin on the UUT gets asserted -- one that I don't intentionally write to -- during test initialization, such as setting the pin mode.

A bit more about the setup and symptoms: the UUT has four LEDs, two pushbuttons, and one pin that's wired directly to the Tester (for resetting the UUT's program). I have all seven wired to the Tester board. The Tester board runs LIFA (LabVIEW Interface for Arduino) firmware. Initially, when I first start the Tester, the LEDs on the UUT that are supposed to be off are dimly lit. As I step through the Tester setting digital pin modes, those dimly-lit LEDs turn off. Sometime during this initialization, the UUT acts as if one of its pushbuttons (wired to the Tester) was pushed. This happens once per initialization, and I don't know why. After that completes, I am able to read LEDs correctly. But when I try to write to the directly-wired pin (the one that's supposed to put the UUT into a known state), the UUT does not respond at all. While, as I said, the Tester is sending 5V.

I'd love to hear your thoughts.

madworm_de
 
Posts: 99
Joined: Mon Jun 09, 2008 6:56 am

Re: Writing to Arduino B's input pin with Arduino A's output pin

Post by madworm_de »

Before you post code + a decent schematic (not a wiring diagram), I think the problem is in line 42.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Writing to Arduino B's input pin with Arduino A's output pin

Post by adafruit_support_bill »

Do you have pullups or pulldowns installed or enabled for your pushbutton pins? Code and/or wiring diagrams would be helpful.

User avatar
philba
 
Posts: 387
Joined: Mon Dec 19, 2011 6:59 pm

Re: Writing to Arduino B's input pin with Arduino A's output pin

Post by philba »

A bit more about the setup and symptoms: the UUT has four LEDs, two pushbuttons, and one pin that's wired directly to the Tester (for resetting the UUT's program). I have all seven wired to the Tester board.
That's confusing - do you have the LEDs and switches wired to both arduinos?

User avatar
pmw
 
Posts: 11
Joined: Wed Mar 28, 2012 11:29 pm

Re: Writing to Arduino B's input pin with Arduino A's output pin

Post by pmw »

All, thank you so far. I flattered myself into thinking that I explained everything well enough without needing schematics. Now I come with a breadboard view created in Fritzing. I attached the PNG, as PDFs and FZZ file extensions are not allowed as attachments. For the latter two, I put them on my webspace here.

As I mentioned in the original post, I verified with a voltmeter that the Test Harness correctly sends 5V to the UUT, so the code is correct.

philba, yes, all LEDs and buttons are connected in parallel to both Arduinos. The idea is for the UUT to not know whether it's the operator or the Test Harness triggering the buttons.

User avatar
philba
 
Posts: 387
Joined: Mon Dec 19, 2011 6:59 pm

Re: Writing to Arduino B's input pin with Arduino A's output pin

Post by philba »

you do know that has potential for direct short?

User avatar
pmw
 
Posts: 11
Joined: Wed Mar 28, 2012 11:29 pm

Re: Writing to Arduino B's input pin with Arduino A's output pin

Post by pmw »

philba wrote:you do know that has potential for direct short?
I don't know that. I am very new to circuits. Could you elaborate?

The principle I tried to follow is to have only one writer (but possibly multiple readers) on every circuit. For example, as long as the test harness is hooked up to the UUT, no one would be pressing the pushbuttons.

User avatar
pmw
 
Posts: 11
Joined: Wed Mar 28, 2012 11:29 pm

Re: Writing to Arduino B's input pin with Arduino A's output pin

Post by pmw »

Thanks to everyone who looked and tried to help. A friend suggested to use a pull-down resistor instead of a pull-up resistor on my pushbuttons. That did the trick.

That's probably what you were alluding to, philba.

User avatar
philba
 
Posts: 387
Joined: Mon Dec 19, 2011 6:59 pm

Re: Writing to Arduino B's input pin with Arduino A's output pin

Post by philba »

No. What I'm talking about is if you have an LED that you can power from 2 different arduinos. Arduino A outputs a high and arduino B outputs a low, if they are wired directly together, you will have a short to ground. The way to make this work is to have a series resistor from each pin running to the LED which then connects to gnd. I'm not sure why you would do this when LEDs are cheap.

On the switches, it should work pulled up or down as long as both do it the same. Using internal pullups should work just fine. In fact, you probably only need to enable one Arduino's pullups.

User avatar
pmw
 
Posts: 11
Joined: Wed Mar 28, 2012 11:29 pm

Re: Writing to Arduino B's input pin with Arduino A's output pin

Post by pmw »

Philba, I think I see what you're saying. My intent is for all pin connections between the two Arduino boards to have one "reader" and one "writer," but you're saying that my reader is not at hi-Z, so the reader is grounding the same line that the writer is trying to assert. Do I have that right?

User avatar
philba
 
Posts: 387
Joined: Mon Dec 19, 2011 6:59 pm

Re: Writing to Arduino B's input pin with Arduino A's output pin

Post by philba »

If you always have the reader set to input, you will be OK.

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

Return to “Arduino”