Arduino IO Expansion
- vre
- Offline
- Platinum Member
-
Less
More
- Posts: 626
- Thank you received: 17
07 Jul 2025 07:12 - 07 Jul 2025 07:15 #331435
by vre
Replied by vre on topic Arduino IO Expansion
Can I use this project for 4 analog pot inputs rapid feed spindle and jog speed?
Arguino pro mini will work ?
How I will connect with PC with ttl2USB adapter or it is better to use leonardo that has USB interface?
What about esp32 will work with this?
Arguino pro mini will work ?
How I will connect with PC with ttl2USB adapter or it is better to use leonardo that has USB interface?
What about esp32 will work with this?
Last edit: 07 Jul 2025 07:15 by vre.
Please Log in or Create an account to join the conversation.
- AlexMagToast
-
Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 93
- Thank you received: 69
03 Aug 2025 14:05 #332723
by AlexMagToast
Replied by AlexMagToast on topic Arduino IO Expansion
Hi, yes that is possible. I would actually reccommend the esp32 over the Arduino, as if I remember correctly the ADC resolution is better on the ESP.
I only ever used it with USB interface.
If you know what you are doing I guess you can run it in ttl2USB too.
I only ever used it with USB interface.
If you know what you are doing I guess you can run it in ttl2USB too.
Please Log in or Create an account to join the conversation.
- gundamgear
- Offline
- New Member
-
Less
More
- Posts: 3
- Thank you received: 0
16 Aug 2025 13:51 - 16 Aug 2025 14:02 #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
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.
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: 16 Aug 2025 14:02 by gundamgear.
Please Log in or Create an account to join the conversation.
- tommylight
-
- Online
- Moderator
-
Less
More
- Posts: 20735
- Thank you received: 7056
16 Aug 2025 13:59 #333509
by tommylight
Replied by tommylight on topic Arduino IO Expansion
From your error report
./test.hal:95: Pin 'arduino.din.9' does not exist
Please Log in or Create an account to join the conversation.
- gundamgear
- Offline
- New Member
-
Less
More
- Posts: 3
- Thank you received: 0
16 Aug 2025 14:05 #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
it like hal file loadusr arduino-connector not properly load or something
Please Log in or Create an account to join the conversation.
- Unlogic
- Offline
- Elite Member
-
Less
More
- Posts: 223
- Thank you received: 113
07 Sep 2025 21:02 #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.
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.
Attachments:
Please Log in or Create an account to join the conversation.
- COFHAL
- Offline
- Platinum Member
-
Less
More
- Posts: 389
- Thank you received: 43
02 Oct 2025 00:29 #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.
Time to create page: 0.103 seconds