Wireless Camera Flash Trigger embedded system with NRF24L01+

Hello and good evening to all of you! I am developing for my diploma thesis a simple small system that would trigger automatically the flash or the camera itself, for photographic purposes, depending on some sensor measurements. This has been done before with the use of Arduinos if I am not mistaken, however my main differentiation from existing projects is that I want to make the connection between the sensors and the "Base" system wireless! So for the wireless communication I use the NRF24L01+ modules. I want to make use of two sensors, each of one connected to an Arduino Nano. The "base" subsystem that ought to trigger the flash is also based on an Arduino Nano. For the purpose of this, I have made use of the RF24 library developed by TMRh20(https://tmrh20.github.io/RF24/) and the github page is this ( GitHub - nRF24/RF24: OSI Layer 2 driver for nRF24L01 on Arduino & Raspberry Pi/Linux Devices)

At first I want to send a message from the base to the Arduinos of the sensors, as a recognition message. After all of them have responded, and each every second, the base will send another message with a different value to indicate to the corresponding sensors that they should reply back with their current measurement value. I do that so that the user can see what measurements the sensor reads and could set a threshold trigger value according to those. Then, after that, the base should sent to the sensors that threshold value and go into Primary Receiver Mode. After the sensor Arduinos have received this message they would Primary Transmitters. Once the threshold of a sensor has been reached, the according sensor Arduino should send a message to the base Arduino in order for it to know if it should trigger the flash/camera.

For the first two stages of that procedure I was successful by using the library's ability to make use of the Automatic Acknowledgments and the use of Dynamic Payloads. Then after that,(because I haven't yet connected true sensors to the Arduinos, just sending "dummy" messages to validate that this would work) I change roles to the Arduinos, but I am unable to make the "Base" listen to any of the messages. The sensor tries to send a message every second, but it always fails to write. I have tried to use ACKS here too, but it doesn't work. I have tried it without the ACKS too(because I need less latency here in order to trigger the flash fast enough) but the same problem occurs. The base doesn't receive any of the sensors messages. I will pos t my code for both. Could anyone please indicate to me what could be the problem causing this? I have read in previous threads that you may have to power down and then power up again the RFs to change roles from transmitter to receiver when using the Automatic Acknowledgments but after trying this, the same thing happens.

I have tested all of the library's examples and they seem to work just fine, without any actual problem. So I don't think it has anything to do with faulty modules. Also I have tried this with many different modules too.

Because my code is too long to quote here, I will attach both the code for the base system and also the sensor system as .zip files.

Please ignore the actual Payload of the messages. -1 is the recognition message, -2 is the message for sensor data request, and when you press a button I have attached to pin 2, the base sends a message with the value of -3 which lets the sensors know they should change roles. This is done, since I have not yet inserted any actual sensors or thresholds. I just use these values to make sure this would work with real sensor data.

Also please ignore the fact that I have used random numers to be sent. This is done because I have not inserted any actual sensors to the system yet.

So if you notice, on the base system in the function CheckForTriggers i have included a Serial.print message while the base radio has nothing available. The message is in greek and please ignore what it actually says, if you speak the language :stuck_out_tongue:
There is where the system stays after you change roles. It keeps printing that message, implying that the base doesn't receive anything from either of the sensors. Meanwhile the sensors keeps trying, but reports failure of sending the message. The code for the second sensor is exactly the same as the first one, you just change the NODE_ID definition at the start of the code accordingly.

Could anyone please help with this? Is there a chance that I am trying to do something that is not doable? Can the NRF24L01+ change from transmitter to receiver and vice versa while using Acknowledgements? If not, is it something to do with the library or with something hardware wise? Thank you in advance and sorry if you get confused by my English

ProtocolBase0503.zip (12 KB)

ProtocolSensor0503.zip (8.02 KB)

Your English is fine, it's the quantity that I gave up on. Sorry.

Paul

Paul_KD7HB:
Your English is fine, it's the quantity that I gave up on. Sorry.

Paul

Well I guess I should explain in details what I am trying to do and give as much information as I can. Should I not? :stuck_out_tongue: