Hello,
I am attempting to use an Arduino Mega 2560 to communicate with a Mitutoyo Absolute Linear Scale AT715. Eventually I'd like to use a small LED display as a Digital Read Out, but I am currently having difficulty receiving anything from the scale.
https://www.mscdirect.com/product/details/05279138
I have found some information regarding the Pin Out of the DA 15 connector that it uses:
Pin-out
1 and 2: Signal ground or negative
3 and 4: +5vdc
10: Data
11: "not" Data (should have a line over the characters)
15: frame ground
http://bbs.homeshopmachinist.net/threads/20429-Mitutoyo-Linear-Scale-AT715-signal-format
I believe that it transfers data through one wire and needs an RS-485 receiver.
For transferring, I'm using a Max485 Chip RS-485 Module TTL to RS-485 Module (shown in diagram) with link to component below.
I attached some photos of what I currently have wired up and some more specs of the linear scale I found online.
I have 5v from the Arduino running to Pin 3 and 4 of the DA-15 connector as well as the RS-485 VCC
The ground is connected to Pin 1 and 2 of the DA-15 connector as well as the RS-485 ground
Pins 10 and 11 of the DA-15 connector are running to pins B and A of the RS-485 module.
DI on the RS-485 module goes to digital pin 26, DE goes to digital pin 24, RO goes to digital pin 25, and RE and DE are connected together.
Here is my current code:
#include "Arduino.h"
// Library to allow a Serial port on arbitrary pins
#include <SoftwareSerial.h>
// These are the pins we'll be talking to the RS485 device on
#define RS485rx 25 // RS485 Receive pin
#define RS485Tx 26 // RS485 Transmit pin
#define RS485inout 24 // RS485 Transmit or Receive status
#define RS485Transmit HIGH
#define RS485Receive LOW
#define ledPin 13
#define baudRate 19200
// Define the RS485 object
SoftwareSerial RS485(RS485rx, RS485Tx);
// The data bytes we're sending or receiving
byte rxValue;
byte txValue;
void setup()
{
// Debugging window
Serial.begin(baudRate);
// Set modes for pins
pinMode(ledPin, OUTPUT);
pinMode(RS485inout, OUTPUT);
// Ensure the on-board LED is off
digitalWrite(ledPin, HIGH);
// Set RS485 device to read initially
digitalWrite(RS485inout, RS485Receive);
RS485.begin(19200);
}
void loop()
{
txValue = 0;
Serial.print("Sending:");
Serial.println(txValue);
// Set the RS485 to transmit mode and send the value
digitalWrite(RS485inout, RS485Transmit);
RS485.write(txValue);
// small delay to allow transmission to complete
delay(10);
// Switch RS485 to receive mode
digitalWrite(RS485inout, RS485Receive);
// After each character is sent look for a received answer
if (RS485.available())
{
// LED flicker
digitalWrite(ledPin, HIGH);
// Read the incoming byte
rxValue = RS485.read();
// Display it on the Serial Monitor as a char (not an integer value)
Serial.print("Got back:");
Serial.println(rxValue);
// Turn off LED
digitalWrite(ledPin, LOW); // Show activity
}
// Debugging delay so we can follow activity
delay(500);
}
The spec sheet that I have read says that I need to send it a hexadecimal value 0x00, in order for it to send its absolute position back.
According the Scale Interface pamphlet (linked below) I should be communicating with hexadecimals. With this code, the Arduino is transmitting the hexadecimal 0x00 (the code for absolute position) and displaying a 0 as being sent (per the code), however it is not receiving anything back. If I comment out the If statement it will display 255 as being received when printed.
I believe I should be receiving a data package within 15 milliseconds consisting of 6 bytes, one byte echoing the command code (in this case 0x00), followed by 4 bytes that make up the absolute position data, followed by a crc byte.
Hitherto I have not been able to receive anything from the scale.