Forum >Replies by GrehnanSondra
userhead GrehnanSondra
Replies (1)
  • You Reply:

    I have a problem with my new project. The goal is to control my piezo motor with an Arduino MKR Wifi 1010 via RS485. For that reason I have these components:

    Arduino MKR Wifi 1010 Arduino MKR 485 Shield Piezo Motordriver PM401 (Manual: https://piezomotor.com/wp-content/uploads/2019/03/150025_PMD401_Technical_Manual.pdf / https://e-chats.com/omegle / https://echat.date) Piezo LEGS motor

    I tested the RS485 by using a USB adapter and the piezomotor software. That worked. But if it comes to code, I don't get any further.

    The commands I want to send the piezodriver in ASCII Code is:X127M2;X127J200,0,100;(They worked in the PiezoMotor DriveLab Software)

    And I try to do it with this code:

    #include <ArduinoRS485.h>

    int counter = 0;

    void setup() { RS485.begin(115200); Serial.begin(115200); RS485.receive();}

    void loop() { RS485.beginTransmission(); if (RS485.available()){   Serial.println(RS485.read()); } else {   Serial.write("Not available"); } Serial.println(RS485.available()); RS485.write('X127M2;'); RS485.write('X127J200,0,100;'); Serial.print("Count No: "); Serial.println(counter); RS485.endTransmission(); counter ++; delay(2000);}In the terminal I got something like that:

    888Count No: 15015Count No: 26722Count No: 3How do I know, that the MKR 485 Shield is sending the commands to the Piezodriver and not to nowhere? And the numbers of the terminal seems to me random. They also appear even if nothing is connected to the MKR 485 Shield.So how can I find or set the address of the PM401 in the code?Or do I have to send the commands completly different?They have to be in ASCII send at 115200n81. Does the line RS485.write('X127M2;'); provide that?

    I'm a bit lost, also cause I don't have a lot experince in that field, and try&error does not work here. Hope there