Skip to main content
Post Migrated Here from electronics.stackexchange.com (revisions)
Source Link
Matze
Matze

Arduino voltage drop while communicating with another Arduino

I have an Arduino Uno rev 3 and an Arduino Nano in my Setup. I want to create a proof of concept, where one Arduino triggers the other via the Digital IOs. Arduino 1 sets a blinking signal on a digital pin (500ms delay between high/low), which is received by arduino 2. If the signal is high, Arduino 2 triggers a LED (digital pin to LED+; LED- over 330 Ohm resistor to ground), so the signal gets looped through somehow. The grounds of the two Arduinos are connected, too.

Schematic

Code Arduino #1:

void setup() {
  DDRD |=_BV(PD7); //Sets Digital Pin 7 as Output
}

void loop() {
 PORTD |=_BV(PD7); // equivalent with digitalWrite(7, HIGH);
 delay(500);
 PORTD &=~_BV(PD7); // equivalent with digitalWrite(7, LOW);
 delay(500);
}

Code Arduino #2:

void setup() {
  DDRD &=~_BV(PD7); //Sets Digital Pin 7 as Input
  DDRD |=_BV(PB0); //Set Digital Pin 8 as Output
}

bool set = false;

void loop() {
  if((PIND&_BV(PD7))==_BV(PD7)) { //true if digital pin 7 is set
    if(!set) {
      //PORTB |= _BV(PB0);
      digitalWrite(8, HIGH);
      set = true;
    }
  } else {
    //PORTB &=~_BV(PB0);
      digitalWrite(8, LOW);
    set = false;
  }
    
}

But instead of emitting a bright light, which can be seen if connecting the blinking signal directly to the LED, it emits a faint light. The voltmeter also shows an significant Voltage drop. Whilst the digital pin should have a voltage of ~5V when set to HIGH (never reached because of inner resitance inside the arduino), it measures about 1.6-1.8V. I also switched the both Arduinos which showed the same result, so it shouldn't be a hardware defect.

Thanks in Advance!