| Author |
Message |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 01/10/2010 20:17:34
|
JointTech
Initiate
Joined: 29/09/2010 22:22:17
Messages: 9
Offline
|
1. Buy or make a Arduino
2. Download the latest Arduino software I'm using 0020. http://arduino.cc/en/Main/Software
3. If you are using Arduino Duemilanove or a similar board that runs off USB you’ll have to install the USB drivers. You can find them in the Arduino folder you just downloaded.
4. plug in a TMP36 temp sensor as shown here: http://tinyurl.com/plbx38
Plug it into Analog port 3 instead of 0 as shown in the link.
5. Grab the modbus library from http://www.tucsni.nl/jee/ModbusSlave.zip
you should check his site http://www.tucsni.nl/jee/ he actually says to use the new version here: http://sites.google.com/site/jpmzometa/arduino-mbrt/arduino-modbus-slave
but I havent tested it.
6. Unzip modbusslave.zip to your_arduino_install\libraries\ModBusSlave
7. open the arduino IDE
8. Paste the following code:
9. upload the code to your Arduino.
10. Install Mango
11. Create a new data source.
12. Create a new datapoint
13. you should now be seeing the current temperature updating every 5 seconds on your datapoint.
You can breathe hard on your tmp36 to see the temp go up in mango.
have fun.
hope this helps somebody as it took me about 2 days of scouring the net to make it finally work.
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 01/10/2010 23:24:40
|
mlohbihler
Master
![[Avatar]](/forum/images/avatar/eccbc87e4b5ce2fe28308fd9f2a7baf3.png)
Joined: 01/03/2007 22:48:52
Messages: 1847
Offline
|
Nice. Thanks.
|
Best regards,
Matthew Lohbihler |
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 06/10/2010 03:55:04
|
jose francisco
Initiate
Joined: 01/10/2010 07:30:14
Messages: 39
Offline
|
Hello.
I'm trying to compile the sketch buy i get an error in "init_mb_slave(...)" not declared function.
I think that the library i've got is newer because in new examples the configuration is done in this way:
mbs.configure(SLAVE,BAUD,PARITY,TXENPIN);
Can you comment this issue?
thanks
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 06/10/2010 04:02:23
|
JointTech
Initiate
Joined: 29/09/2010 22:22:17
Messages: 9
Offline
|
I would use the library here: http://www.tucsni.nl/jee/ModbusSlave.zip
other than that I have no idea. probably question better for the arduino forums as well.
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 07/10/2010 07:16:30
|
jose francisco
Initiate
Joined: 01/10/2010 07:30:14
Messages: 39
Offline
|
Sketch for new library from http://sites.google.com/site/jpmzometa/arduino-mbrt/arduino-modbus-slave
With this code you can:
-See the status of pin 2 in mango (MB_REG0)
-set the status of pin 13 with mango (MB_CTRL)
use offset 0,1,... in mango to use MB_REG0, MB_CTRL, MB_TIME,...
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 07/10/2010 15:37:13
|
JointTech
Initiate
Joined: 29/09/2010 22:22:17
Messages: 9
Offline
|
Nice I was struggling with setting values. Ill have to give this a try.
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 06/07/2012 18:54:39
|
relristein
Initiate
Joined: 04/07/2012 12:50:18
Messages: 4
Offline
|
Hi,
I have a one question. I use the modbus serial for comunication. It is script:
#include <ModbusSlave.h>
/* First step MBS: create an instance */
ModbusSlave mbs;
/* slave registers */
enum {
MB_CTRL, /* Led control on, off or blink */
MB_TIME, /* blink time in milliseconds */
MB_CNT, /* count the number of blinks */
MB_REGS /* total number of registers on slave */
};
int regs[MB_REGS];
int ledPin = 13;
void setup()
{
/* the Modbus slave configuration parameters */
const unsigned char SLAVE = 1;
const long BAUD = 9600;
const char PARITY = 'n';
const char TXENPIN = 1;
/* Second step MBS: configure */
mbs.configure(SLAVE,BAUD,PARITY,TXENPIN);
pinMode(ledPin, OUTPUT);
}
void loop()
{
/* Third and las step MBS: update in loop*/
mbs.update(regs, MB_REGS);
if(regs[MB_CTRL]==1)
{
digitalWrite(ledPin,1);
}
else{
digitalWrite(ledPin,0);
}
}
********************
But i want a blink effect in led and i modified the script:
if(regs[MB_CTRL]==1)
{
digitalWrite(ledPin,1);
delay(3000);
digitalWrite(ledPin,0);
delay(3000);
}
else{
digitalWrite(ledPin,0);
}
}
Well, when i set the bit 1, the led blink but it don't enter in the else.
Anyone had the same problem with supervisory and script?
tank's
*sorry, my english is very weak.
|
|
|
 |
|
|