I need a FAIL SAFE

I am currently using just a ping and not the Blynk server connection check. This is due to two reasons:

  1. I only ping when the robot has received a move command through the Blynk joystick and I stop the ping when the joystick moves back to neutral. That all I really need.

  2. I am using the Blynk functions in Node-Red and while the node shows the blynk connection status I have not spent any time on figuring out how to read the connection status and take action on it.

This ping solution only works on my LAN, but since I only drive the robot when I can see it, this is an acceptable limitation. (ie. the ping solution does not work outside of my LAN).

ok now i know how i will do it .
first i need to now how blynk sends the command . is there a frequency or just new data new sending ?
i will need a command frequency maybe 10 sendings in a second even i make noting .
noting means no change , can be full speed or no speed .
then i have frequency incomming commands from blynk app to the server to my tank ( Arduino Yun )
this will be stepp one .

second stepp
my sketch needs to check if the commands come in frequently (will be fine)(true) ā€¦or if no more commands come in and after a delay ( for example 200 ms ) it will shut down pin x or x and y or go to a programed fix point .

so this is my theory

because to reed only the ping from server is not enough your whatever can have a conektion to the server but maybe your phone have lost contakt and the server holds your joystick position . and your whatever drives in to lake.

i go from blynkphone to internet(server from blynk) to a second phone conected in 4g as a wifi hotspot to arduino yun.
so im able to drive wherever i want if i have a 4G mobile network

and im neebe dont now how to make this real ā€¦but i think its very Interesting for other too ( hope so )

stefan

can you post your ping code ? pls
regards stefan

I am using the advanced ping function in node-red and thus donā€™t have the actual node.js code.

Canā€™t you just use

void loop()
{
Blynk.run();
if(!Blynk.connected) { stopRoutine(); }
}

void stopRoutine()
{
}

That would do the trick I guess.

ok . but i have to wait a week for my new board.

what happent if i do stopRoutine . no more output from arduino or what?

thanks a lot stefan

it means that if Blynk is disconnected the void stopRouting(); will be run. You can put in there all the commands you need to do for stopping the robot.

to reed only the ping from server is not enough your whatever can have a conektion to the server but maybe your phone have lost contact.
so my tank need to now if my phone is conected

phone - app - internet 4g - blynk- internet - other phone 4g - arduino

You need to create your own heartbeat from the hardware to the app than. Iā€™m not sure how to do this exactly, but it probably can be done with 1 or 2 virtual buttons or ledā€™s.

would be great if it would be in the blink app .

heartbeat is the only way

now the first problem is on the android side to create a hardbeat by blynk app.
it can be just a pulse to a virtual pin on off interwall 200ms if it stops it will kick the FSave in ā€¦

http://docs.blynkapi.apiary.io/#reference/0/application-network-status/notify can i use this Ā“?

You could but your remote control device will crash before the PUSH message arrives. Consider something else.

ok so the normal heardbeat is all 10 s . is this correct. ?

Iā€™ve read somewhere here in the board

Search CTRL-F for the word heartbeat in the DOCs and you can read all about it again :wink:

@stefan8484

As he said, waiting on heartbeats and ping may have your robot loosing control long before it realises connection is broken.

You are not likely to find a magic pill to stop your robots motion via direct Blynk communication, it is not designed for that type of real time safety factor; 10 seconds is a long time for a moving object!

Work on the hardware side and setup a timeout in code (yes, you need to learn some :wink: ), wherein if it hasnā€™t had an incoming command (to move, stop, turn or anything else) in x seconds, then FULL STOP, and then try to re-establish connection.

but if i setup a timeout ā€¦and i just drive full speed and keep holding the joystick in position it would stop all x seconds . because no changing valuesā€¦