BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

I need a FAIL SAFE

I can almost see your point… but “blinking an LED” vs “Semi-autonomous failsafe on a self-powered moving object”, is not quite the same… some code will be required, and NO, no one will “write it please” for you without seeing some efforts on your part first.

ideas first and the rest comes second . i go sleep and will use tomorrow to bring my efforts as much i can …

stefan

Sounds good… we will be here to help :slight_smile:

interrupts()

Description

Re-enables interrupts (after they’ve been disabled by noInterrupts()). Interrupts allow certain important tasks to happen in the background and are enabled by default. Some functions will not work while interrupts are disabled, and incoming communication may be ignored. Interrupts can slightly disrupt the timing of code, however, and may be disabled for particularly critical sections of code.

Parameters

None

Returns

None

Example

void setup() {}

void loop()
{
noInterrupts();
// critical, time-sensitive code here
interrupts();
// other code here
}

can this be the right way ?? so now i have to learn c /c++

You don’t need to use interrupts just the libraries Blynk provides. SimpleTimer will do the job, take a look through Blynk for Beginners and help with your project

That was a quick nap :smiley: And to some degree, YES you will need to learn enough to get by… I also have a tank drive robot that I made, and while I did find an app to simply control it with, I still needed to know enough to modify the Arduino sample sketch to match my hardware and accommodate any “extras” that I wanted, (LED control, gear change, and even a “how to not let your robot take off on its own” routine).

I haven’t Blynkified that robot yet, but when I do, I know I will need to understand how Blynk communicates and how to detect disconnects.

Search around this forum for the words connect, disconnect, etc. to see how others have handled the same types of issues.

so im strugeling
just one question .
How can my robot check the connection to my phone . would be the same as in the app
true = phone online max 500 ms
false = offline = pin x shut down

stefan

@stefan8484 take a look at the Connection Management section of the docs at http://docs.blynk.cc/#blynk-firmware-connection-management
Specifcally the Blynk.connected() function.

Have you studied the comprehensive docs in detail?

My board has destroyed because 12v have come to the big metall lanport accidentally. Have a cable not isolated :wink:
now my board is fully opened … if i power 5 v the cables starts to glow …:joy: hahahaha

1 Like

Checking the Blynk link status is not sufficient for a fail-safe as this seems to check the connection between the controller and the Blynk server and not the connection between the Blynk server and the IOS/Android device.

One potential solution that I am using is to have the robot controller (in my case a Rasp Pi) “ping” the IOS/Android device every second when the robot is moving. If the ping “fails” then the movement shuts down.

The only downside is that I have to manually load the IP address of the IOS device each time as I do not use a fixed IP address.

1 Like

@SNorwood are you using the ping with the server connection check or just ping?
Is the ping just on your LAN?

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