Transfer ADXL data from arduino to another using NRF24L01

Hello

I am doing project to send adxl data from one arduino to another. i am using ADXL as tilt sensor if x axis is more than specified value then there will be interrupt at transmitter and sends data to receiver.

Data transmission is good but it is taking delay around 30 seconds. i want to make when the angle is more than specified then transmitter should suddenly come out of sleep mode and send data.

please find attachment for the code

adxl_final.ino (9.9 KB)

sei(); // reenable interrupts
  interrupts();

Both of those functions do exactly the same things.

  cli(); // disables all interrupts on the microcontroller so that configuration is never disrupted and left unfinished
  noInterrupts();

Both of those functions do exactly the same things.

Do you have still have a significant delay if you stop falling asleep?

PaulS:

sei(); // reenable interrupts

interrupts();



Both of those functions do exactly the same things.



cli(); // disables all interrupts on the microcontroller so that configuration is never disrupted and left unfinished
  noInterrupts();



Both of those functions do exactly the same things.

Do you have still have a significant delay if you stop falling asleep?

yes i have delay.

i want to make if the ADXL value is greater than the specified value then transmitter should wakeup suddenly and sends data.

if ADXL value is less than the specified value then every 24seconds device should check the data and send. for this i have made watchdog timer of seconds and multipled with 3.

everything is fine but when there is an interrupt it is taking delay.

I can't figure out what your program is trying to do. Please provide a description of your project.

Data transmission is good but it is taking delay around 30 seconds

That makes no sense. A single nRF24 message takes a few millisecs so the lost time is nothing to do with the nRF24 - it is some part of your program.

Have a look at this Simple nRF24L01+ Tutorial.

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work

...R

Robin2:
I can't figure out what your program is trying to do. Please provide a description of your project.

project is to transfer data from one arduino to another using nrf24l01

Tranmitter part - here there will e two data one is adxl angle if it is more than specified then din pin 5 will go low and it is considered as interrupt. if din pin 5 goes low then transmitter device should come out of sleep mode and send data and again it should go to sleep.
here i have another that transmitter battery status so i should send every 24 seconds what is the voltage. for this i have made watchdog timer of seconds and made count by 3.

receiver part - here if we receive any data from transmitter then it will make alert.

The problem is with transmitter. before i was using some tilt sensor to make din pin 5 low when tilt gets active, then it was sending data without any delay. now i am working with adxl it is taking long delay.

Here are my two codes

One code is to measure the adxl value and another one is nrf24l01 data tranmission

please find the attachment.

Now i want to combine both the codes to replace previous tilt sensor to adxl value.

adxl.ino (1.31 KB)

transmitterfinaltested.ino (9.02 KB)

Get the thing working without any sleeping first. All that sleeping, interrupts and WDT stuff makes the program too complex to figure out.

If it works without the sleep code and then problems arise when you add in the sleep code it will narrow the area where you need to look for problems.

And if you have only two Arduinos (Tx and Rx) why have you got multiple addresses to confuse us?

...R

Hello

I tried to change the code now the battery voltage status it is sending but tilt status is not sending.

can someone please check the code once.

please find the attachment for the code

transadxl.ino (10.8 KB)

Hi

I have changed the complete code.

Now the transmitter will send the every 8 seconds. for this i have used watch dog time so every 8 seconds device will check the adxl and battery voltage data and sends to receiver.

Now i want to make small changes with this. if adxl y axis value is greater than the specified value then the device should send data suddenly to the receiver.

Is this possible to do? if yes how?

i have made counter to increase watch dog timer, because every one minute the receiver should know the transmitter data status. if the adxl ys axis data is more than specified the it should send suddenly.

please help me how this can be done.

please find attachment for the code.

transadxl.ino (10.1 KB)