Arduino serial7Segment DRO XYZ

More
10 years 1 month ago #80493 by Tchefter
Hallo, ich schon wieder :)
im Moment beschäftige ich mich mehr mit Gimmicks für die Fräse als das ich damit arbeite. Naja, muss auch mal sein.
Nachdem das DRO mit PyVCP auf der rechten Seite in Axis sehr gut funktioniert habe ich mir überlegt, das DRO auf drei serial7Segment anzeigen zulassen.
Ich habe noch drei aus einem Projekt. Nach vielem googeln stoß ich immer auf den Pendant von ArcEye und ckcnc. Das überfordert mich etwas da ich eigentlich kein Handrad möchte sondern lediglich das XYZ auf den Anzeigen gezeigt wird.
Wie ich schon lesen konnte funktioniert das wohl auch, aber ich finde keine wirkliche Anleitung dazu. Muss auf dem Arduino eine andere Firmware drauf sein als die übliche damit das funktioniert? Was muss gemacht werden das LinuxCNC die Daten an den Arduino übergibt?
Wie gesagt der Arduino mit den Segmenten sollen nur als Anzeige dienen.
Grüße Fritz
*******************************************************************************************************************************************************************
Hi, I again :)
at the moment I am working more with gimmicks for the router as I work with it. Well, must be sometimes.
After the DRO I have worked with PyVCP very well on the right side in Axis been thinking that allow DRO show on three serial7Segment.
I have three of a project. After much googling I always push to the Pendant of ArcEye and ckcnc. The overwhelmed me a bit because I really do not want a hand wheel but only the XYZ is shown on the display.
As I could read already works well too, but I find no real instructions,. Must on the Arduino another firmware on it to be the most common for this to work? What must be done the LinuxCNC transfers the data to the Arduino?
As I said the Arduino with the segments are provided as a display only. No Buttons, no Controlling...
Greetings Fritz

The s7s Segments:
www.watterott.com/en/7-Segment-Serial-Display-red
The Project they come from :)
youtube.com/watch?v=bj7tc090A9A

Please Log in to join the conversation.

More
More
10 years 1 month ago #80592 by Tchefter
Hi @all,
Yesterday i tested the Pendant from ArcEye, great test.
A new question comes in this Test:
Is ist possible to get 2 or 3 outputs for this command:

net Xposition halui.axis.0.pos-relative serialcon.xposition
net Xposition halui.axis.0.pos-relative xxxx.xposition

i.e.: I want to do a Display with only the DRO over 7Segments
i.e: I want to build the Pendant
and last i like to have the DRO in AXIS on the right side.

My thoughts where to put the position in varaibles and give these out.
If these thoughts correct, how can i do these...?

Greetings Fritz

Please Log in to join the conversation.

More
10 years 1 month ago #80597 by ArcEye
No eBay APP ID and/or Cert ID defined in Kunena configuration

Is ist possible to get 2 or 3 outputs for this command:

net Xposition halui.axis.0.pos-relative serialcon.xposition
net Xposition halui.axis.0.pos-relative xxxx.xposition


You need to look at the docs for HAL and halui
www.linuxcnc.org/docs/devel/html/hal/basic-hal.html#_net
www.linuxcnc.org/docs/devel/html/gui/halui.html

halui.axis.0.pos-relative is an OUT pin, so you can connect it to a signal and then connect as many IN pins as you like to the same signal to share the data.

The hal file syntax should be
Code:
net Xposition halui.axis.0.pos-relative serialcon.xposition net Xposition xxxx.xposition

ie. you only connect the OUT pin ONCE to the signal, then connect the signal as many times as you want to other IN pins

The s7s Segments:
www.watterott.com/en/7-Segment-Serial-Display-red


As far as the 4 digit 7 segment displays go, they are very expensive and limited compared to a LCD display.
You would require 3 of them for a 3 axis display (42 euros) and if used in a metric setup, 4 digits allows very limited resolution.

Compare that to a 4 x 16 LCD display for 5 euros approx


That is 4 axes of up to 16 digit resolution if just used as a DRO - no contest in my mind

Please Log in to join the conversation.

More
10 years 1 month ago #80599 by ArcEye

I have three of a project. After much googling I always push to the Pendant of ArcEye and ckcnc. The overwhelmed me a bit because I really do not want a hand wheel but only the XYZ is shown on the display.
As I could read already works well too, but I find no real instructions,. Must on the Arduino another firmware on it to be the most common for this to work? What must be done the LinuxCNC transfers the data to the Arduino?
As I said the Arduino with the segments are provided as a display only. No Buttons, no Controlling...


All you need to do to just display positions in a DRO is edit the existing component and arduino code.

If you remove the calls to check commands in both pieces of code, you just end up with a component that outputs a position string packet and an arduino sketch that writes it to a LCD screen ie. a simple DRO display

Ergo, a component named serialdro.comp
Code:
component serialdro "This component services the arduino DRO display"; pin in float xposition "Receives current position from Xpos"; pin in float yposition "Receives current position from Ypos"; pin in float zposition "Receives current position from Zpos"; option singleton yes; // makes no sense to have more than one of these components running option userspace yes; author "ArcEye arceye@mgware.co.uk"; license "GPL"; ;; #include <stdio.h> /* Standard input/output definitions */ #include <stdlib.h> #include <stdint.h> /* Standard types */ #include <string.h> /* String function definitions */ #include <unistd.h> /* UNIX standard function definitions */ #include <fcntl.h> /* File control definitions */ #include <errno.h> /* Error number definitions */ #include <termios.h> /* POSIX terminal control definitions */ #include <sys/ioctl.h> #define BAUDRATE B115200 #define DEVICE "/dev/ttyACM0" #define _POSIX_SOURCE 1 /* POSIX compliant source */ // predefs of later functions int serialport_init(); struct termios toptions;; // port setup void user_mainloop(void) { char buffer[50]; char ch; int fd = serialport_init(); while(fd != -1) { // approx 1/4 sec appears to be optimum period for a steady display with min lag // may differ on another system with different thread speeds usleep(250000); FOR_ALL_INSTS() { // %08.03f = 8 digit including decimal point and sign, leading zeros & 3 digit precision with trailing zeros bzero(buffer, 50); sprintf(buffer, "X%08.03fY%08.03fZ%08.03f", xposition, yposition, zposition ); write(fd, buffer, sizeof(buffer)); } } close(fd); exit(0); } //###################################################################### int serialport_init() { int fd; fd = open(DEVICE, O_RDWR | O_NOCTTY | O_NDELAY); if (fd == -1) { perror("init_serialport: Unable to open port "); return -1; } if (tcgetattr(fd, &toptions) < 0) { perror("init_serialport: Couldn't get term attributes"); return -1; } speed_t brate = BAUDRATE; cfsetispeed(&toptions, brate); cfsetospeed(&toptions, brate); // 8N1 toptions.c_cflag &= ~PARENB; toptions.c_cflag &= ~CSTOPB; toptions.c_cflag &= ~CSIZE; toptions.c_cflag |= CS8; // no flow control toptions.c_cflag &= ~CRTSCTS; toptions.c_cflag |= CREAD | CLOCAL; // turn on READ & ignore ctrl lines toptions.c_iflag &= ~(IXON | IXOFF | IXANY); // turn off s/w flow ctrl toptions.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); // make raw toptions.c_oflag &= ~OPOST; // make raw // see: http://unixwiz.net/techtips/termios-vmin-vtime.html toptions.c_cc[VMIN] = 0; toptions.c_cc[VTIME] = 20; if( tcsetattr(fd, TCSANOW, &toptions) < 0) { perror("init_serialport: Couldn't set term attributes"); return -1; } return fd; }

and a corresponding arduinodro.ino script
Code:
#include <SoftwareSerial.h> #include "Wire.h" #include "LiquidCrystal.h" /* The circuit: using i2c backpack * 5V to Arduino 5V pin * GND to Arduino GND pin * CLK to Analog #5 * DAT to Analog #4 */ // Connect via i2c, default address #0 (A0-A2 not jumpered) LiquidCrystal lcd(0); char XReading[9]; // 0000.000\0 pos char YReading[9]; char ZReading[9]; void zeroX() { for(int x = 0; x < 9; x++) XReading[x] = 0;} void zeroY() { for(int x = 0; x < 9; x++) YReading[x] = 0;} void zeroZ() { for(int x = 0; x < 9; x++) ZReading[x] = 0;} void setup() { // start serial port at 9600 bps: Serial.begin(115200); // set up the LCD's number of rows and columns: lcd.begin(20, 4); // Print a message to the LCD.bool bMachine = false; lcd.setBacklight(HIGH); lcd.noAutoscroll(); // set the initial field identifiers lcd.setCursor(0, 0); lcd.print("X*"); lcd.setCursor(0, 1); lcd.print("Y "); lcd.setCursor(0, 2); lcd.print("Z "); zeroX(); zeroY(); zeroZ(); } void loop() { int x; char ch; if(Serial.available() >= 9) { ch = Serial.read(); switch(ch) { case 'X': while(Serial.available() < 8) delay(10); for(x = 0; x < 8; x++) XReading[x] = Serial.read(); lcd.setCursor(0, 0); lcd.print("X"); lcd.setCursor(2, 0); lcd.print(XReading); zeroX(); break; case 'Y': while(Serial.available() < 8) delay(10); for(x = 0; x < 8; x++) YReading[x] = Serial.read(); lcd.setCursor(0, 1); lcd.print("Y"); lcd.setCursor(2, 1); lcd.print(YReading); zeroY(); break; case 'Z': while(Serial.available() < 8) delay(10); for(x = 0; x < 8; x++) ZReading[x] = Serial.read(); lcd.setCursor(0, 2); lcd.print("Z"); lcd.setCursor(2, 2); lcd.print(ZReading); zeroZ(); break; default: break; } } }

I haven't tested them but they compile OK

Please Log in to join the conversation.

More
10 years 1 month ago #80620 by Tchefter
Hi ArcEye, thank you very much for your Reply.
I've learned a lot on Sunday, mainly to see what is where loaded. :)
I've changed my mind since the first post above the 4 digit to 8 digit. my cutter can in X max 620mm, therefore the 8 characters incl. sign should be enough, I think. Now I have to wait about 4 weeks until the Digis there are. I think at this time I build but the counterpart to :)
Thank you very much for your support.
I have to read a lot

Please Log in to join the conversation.

More
10 years 1 month ago #80884 by Tchefter

ArcEye wrote: You need to look at the docs for HAL and halui
www.linuxcnc.org/docs/devel/html/hal/basic-hal.html#_net
www.linuxcnc.org/docs/devel/html/gui/halui.html

halui.axis.0.pos-relative is an OUT pin, so you can connect it to a signal and then connect as many IN pins as you like to the same signal to share the data.
The hal file syntax should be

Code:
net Xposition halui.axis.0.pos-relative serialcon.xposition net Xposition xxxx.xposition
ie. you only connect the OUT pin ONCE to the signal, then connect the signal as many times as you want to other IN pins

Works now very well on/in the Pendant AND in AXIS PyVCP! thank you!!! B)
(Wished i got more time to test the things, but step by step... :) )

Please Log in to join the conversation.

More
10 years 1 month ago #80889 by ArcEye
Glad you are getting there.
It is a steep learning curve at first, but all appears simple once you reach the uplands B)

Please Log in to join the conversation.

More
10 years 1 month ago #80898 by Tchefter

ArcEye wrote: Glad you are getting there.
It is a steep learning curve at first, but all appears simple once you reach the uplands B)


Well i think the real uplands are some altitude away, but every result success, steps up :)

Please Log in to join the conversation.

Time to create page: 0.704 seconds
Powered by Kunena Forum