Libelium is offering new technical support channels, to contact with de Technical Support team to solve any issue our doubt please contact with your sales agent or visit our contact site



Post a new topicPost a reply Page 1 of 1   [ 8 posts ]
Author Message
 Post subject: RS485 module and Arduino UNO
PostPosted: Wed May 24, 2017 2:37 pm 

Joined: Wed May 24, 2017 2:21 pm
Posts: 4
I am very new in this RS485 communication over Arduino. I have bought RS485 Shield and module and i am connecting sensor TMP36 as simple example shown in website https://www.cooking-hacks.com/documenta ... leo/#step4

I copied the program and tried to run but it's showing that

Arduino: 1.8.2 (Windows 10), Board: "Arduino/Genuino Uno"
TMP36_rs485:6: error: 'RS485' does not name a type
RS485 myDevice = RS485();
^
C:\Users\Devang\Desktop\fffsss\digital sensor\TMP36_rs485\TMP36_rs485.ino: In function 'void setup()':
TMP36_rs485:14: error: 'myDevice' was not declared in this scope
if ( myDevice.begin() == 0) {
^
TMP36_rs485:22: error: 'myDevice' was not declared in this scope
myDevice.baudRateConfig(9600);
^
TMP36_rs485:23: error: 'DISABLE' was not declared in this scope
myDevice.parityBit(DISABLE);
^
C:\Users\Devang\Desktop\fffsss\digital sensor\TMP36_rs485\TMP36_rs485.ino: In function 'void loop()':
TMP36_rs485:31: error: 'myDevice' was not declared in this scope
myDevice.send("Data from analog1 input : ");
^
exit status 1
'RS485' does not name a type


I need to submit this before end of this week. I really need your help.Request for help :cry:


Top
 Profile  
 
 Post subject: Re: RS485 module and Arduino UNO
PostPosted: Thu May 25, 2017 7:46 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hello Dave1,
it seems a bad library intallation, follow these steps:

1.- download the library from:
https://www.cooking-hacks.com/media/coo ... y-v0_4.zip

2.- uncompress the arduinoRS485-Modbus-library-v0_4.zip file.

3.- then uncompress the libraries in your "arduino_sketchbook/libraries" directory
arduinoRS485-Modbus-library-v0_3.zip -> arduino_sketchbook/libraries
arduino-api-v1_5.zip -> arduino_sketchbook/libraries

You can find your arduino_sketchbook path in the arudino IDE File->Preferences contextual menu.

Regards


Top
 Profile  
 
 Post subject: Re: RS485 module and Arduino UNO
PostPosted: Mon May 29, 2017 12:30 am 

Joined: Wed May 24, 2017 2:21 pm
Posts: 4
Thank you for your reply. I tried a lot in my windows but unfortunately i could not make it but i tried with linux and it's work but when i am trying to connect the TMP36 sensor the serial monitor showing
"RS485 did not initialized correctly
This is RS485 communication receive data example."

I have attached my hardware and screenshot of serial monitor.

http://i67.tinypic.com/2ptberb.jpg
http://i63.tinypic.com/21lvry9.jpg

Kindly send me some solution because as i said i am running out of time and it is very important for me.

Thank you ! :cry: :cry: :cry: :cry: :cry:


Top
 Profile  
 
 Post subject: Re: RS485 module and Arduino UNO
PostPosted: Mon May 29, 2017 8:34 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hello Dave1,

We can not see your serial monitor picture.

One question, the examples provided with the RS485 library works well for you?

The library must work with windows as well in linux; it do not depends of your OS, it only depends of your Arduino IDE configuration.

Please give us a more detailed information about your issue: Arduino IDE version, source code and terminal output. We will try in our lab.

Regards.


Top
 Profile  
 
 Post subject: Re: RS485 module and Arduino UNO
PostPosted: Mon May 29, 2017 10:32 am 

Joined: Wed May 24, 2017 2:21 pm
Posts: 4
Thank you sir for your reply.

In linux i am using Arduino 2:1.0.5. i have attached TMP36 in to analog pin 01, and connceted RS485 module as i sent you in previous reply.

I am very happy that Cooking hacks forum replying instantly.

My main goal is connecting DHT22 sensor but right now i am just trying with TMP36 sensor.
Here is my code for TMP36 i have not changed much. because it is given in website and simple example.

Image

Code:
#include <Wire.h>

// Cooking API libraries
#include <arduinoUtils.h>

// Include always this library when you are using the RS-485 functions 
#include <arduinoRS485.h>
// Include the SPI library
#include <SPI.h>
// Create an instance
RS485 myDevice = RS485();

void setup() {
 
  // Using the SOCKET0
  Utils.setONSocket0();
  Utils.setMUXSocket0();

  // Initializes the serial for viewing data in the serial monitor
  Serial.begin(115200);
  delay(100);

  // Initializes the module and assigns the SPI
  if ( myDevice.begin() == 0) {
     Serial.println("RS-485 module started successfully");
  } else {
     Serial.println("RS-485 did not initialize correctly");
  }
  delay(100);

  // Configure the baud rate of the module
  myDevice.baudRateConfig(115200);
  // Configure the parity bit as disabled
  myDevice.parityBit(DISABLE);
  // Use one stop bit configuration
  myDevice.stopBitConfig(1); 
  // Print hello message
  Serial.println("This is RS-485 communication receive data example.");
}


void loop() {     
 
  // If data in response buffer
  if (myDevice.available())
  {
    while (myDevice.available()) {
      // Read one byte from the buffer
      char data = myDevice.read();
      // Print data received in the serial monitor
      Serial.print(data);     
    }
  }     
  delay(10);
}


Top
 Profile  
 
 Post subject: Re: RS485 module and Arduino UNO
PostPosted: Tue May 30, 2017 7:46 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hello Dave1,

Please post your terminal output.

We have tested your code and works fine.

Ensure that your system is correctly configured. Install the last Arduino IDE (we have used Arduino IDE v1.8.1) and follow the steps indicated previously to install the library.

Test that the examples provided with the library works in your hardware.

Regards


Top
 Profile  
 
 Post subject: Re: RS485 module and Arduino UNO
PostPosted: Wed May 31, 2017 9:46 am 

Joined: Wed May 24, 2017 2:21 pm
Posts: 4
Thank you for your quick reply. There is some problem in my RS485 Module i changed it and it's works now.

How can i send this data from serial monitor to server via MQTT message ? could you give me some idea ?

Thanks in advance.


Top
 Profile  
 
 Post subject: Re: RS485 module and Arduino UNO
PostPosted: Thu Jun 01, 2017 7:21 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
You are welcome,
sorry but we do not handle MQTT message, maybe any community user could help you.
Regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 8 posts ]


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

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use.