I’m trying to have motion sensors send information to the app and have the app send that information to a Raspberry Pi. Is it possible to get this information? Can the information be taken from the Blynk server? Or can I get it to a local server? I am willing to do this with pretty much any type of hardware, including nodeMCU, Raspberry Pi, Arduino, etc. as long as the motion sensors are still involved and I can get the information from the app to something else wirelessly.
You have a few options.
You could connect a NodeMCU (Wemos D1 Mini would be my choice) or ESP-01 to each motion sensor and have it send the data to Blynk, or directly to a Raspberry Pi via MQTT.
The drawback to this is power consumption of the device you connect to your motion sensor (maybe not a problem if they are mains powered).
My preference (and something I’ve done myself) Is to use standard 433MHz PIR motion sensors, door/window sensors, panic alarms etc and have a 433MHz receiver attached to a NodeMCU.
When a sensor is triggered it sends a unique (pre-defined by the manufacturer) code which is picked-up by the 433MHz receiver and is then translates into something meaningful relayed to the Blynk server. In my case, I don’t send it directly to Blynk, but use the 433MHz receiver as a bridge to turn it into an MQTT message which is then sent to my Raspberry Pi, and relayed to the Blynk cloud server from there if necessary.
This approach has the advantage that the 433MHz sensors have a long battery life and are available off the shelf without any need for modifications. The 433 to Blynk bridge device can be located anywhere within range of the sensors (you could even have multiple bridge devices if range was an issue, but I doubt that would be necessary) and can be powered via a mains to USB power supply.
Not sure if this helps or confuses… but you could always use the API on the blynk server.
[root@speedtest tmp]# [root@speedtest tmp]# [root@speedtest tmp]# curl http://blynk:8080/5a2500875e134421a4a301f8636feh68/get/v1 ["157"][root@speedtest tmp]# [root@speedtest tmp]# [root@speedtest tmp]# wget http://blynk:8080/5a2500875e134421a4a301f8636feh68/get/v1 --2019-01-05 20:59:14-- http://blynk:8080/5a2500875e134421a4a301f8636feh68/get/v1 Resolving blynk (blynk)... 220.127.116.11 Connecting to blynk (blynk)|18.104.22.168|:8080... connected. HTTP request sent, awaiting response... 200 OK Length: 7 [application/json] Saving to: âv1â 100%[===============================================>] 7 --.-K/s in 0s 2019-01-05 20:59:14 (1.35 MB/s) - âv1â saved [7/7] [root@speedtest tmp]# more v1 ["157"] [root@speedtest tmp]# [root@speedtest tmp]#
“blynk” is my local server.
157 = the current value of my v1 pin.
5a2500875e134421a4a301f8636feh68 = my auth code
curl and wget are very similar, i switch between the two depending on my need.
depending on your raspi os, you may have to apt-get install curl / wget
you can also use the api to change the values if you like.
Thank you! I’ll try those.
Thank you! Very helpful