Arduino IO Expansion

More
1 year 2 months ago - 1 year 2 months ago #333508 by gundamgear
Replied by gundamgear on topic Arduino IO Expansion
Hello I try to use arduino connector when I set hal file to loadusr arduino-connector it not load and when I start linuxcnc it spit pin does not exist
Code:
Error report created by /usr/lib/tcltk/linuxcnc/show_errors.tcl: Print file information: RUN_IN_PLACE=no LINUXCNC_DIR= LINUXCNC_BIN_DIR=/usr/bin LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc LINUXCNC_SCRIPT_DIR= LINUXCNC_RTLIB_DIR=/usr/lib/linuxcnc/modules LINUXCNC_CONFIG_DIR= LINUXCNC_LANG_DIR=/usr/lib/tcltk/linuxcnc/msgs INIVAR=inivar HALCMD=halcmd LINUXCNC_EMCSH=/usr/bin/wish8.6 LINUXCNC - 2.9.4 Machine configuration directory is '/home/cnc/linuxcnc/configs/test' Machine configuration file is 'test.ini' INIFILE=/home/cnc/linuxcnc/configs/test/test.ini VERSION=1.1 PARAMETER_FILE=linuxcnc.var TPMOD= HOMEMOD= TASK=milltask HALUI= DISPLAY=axis COORDINATES=X Y Z KINEMATICS=trivkins coordinates=XYZ Starting LinuxCNC... Starting LinuxCNC server program: linuxcncsvr Loading Real Time OS, RTAPI, and HAL_LIB modules Starting LinuxCNC IO program: io linuxcnc TPMOD=tpmod HOMEMOD=homemod EMCMOT=motmod Found file(REL): ./test.hal Shutting down and cleaning up LinuxCNC... Removing HAL_LIB, RTAPI, and Real Time OS modules Removing NML shared memory segments Debug file information: Note: Using POSIX realtime ./test.hal:95: Pin 'arduino.din.9' does not exist 7233 Stopping realtime threads Unloading hal components Note: Using POSIX realtime ----------------------------------------------------------------------- Info report created by linuxcnc_info: The file:    /tmp/linuxcnc_info.txt can be posted to a forum or a web site like:      http://pastebin.com in order to provide information about the linuxcnc system and configuration.                 Date: Sat Aug 16 20:30:11 +07 2025             UTC Date: Sat Aug 16 13:30:11 UTC 2025         this program: /usr/bin/linuxcnc_info               uptime: 20:30:11 up 1:44, 1 user, load average: 0.24, 0.30, 0.33      lsb_release -sa: Debian Debian GNU/Linux 12 (bookworm) 12 bookworm             linuxcnc: /usr/bin/linuxcnc                  pwd: /home/cnc/linuxcnc/configs/test                 USER: cnc              LOGNAME: cnc                 HOME: /home/cnc               EDITOR:               VISUAL:             LANGUAGE:                 TERM: dumb            COLORTERM:              DISPLAY: :0.0              DESKTOP: lightdm-xsession         display size: 1920x1080 pixels (508x286 millimeters)                 PATH: /usr/bin:/home/cnc/linuxcnc/configs/test/bin:/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games uname items:          nodename -n: raspberrypi       kernel-name -s: Linux       kernel-vers -v: #1 SMP PREEMPT_RT Mon Jan 27 00:10:15 AEDT 2025           machine -m: aarch64         processor -p: unknown          platform -i: unknown       oper system -o: GNU/Linux /proc items:              cmdline: reboot=w coherent_pool=1M 8250.nr_uarts=1 pci=pcie_bus_safe cgroup_disable=memory numa_policy=interleave smsc95xx.macaddr=2C:CF:67:BC:6D:E4 vc_mem.mem_base=0x3fc00000 vc_mem.mem_size=0x40000000 console=ttyAMA10,115200 console=tty1 root=PARTUUID=a27d77aa-02 rootfstype=ext4 fsck.repair=yes loglevel=5 net.ifnames=0 processor.max_cstate=1 isolcpus=2,3 firmware_class.path=/lib/firmware/updates/brcm rootwait           model name:                cores:              cpu MHz:              parport:               serial: Versions:                  gcc: gcc (Debian 12.2.0-14) 12.2.0               python: Python 3.11.2                  git: git version 2.39.5           git commit: NA                  tcl: 8.6                   tk: 8.6                glade: not_in_PATH linuxcnc_var all:      LINUXCNCVERSION: 2.9.4 LINUXCNC_AUX_GLADEVCP: /usr/share/linuxcnc/aux_gladevcp LINUXCNC_AUX_EXAMPLES: /usr/share/linuxcnc/aux_examples             REALTIME: /usr/lib/linuxcnc/realtime                  RTS: uspace           HALLIB_DIR: /usr/share/linuxcnc/hallib               PYTHON: /usr/bin/python3 dpkg -l '*linuxcnc*': Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name                Version           Architecture Description +++-===================-=================-============-===================================================================== un  linuxcnc            <none>            <none>       (no description available) un  linuxcnc-dev        <none>            <none>       (no description available) un  linuxcnc-doc        <none>            <none>       (no description available) ii  linuxcnc-doc-en     1:2.9.4           all          motion controller for CNC machines and robots (English documentation) un  linuxcnc-doc-es     <none>            <none>       (no description available) un  linuxcnc-doc-fr     <none>            <none>       (no description available) ii  linuxcnc-ethercat   1.40.0.g8a607c0-0 arm64        LinuxCNC EtherCAT HAL driver un  linuxcnc-sim        <none>            <none>       (no description available) un  linuxcnc-sim-dev    <none>            <none>       (no description available) ii  linuxcnc-uspace     1:2.9.4           arm64        motion controller for CNC machines and robots ii  linuxcnc-uspace-dev 1:2.9.4           arm64        PC based motion controller for real-time Linux


only when I use terminal to run halrun and loadusr arduino-connector then I can start linuxcnc normally but when I quit program halrun is reset and I has to load it again in order to run linuxcnc.
What I try so far
loadusr arduino-connector at begin of hal file
loadusr arduino-connector at end of hal file
[HAL]TWOPASS = on in .ini
loadusr  python3 /usr/bin/ardino-connector
loadusr -Wn arduino-connector
non of it work only run halrun in terminal work.
Last edit: 1 year 2 months ago by gundamgear.

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #333509 by tommylight
Replied by tommylight on topic Arduino IO Expansion
From your error report
Code:
./test.hal:95: Pin 'arduino.din.9' does not exist

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #333510 by gundamgear
Replied by gundamgear on topic Arduino IO Expansion
yes that will only go away when i run terminal halrun and loadusr arduino-connector
it like hal file loadusr arduino-connector not properly load or something

Please Log in or Create an account to join the conversation.

More
1 year 1 month ago #334596 by Unlogic
Replied by Unlogic on topic Arduino IO Expansion
I gave this little project a try as can be seen in the forum post linked below:

forum.linuxcnc.org/12-milling/50559-opti...sion?start=90#334591

I'm using two rotary encoders on a Arduino Micro clone and everything worked on the first attempt. However I found a bug in the python code for the encoder handling  when using them mode 1 (send up or down signal).

The implementation of that functionality relies on this code which is a bit flawed.

 

It triggers the HAL pin waits for a very short period and the untriggers the HAL pin again. This would only sporadically work when I tested in on the PC I'm using for LinuxCNC.

Instead of doing the wait approach I think it would be simpler and more fool proof to have the Arduino code send two events when using mode 1. One event to trigger and another event to cancel the trigger a short while later (just like it does for the normal push buttons) so no waiting is required in the Python code.
The following user(s) said Thank You: AlexMagToast

Please Log in or Create an account to join the conversation.

More
1 year 1 month ago #335681 by COFHAL
Replied by COFHAL on topic Arduino IO Expansion problem
When I configure a key as in hal Pin with 0, they are effectively created as hal pins, but when checking by running linuxcnc when pressing the keys related to those hal pins they do not change state, which would indicate to me that they are not connected. When testing from Arduino through the serial monitor, pressing any key shows that it is activated.

Please Log in or Create an account to join the conversation.

More
10 months 3 weeks ago #339822 by Surmetall
Replied by Surmetall on topic Arduino IO Expansion
Hi AlexMagToast,I’ve been following your Arduino IO-Expansion project for a while now and I just wanted to say thank you, really great work! Thanks for sharing!I’m currently planning a control panel for my lathe and your project looks like it could be a good fit even though my setup is a bit different from yours. I won’t need the matrix keyboard because I’m planning to use a StreamDeck for most of the button functions (there’s a tool for LinuxCNC support here: forum.linuxcnc.org/show-your-stuff/52628...for-linuxcnc?start=0 ). 
 For the panel itself I would still need some hardware I/Os:
-> 8–10 digital inputs/outputs (joystick, rapid, spindle, LEDs, etc.)
-> 3 analog inputs for potentiometers (feed override, spindle override, handfeed)
-> 2 encoder inputs for handwheelsI wanted to use the Heidenhain ROD450 with 500 lines on the handwheels the lathe came with through Beckhoff EtherCAT hardware, but the 11µA sinus signals are a bit of a nightmare to read out. So I’m now considering a simpler approach with two inexpensive TTL encoders from China, which your Arduino setup should handle much more easily.My questions:
How stable has your Arduino solution been for you so far? Are you still happy with it? Especially on the same USB cable with the StreamDeck.
Which board would you recommend for what I’m trying to do? Uno, Mega, ESP32 or something else? Does someone recommend a different hardware setup?Thanks again for sharing your project. It’s cool to see alternatives to the usual hardware solutions, and I’d appreciate any advice before I start buying components. Greetings Tom
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

Time to create page: 0.143 seconds
Powered by Kunena Forum