I have two Arduino, one is to handle the Bluetooth communication and send a signal to the other Arduino, and the other to interpret the signal and display or hide an image on the E-ink display.

It work just fine when they both are connected through the USB. But when I connect a 9V battery to the Arduino running the E-ink, instead of the USB, the image is displayed and cleared (looping), as if the IF ELSE conditions are not there.

I have tested if it actually runs the method by adding delay to the showImg()-method, and that seems to work.

I have also tested with connecting the USB cable to the E-ink Arduino to a 5V charger, and the case is the same.

Image: Setup

Bluetooth code:

int ledPin = 13; 
int state = 0;
int flag = 0; 

void setup() {
 pinMode(ledPin, OUTPUT);
 digitalWrite(ledPin, LOW);


void loop() {

 if(Serial.available() > 0){
 state = Serial.read();

 if (state == '2') {
 digitalWrite(ledPin, LOW);
 if(flag == 0){
 Serial.println("Screen: off");
 flag = 1;

 else if (state == '1') {
 digitalWrite(ledPin, HIGH);
 if(flag == 0){
 Serial.println("Screen: on");
 flag = 1;

E-ink code:

#include <epd.h>

int displayed = 0;
int val = 0;

void showImg(void)
  displayed = 1;
  epd_disp_bitmap("PIC9.bmp", 0, 100);


void clearImg(void){
  displayed = 0;


void setup(void)
  pinMode(7, INPUT);


void loop(void)
  val = digitalRead(7);

  if(val == 1){

    if(displayed == 0){

  }else {

    if(displayed == 1){

I am a beginner when it comes to Arduino, So I hope someone can give me some hints to what may be wrong.


  • Please edit the question to fix the following ambiguity: in “connecting ... to a 5V charger ... the case is the same” it isn't clear whether you mean like the battery setup or like the USB-to-computer setup, ie, whether it fails or works Jun 4, 2016 at 15:27

1 Answer 1


The USB provides the one thing that is missing from your diagram there: the common ground.

The GND pins of the two boards must be connected together. By using USB the USB becomes that connection. As soon as you use batteries there is no connection, so no communication happens.

  • Thanks for the reply Majenko. You are absolutely right, and I'm surprised I did not see this.... Thank you! Jun 6, 2016 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.