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

[SOLVED] Blynk local server Button not working

#1

Hello everyone!

I just created a project with a moisture sensor and a button that should activate a relay.

When I join the Blynk cloud, everything is working, I can see the values of the sensor and when I push the button, the relay activates. If I only change the code to my connect to my local Blynk server (on a Raspberry Pi), I am able to see the sensor data without any problem, but the relay does not activate when I push the button (should activate D1). Do you have any idea why is this?

Thanks!

0 Likes

#2

We need your sketch
Don’t forget to format with backticks ```

2019-07-12_091439

1 Like

#3

Thanks for the help. I will provide the code later but it is very simple. I am only connecting to my server and with a timer uploading the data of the moisture sensor.

The problem is not there. The problem is that when I create a widget in my Android app and create a button to activate the digital output D1, this is working for the blynk cloud server but not working for my local server.

I am just connecting through internet to my local server with a dynamic ip service (not from the Intranet inside my network, but outside it). I can connect to the server, create projects, put widgets to read the values of the sensors, but I cannot send an order (e.g. put D1 to 1) to my microprocessor. Is there a special port I have to open to do that?

0 Likes

#4

Are you connected outdoor?
if yes you need to open few ports , yes

0 Likes

#5

Yes, I am connected outdoor. I have already opened a few ports, (9443 and 8443). I have set the http/webmin port to 8082 but I didn’t open in my router.

Do the communication for the widget button goes through a different port as the gauges? I can see the values of the gauges and also the values of the Super Chart but I cannot send an order to my microcontroller.

Which ports do I have to open in my router?

Thanks very much for your help!!!

0 Likes

#6

No special ports needed for that, but having the correct device type in your project will make a difference with direct GPIO manipulation as opposed to using vPins, which don’t care of the device type.

You also might want to make sure the Auth code and App connection are correct for your server and not for the Cloud… I have banged my head a few times with issues before realising which server I was connected to :stuck_out_tongue:

2 Likes

#7

Do you have multiple devices set-up in your app?

If so, check that the button widget is connected to the correct device (the one that uses the Auth code that’s in your sketch).

Pete.

2 Likes

#8

The auth code must be correct. Otherwise, I wouldn’t be able to see the values of the sensor live.

I think I know why I am having this problem!!! I selected Wemos D1 profile in the app for this project and I am using a Wemos D1 Mini!!!

I will try later with the right setting (now I cannot) and I will report!!!

Thanks very much to @PeteKnight and @GunnerTechTools!!!

0 Likes

#9

I have generally avoided direct GPIO control in favor of virtual pins… much more stable and reliable function.

Yes, as I understand it (having never used the older D1, an UNO shaped board) they are similarly named, but NOT the same boards or pinouts.

0 Likes

#10

If you have multiple devices in a project then you can have two buttons next to each other on the same screen controlling different devices, hence my question.

However, it seems that you’ve identified the problem as being the wrong device type.

Pete.

0 Likes

#11

Just writing here to confirm that the problem was that I had defined the device in the app as “Wemos D1” and I was using a “Wemos D1 mini”. After changing it, everything worked perfectly!

Thanks very much for the help!!!

2 Likes