1
votes

I am reading sensor values from Raspberry Pi 2 and sending it to bluemix IoT platform using node-red application on the Pi. After monitoring the values, I would like to send the command back to raspberry pi from the node red starter in the bluemix to control the GPIO on the Pi using node red application on the Pi.

I am able to send the data from the raspberry pi to the Bluemix using Node Red, and the data is also displayed on the node red starter in Bluemix (ibmiotin node). But the command from the bluemix to the Pi is not being sent.

When I try to send command by using the inject node to the PI, then the command is sent perfectly, but when I use the sensor input node to send the command, the command is not sent to the device.

Is there any criteria in the Bluemix that the same device can't be used for sending and receiving the data simultaneously?

How can I send the data back to the raspberry pi using the bluemix node-red starter?

P.S. Both the devices(sensor and Pi) are shown as connected in the IoT dashboard and also in node-red.

The image of my node red in bluemix is as shown below.

enter image description here

2
post the code, we need to see what you are missing or doiung wrong...ΦXocę 웃 Пepeúpa ツ
If you could add your 2 flows (json - select all, export) it might help. Logically either a problem with your Out node in bluemix or In node on the Pi. For debug, have the In node on Pi listen to All commands. Make sure the Out node on bluemix sends a Command, not an Event.amadain
Thanks for the advice. The input node on the Pi is set to all commands and the output node is set to send a command.As I told, when I inject with switch on/off nodes, then the command is sent properly but only the control from ibmiot in node is not functioning.Dipumon

2 Answers

1
votes

I just needed to add a json node before the ibmiot out node to send the commands to the device.

This solved the problem.

The updated flowenter image description here is follows:

0
votes

have a look on publish and subscribing to commands:

https://console.ng.bluemix.net/docs/services/IoT/applications/mqtt.html

You can use an mqtt node to publish and subscribe to the commands topic, parse the command in a function node then send it to your Pi through GPIO node