Digital Stop watch_problem with NRF24L01 and external power

Hi Guys,

I´m totally new here and this is my first post.

I´m trying to create a digital stop watch with a IR-Light Barrier and wireless communication.
I´m using two micro´s and two "e18-d50nk" for communication two "NRF24L01".

The distance between the two IR-Sensors is ca. 30m.

I wired up every thing correct and the code works.
When the first Sensors Starts the Stopwatch runs and shows me on the LCD. When the second sensor is pulled down a char[] "S" will be send and the reciever stops with the stopwatch.

MY PROBLEM NOW:

When one arduino is powered with the USB, so when it´s connected with the Serial the Reciever can communiced with transmitter.

But when I power the two arduinos with a external power supply unit, the stop watch begins to count when i hit the first sensor, but it doesent recieve any data from the transmitter.

I installed a Piezo to hear it, when the transmitter is sendig data, or the reciever is getting data, the transmitter is sendig data, with external power, but the reciever doesn´t take it.

I can´t find the problem, why does the arduino nothing recieve, when it´s powered by a external power supply.

I also tried to start first the transmitter, and then the reciever and reversed, but it doesn´t help anything.

HAS ANYONE EXPERIENCE WITH THIS?

THANK`S A LOT :smiley:

Here the Code:

TRANSMITTER:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//-----------------------

RF24 radio(7, 8);

const byte rxAddr[6] = "00001";

//FOR BEEPER
//-------------------
int Speaker = 2;
//-------------------

//FOR SENSOR
//-------------------
int Input_Sensor = 12;
char test[] = "S";
//-------------------

//SETUP
void setup()
{
//Serial.begin(9600);
radio.begin();

radio.setRetries(15, 15);
radio.openWritingPipe(rxAddr);
radio.stopListening();

pinMode(Input_Sensor, INPUT);
pinMode(Speaker, OUTPUT);
}

//DEFINE FUNCTIONS
void BEEP(int frequency);

//LOOP
void loop()
{

if(digitalRead(Input_Sensor) == HIGH)
{
radio.write(&test, sizeof(test));
BEEP(200);
}
}

//PEEP FUNCTION FOR SPEAKER
void BEEP(int frequency)
{
// generate a 1KHz tone for 1/2 second
for (int i = 0; i < 500; i++)
{
digitalWrite(Speaker, HIGH);
delayMicroseconds(frequency);
digitalWrite(Speaker, LOW);
delayMicroseconds(frequency);
}
}

RECIEVER:

//Libraries
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <LiquidCrystal.h>
//----------------------------

RF24 radio(7, 8);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

const byte rxAddr[6] = "00001";

//FOR STOPWATCH
//-------------------
double i = 0;
double a = millis();
double c ;
int Input_Sensor = 9;
//-------------------

//FOR BEEPER
//-------------------
int Speaker = 6;
//-------------------

//DEFINE FUNCTIONS
void BEEP(int frequency);

void setup()
{
//Serial.begin(9600);

radio.begin();
radio.openReadingPipe(0, rxAddr);

radio.startListening();
pinMode(Input_Sensor,INPUT);
pinMode(Speaker, OUTPUT);

// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print(" -STOP WATCH V1-");
delay(1000);
}

void loop()
{
a = millis();

if(digitalRead(Input_Sensor) == LOW)
{
char text[32] = {0};
do
{
c = millis();
i = (c - a) / 1000;
lcd.setCursor(0, 1);
// print the number of seconds since reset:
Serial.println(i);
lcd.print(i);
lcd.print(" Sekunden");
//if (radio.available())
{
radio.read(&text, sizeof(text));
Serial.println(text);
}
}while(text[0] != 'S');

}
}

//BEEP FUNCTION FOR SPEAKER
void BEEP(int frequency)
{
// generate a 1KHz tone for 1/2 second
for (int i = 0; i < 500; i++)
{
digitalWrite(Speaker, HIGH);
delayMicroseconds(frequency);
digitalWrite(Speaker, LOW);
delayMicroseconds(frequency);
}
}

I´m totally new here and this is my first post.

Actually, it's your second, but don't worry, I deleted its equally badly-posted twin.

yes first one was at the wrong folder...but thank you "awol" for this useful information...

Hi

Can you go back and please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Tom... :slight_smile:

Please modify your Original Post and use the code button </>

so your program looks like this

and doesn't have any smileys.

When you do that I will look at the code.

...R

Hi Guys,

I´m trying to create a digital stop watch with a IR-Light Barrier and wireless communication.
I´m using two micro´s and two "e18-d50nk" for communication two "NRF24L01".

The distance between the two IR-Sensors is ca. 30m.

I wired up every thing correct and the code works.
When the first Sensors Starts the Stopwatch runs and shows me on the LCD. When the second sensor is pulled down a char[] "S" will be send and the reciever stops with the stopwatch.

MY PROBLEM NOW:

When one arduino is powered with the USB, so when it´s connected with the Serial the Reciever can communiced with transmitter.

But when I power the two arduinos with a external power supply unit, the stop watch begins to count when i hit the first sensor, but it doesent recieve any data from the transmitter.

I installed a Piezo to hear it, when the transmitter is sendig data, or the reciever is getting data, the transmitter is sendig data, with external power, but the reciever doesn´t take it.

I can´t find the problem, why does the arduino nothing recieve, when it´s powered by a external power supply.

I also tried to start first the transmitter, and then the reciever and reversed, but it doesn´t help anything.

HAS ANYONE EXPERIENCE WITH THIS?

THANK`S A LOT :smiley:

Here the Code:

TRANSMITTER:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//-----------------------

RF24 radio(7, 8);

const byte rxAddr[6] = "00001";


//FOR BEEPER
//-------------------
int Speaker = 2;
//-------------------

//FOR SENSOR
//-------------------
int Input_Sensor =  12;
char test[] = "S";
//-------------------


//SETUP
void setup()
{
  //Serial.begin(9600);
  radio.begin();
 
  radio.setRetries(15, 15);
  radio.openWritingPipe(rxAddr);
  radio.stopListening();

  pinMode(Input_Sensor, INPUT);
  pinMode(Speaker, OUTPUT);
}


//DEFINE FUNCTIONS
void BEEP(int frequency);


//LOOP
void loop()
{
   
  if(digitalRead(Input_Sensor) == HIGH)
  {   
    radio.write(&test, sizeof(test));
    BEEP(200);
  }
}




//PEEP FUNCTION FOR SPEAKER
void BEEP(int frequency)
{
  // generate a 1KHz tone for 1/2 second
  for (int i = 0; i < 500; i++)
  {
    digitalWrite(Speaker, HIGH);
    delayMicroseconds(frequency);
    digitalWrite(Speaker, LOW);
    delayMicroseconds(frequency);
  }
}

RECIEVER:

//Libraries
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <LiquidCrystal.h>
//----------------------------

RF24 radio(7, 8);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

const byte rxAddr[6] = "00001";

//FOR STOPWATCH
//-------------------
double i = 0;
double a = millis();
double c ;
int Input_Sensor = 9;
//-------------------

//FOR BEEPER
//-------------------
int Speaker = 6;
//-------------------


//DEFINE FUNCTIONS
void BEEP(int frequency);



void setup()
{
  //Serial.begin(9600);
 
  radio.begin();
  radio.openReadingPipe(0, rxAddr);
 
  radio.startListening();
  pinMode(Input_Sensor,INPUT);
  pinMode(Speaker, OUTPUT);

  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print(" -STOP WATCH V1-");
  delay(1000);
}



void loop()
{
a = millis();


if(digitalRead(Input_Sensor) == LOW)
{
  char text[32] = {0};
  do
  {
    c = millis();
    i = (c - a) / 1000;
    lcd.setCursor(0, 1);
    // print the number of seconds since reset:
    Serial.println(i);
    lcd.print(i);
    lcd.print(" Sekunden");
    //if (radio.available())
    {
      radio.read(&text, sizeof(text));   
      Serial.println(text);
    }
  }while(text[0] != 'S');
 
}
}



//BEEP FUNCTION FOR SPEAKER
void BEEP(int frequency)
{
  // generate a 1KHz tone for 1/2 second
  for (int i = 0; i < 500; i++)
  {
    digitalWrite(Speaker, HIGH);
    delayMicroseconds(frequency);
    digitalWrite(Speaker, LOW);
    delayMicroseconds(frequency);
  }
}

I couldn't see how your new thread differed from your original one, so I merged them

okey, thx
and do you have experience´s with this problem?

How are you powering your Arduinos when they are not connected to the PC (volts and amps).

Can you try, in turn, Rx connected to PC and Tx powered separately and Tx connected to PC and Rx powered separately and tell us what happens in each case.

...R

You need to power arduino with more than 7 Volts. Check this.