Serial TX/RX command

Project basics
(1) Particle Electron + nRF24L01 as server
(up to 6) Pro Mini + nRF24L01 + sensor as client

Server TX to client, turn on sensor. Client monitors sensor. When sensor threshold is reached, TX data to server. When message received by server, TX instructions back to client (i.e.-turn on LED).

So, the radios will change TX/RX roles depending on what is happening. I would like to handle serial commands (TX/RX) by pushing button widget. I have seen references to using virtual pins. If user pushes button app it sends T serial command to Electron and R serial command to Pro Mini and tells sensor to turn on. Then once ACK is received from Pro Mini they reverse rolls.

I have already read too much :roll_eyes: so can someone tell me if this is even possible using a button widget and virtual pin (or some other method other then terminal widget)? If so, point me in the direction please.
Thank you

yes, it is certainly possible with button widget + virtual pins. but how the blynk server will communicate to the hw?

this is what hw exactly? arduino, wemos, or what?

This is a cellular board and the pro mini is arduino

i see. but than my question is still valid, how will the blynk server communicate to the arduinos?

The server communicates with the Electron. The Electron passes commands to the Pro mini via the nRF radio.

ok, so the blynk server actually just have to talk to particle via virtual pins. that part is easy coding.

but the rest of the communiction between master (particle) and slaves (arduinos) via nrf, you have to code yourself, and that is not a trivial task.

Yes, that I understand. :cold_sweat: All 6 clients do the same thing. So the Electron could send out a global broadcast on one pipe for the clients to RX and so they know to wake up and start monitoring. Then the devices switch rolls after ACK received and the clients TX sensor data (when threshold reached) back to Electron via a second pipe. A second button could be used to reset or acknowledge the threshold condition and thus the roles would switch again which can apparently happen via button widget and virtual pins based on your confirmation. Sounds easy, LOL

So do you have a refernce that I can look at on how to accomplish the original question?
Thank you

as i have 0 (zero) experience in nrf, i can not help you with this part. but if all slaves have to do the same thing, probably you can use the same firmware on all slaves. and this could simplify the effort.

for the button widget and virtual pin just study the sketch builder or the included examples in the blynk library + read the official docs. it is very detailed and easy to use.

i would reccomend to split the work in 2 parts:

  1. write and test the code for communication between blynk and particle, and after thats working relaible

  2. write a separate sketch for communication between slaves and particle. this will need 2 sketch: one for the particle and one for the arduinos. after this works, independently from blynk, merge the 2 points into one big sketch.

Understood, Thank you

I have read this and I am not sure how I accomplish a serial command using any of these examples. That was the reason for the post.

Thanks for your help

I have these parts already. I can RX and TX back and forth between the devices, no problem (now that is, do not want to discuss how many hours it took!) I also can control a pin on electron via blynk while the other part is going on. I have a code that works the way I want it to on the clients.

What I need to do
A) write code that allows for electron to tell pro mini what to do
B) write code that allows for role changes on devices using virtual pins (somehow)

you do not have to accomplish the serial command with the virtual pins and buttons widget. they are used just to initiate the predefined commands:

you write the serial commands in separate function, and test first without blynk. than, with the virtual pin, you just init those commands. like this:

if virtualpin5 == 1, than do this:
call function which sends serial command

maybe, if you share the code (properly formatted) what you have so far? i’m sure someone will help to develop further…

Ok that makes sense

Understood. I only have bits and pieces so far. Nothing that would be worth sharing at this point. When I get a bit further and have something more complete.

I appreciate your replies and explanation on the serial commands.
Thank you