COPY AND PASTED FROM MY ORIGINAL POST
forum.allaboutcircuits.com
Hello, I am creating a Sprinting Timer and am very new to all things Arduino related. This will consist of two towers that each have an Ultra-Sonic Sensor, an nRF module (specifically an NRF24L01+PA+LNA), an Arduino, and a 9v battery pack. The second tower has a 2x16 digital screen to display the time. It will work by detecting when a person (or object) passes by the first Ultra-Sonic sensor on Tower 1 (Transmitter), and a signal is sent to Tower 2 (Receiver). When Tower 2 receives the signal, it will start a timer and end it when the runner passes the second Ultra-Sonic Sensor, then it will display the time out on the 2x16 digital screen. To reset it you will need to click a button and then it will be ready for another run.
The Problem:
I have run into a problem while working on the connection between the two Arduinos for each tower, however. When testing them I had it print certain things when the Receiver got the signal from the Transmitter. The transmitter works fine (or at least the sensor part), sending out a signal and printing that it did so. But the Receiver very rarely is able to pick up the transmitter's signal. It works very randomly; after waving my hand in front of the transmitter's sensor for around 5 minutes (while not focused on the Serial Monitor from the receiver, I was on a different window from the Arduino IDE), I checked the IDE and noticed that it had picked up the transmitted signal for a few seconds and caught the signal around 5 or 6 times but then did not work again.
I am sure that if I were to test again and watch the Serial Monitor from the Receiver Device, then after 20 minutes of waving my hand in front of the sensor, then the Receiver could pick up a few signals, but it would be so inconsistent that it would practically be useless. I am not sure what is causing these problems, but they are probably the last big hurdle I will have to get over.
Although I do not know exactly what the cause is, I have some theories.
- Power Supply Issues: Many of my other sources (web posts, YouTube, ChatGPT) have suggested that the module is starving for power. I currently have it hooked up to 3.3v and I am pretty sure that is enough (I read more will fry the module), and I have a 100UF capacitor between the VCC and Ground as I think I am supposed to. I do not have a multimeter to see if it is receiving the correct amount of energy.
- Wiring Problems: Another issue that I have commonly come across is that it may be the wires are making too much physical "noise", which is cutting off electrical supply? I am not sure about this one, and it confuses me a bit more than the other possibility. Maybe it is a mix of both.
Transmitter

Receiver

Thanks for looking into it, and if you don't happen to know the problem do you know anywhere I could look or someone I could ask to fix this?
Why are my NRF24L01+PA+LNA modules not connecting? For Sprinting Timer
Hello, I am creating a Sprinting Timer and am very new to all things Arduino related. This will consist of two towers that each have an Ultra-Sonic Sensor, an nRF module (specifically an NRF24L01+PA+LNA), an Arduino, and a 9v battery pack. The second tower has a 2x16 digital screen to display...
Hello, I am creating a Sprinting Timer and am very new to all things Arduino related. This will consist of two towers that each have an Ultra-Sonic Sensor, an nRF module (specifically an NRF24L01+PA+LNA), an Arduino, and a 9v battery pack. The second tower has a 2x16 digital screen to display the time. It will work by detecting when a person (or object) passes by the first Ultra-Sonic sensor on Tower 1 (Transmitter), and a signal is sent to Tower 2 (Receiver). When Tower 2 receives the signal, it will start a timer and end it when the runner passes the second Ultra-Sonic Sensor, then it will display the time out on the 2x16 digital screen. To reset it you will need to click a button and then it will be ready for another run.
The Problem:
I have run into a problem while working on the connection between the two Arduinos for each tower, however. When testing them I had it print certain things when the Receiver got the signal from the Transmitter. The transmitter works fine (or at least the sensor part), sending out a signal and printing that it did so. But the Receiver very rarely is able to pick up the transmitter's signal. It works very randomly; after waving my hand in front of the transmitter's sensor for around 5 minutes (while not focused on the Serial Monitor from the receiver, I was on a different window from the Arduino IDE), I checked the IDE and noticed that it had picked up the transmitted signal for a few seconds and caught the signal around 5 or 6 times but then did not work again.
I am sure that if I were to test again and watch the Serial Monitor from the Receiver Device, then after 20 minutes of waving my hand in front of the sensor, then the Receiver could pick up a few signals, but it would be so inconsistent that it would practically be useless. I am not sure what is causing these problems, but they are probably the last big hurdle I will have to get over.
Although I do not know exactly what the cause is, I have some theories.
- Power Supply Issues: Many of my other sources (web posts, YouTube, ChatGPT) have suggested that the module is starving for power. I currently have it hooked up to 3.3v and I am pretty sure that is enough (I read more will fry the module), and I have a 100UF capacitor between the VCC and Ground as I think I am supposed to. I do not have a multimeter to see if it is receiving the correct amount of energy.
- Wiring Problems: Another issue that I have commonly come across is that it may be the wires are making too much physical "noise", which is cutting off electrical supply? I am not sure about this one, and it confuses me a bit more than the other possibility. Maybe it is a mix of both.
Transmitter

Receiver

C++:
// Transmitter Script V2
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8);
const byte address[6] = "00001";
const int trigPin = 2;
const int echoPin = 3;
unsigned long lastTriggerTime = 0;
const unsigned long cooldown = 3000; // 3 seconds cooldown
void setup() {
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
if (!radio.begin()) {
Serial.println("RF module hardware not detected!");
while (1);
}
radio.setPALevel(RF24_PA_MAX);
radio.setDataRate(RF24_250KBPS);
radio.setChannel(115);
radio.setAutoAck(false);
radio.openWritingPipe(address);
radio.stopListening();
Serial.println("TRANSMITTER ONLINE!");
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
long duration = pulseIn(echoPin, HIGH, 20000); // 20ms timeout
int distance = duration * 0.034 / 2;
unsigned long currentTime = millis();
if (distance > 0 && distance < 50 && (currentTime - lastTriggerTime > cooldown)) {
Serial.println("!!! RUNNER DETECTED !!! Sending Signal...");
char text[32] = "START";
// Send 3 distinct attempts with small gaps to avoid memory buffer crashes
for(int i = 0; i < 3; i++) {
radio.write(&text, sizeof(text));
delay(5);
}
lastTriggerTime = currentTime;
}
}
C++:
//Receiver Script V2
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8);
const byte address[6] = "00001";
const int trigPin = 2;
const int echoPin = 3;
unsigned long startTime = 0;
unsigned long finishTime = 0;
float elapsedTime = 0.0;
bool timerRunning = false;
const int triggerDistance = 30;
void setup() {
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
if (!radio.begin()) {
Serial.println("RF module hardware not detected!");
while (1);
}
radio.setPALevel(RF24_PA_LOW);
radio.setDataRate(RF24_250KBPS);
radio.setChannel(115);
radio.setAutoAck(false);
radio.openReadingPipe(0, address);
radio.startListening();
Serial.println("Receiver Ready. Waiting for Start Line...");
}
void loop() {
// 1. Listen for Start Signal
if (!timerRunning) {
if (radio.available()) {
char text[32] = "";
radio.read(&text, sizeof(text));
if (strcmp(text, "START") == 0) {
startTime = millis();
timerRunning = true;
Serial.println("\n---- TIMER STARTED! RUNNER IS SPRINTING! ----");
// Clear out lingering redundant "START" packets from the RF buffer
radio.flush_rx();
}
}
}
// 2. Read Finish Line Sensor
if (timerRunning) {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
long duration = pulseIn(echoPin, HIGH, 20000); // Max 20ms wait
int distance = duration * 0.034 / 2;
if (distance > 0 && distance < triggerDistance) {
finishTime = millis();
// Prevent division/overflow errors
if (finishTime >= startTime) {
elapsedTime = (finishTime - startTime) / 1000.0;
Serial.print("---- FINISH! Total Time: ");
Serial.print(elapsedTime, 3);
Serial.println(" seconds ----\n");
}
timerRunning = false;
// Clear any RF signals received while the runner was sprinting
radio.flush_rx();
delay(3000); // 3 second reset delay
Serial.println("Waiting for Start Line...");
}
}
}
Thanks for looking into it, and if you don't happen to know the problem do you know anywhere I could look or someone I could ask to fix this?
Last edited by a moderator: