ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexIBM MQ Telemetry / Low Latency Messaging / EveryplaceIssue with more than one Arduino in MQTT network

Post new topicReply to topic
Issue with more than one Arduino in MQTT network View previous topic :: View next topic
Author Message
kolomir0
PostPosted: Tue Sep 04, 2018 11:33 am Post subject: Issue with more than one Arduino in MQTT network Reply with quote

Newbie

Joined: 04 Sep 2018
Posts: 1

Hello
I am working on a project in which the main idea is to connect a lot of arduino in the network. I thought that MQTT would be perfect.
The central unit is the computer on which the Mosquito server is running. In addition, is runing a program to serve everyone Arduino working in the network.
Of course, this is a very early phase of the project. During the first tests I connected with only one Arduino and everything worked satisfactorily. Arduino have to receive commands from a computer and send reports.

I used Arduino WeMos D1 mini (ESP8266) and I think the most popular library "PubSubClient" to write a program for Arduino.

The problem is when I connect two (or more) arduino .... In the network, of course, they received their own IP. They should subscribe to the same Topic ... because they work together. Unfortunately, they have a problem with the connection ...

Below part of the sample program from library:
Code:
void reconnect() {
  // Loop until we're reconnected
  while (!client.connected()) {
    Serial.print("Attempting MQTT connection...");
    // Attempt to connect
    if (client.connect("ESP8266Client")) {
      Serial.println("connected");
      // Once connected, publish an announcement...
      client.publish("xxx", "hello world");
      // ... and resubscribe
      client.subscribe("xxx");
    } else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      // Wait 5 seconds before retrying
      delay(5000);
    }
  }
}


In Serial port monitor I have only "Attempting MQTT connection..." from both Arduino.
When I switches off one of them, the other starts to work correctly.

Maybe someone knows what I'm doing wrong ...?
Thank you for every help.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Sep 05, 2018 11:46 pm Post subject: Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19744
Location: LI,NY

you might want to look at your code. Sounds like both Arduinos are competing for the same socket...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ Telemetry / Low Latency Messaging / EveryplaceIssue with more than one Arduino in MQTT network
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.