Coder Social home page Coder Social logo

romanru1 / hal2udp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jzolee/hal2udp

0.0 0.0 0.0 115 KB

External step generator and IO interface for LinuxCNC over Ethernet with dual-core ESP32 and W5500 modules.

License: GNU General Public License v2.0

C++ 97.15% C 2.85%

hal2udp's Introduction

HAL2UDP

External step generator and IO interface for LinuxCNC over Ethernet with dual-core ESP32 and W5500 modules.

The hardware is connected to LinuxCNC over Ethernet. The controller operates in position mode at low speed and at higher speeds in velocity mode.

video on operation

Features

  • step and dir signals for 3 axes
  • 8 input pins
  • 6 output pins, any can be pwm signal
  • step frequency up to 40 kHz

Install

Clone this repository and open it with platformIO

Settings

set your eth0 to 192.168.96.55
(the Esp32 with Ethernet will have 192.168.96.54)

LinuxCNC driver

sudo apt-get install linuxcnc-uspace-dev build-essential
sudo halcompile --install udp.comp

Hardware

ESP-WROOM-32 dev board + W5500 ethernet module

ESP32 3v3 -- 3v3 W5500
ESP32 GND -- GND W5500

GPIO 1 -> OUT-03 or PWM-03
GPIO 2 -> OUT-00 or PWM-00 & onboard blue LED
GPIO 4 -> OUT-01 or PWM-01
GPIO 5 -> W5500 SCS
GPIO 12 -> step-0
GPIO 13 -> dir-0
GPIO 14 -> OUT-04 or PWM-04
GPIO 15 -> OUT-05 or PWM-05
GPIO 16 -> step-1
GPIO 17 -> dir-1
GPIO 18 -> W5500 SCLK
GPIO 19 <- W5500 MISO
GPIO 21 -> step-2
GPIO 22 -> dir-2
GPIO 23 -> W5500 MOSI
GPIO 25 -> OUT-02 or PWM-02
GPIO 26 <- IN-00 {pullup}
GPIO 27 <- IN-01 {pullup}
GPIO 32 <- IN-02 {pullup}
GPIO 33 <- IN-03 {pullup}
GPIO 34 <- IN-04 {no pullup!}
GPIO 35 <- IN-05 {no pullup!}
GPIO 36 <- IN-06 {no pullup!}
GPIO 39 <- IN-07 {no pullup!}

LinuxCNC HAL pins

udp.0.position_cmd (in - float) commanded position in position units
udp.1.position_cmd
udp.2.position_cmd

udp.0.velocity_cmd (in - float) commanded velocity in position units/s
udp.1.velocity_cmd
udp.2.velocity_cmd

udp.0.position_fb (out - float) feedback position in position units
udp.1.position_fb
udp.2.position_fb

udp.0.velocity_fb (out - float) feedback velocity in position units/s
udp.1.velocity_fb
udp.2.velocity_fb

udp.out.00 (in - bit) digital output
udp.out.01
udp.out.02
udp.out.03
udp.out.04
udp.out.05

udp.pwm.00 (in - float) PWM output 0...1
udp.pwm.01
udp.pwm.02
udp.pwm.03
udp.pwm.04
udp.pwm.05

udp.in.00 (out - bit) digital input
udp.in.01
udp.in.02
udp.in.03
udp.in.04
udp.in.05
udp.in.06
udp.in.07

udp.ready (out - bit) module state
udp.enable (in - bit) module enable
udp.packets (out - s32) lost packets

LinuxCNC HAL parameters

udp.0.dirsetup (rw - u32) minimum time from a direction change to the beginning of the next step pulse in ns
udp.1.dirsetup
udp.2.dirsetup

udp.0.scale (rw - float) steps per position unit
udp.1.scale
udp.2.scale

udp.0.accel (rw - float) acceleration in position units/s2
udp.1.accel
udp.2.accel

udp.pwm.00.freq (rw - u32) PWM frequency in Hz 0..65000
udp.pwm.01.freq
udp.pwm.02.freq
udp.pwm.03.freq
udp.pwm.04.freq
udp.pwm.05.freq

PWM usage

If the udp.pwm.xx.freq parameter is set to 0, the udp.out.xx pin works and the udp.pwm.xx pin does not.
If the value of the udp.pwm.xx.freq parameter is not 0, the udp.out.xx pin does not work and the udp.pwm.xx pin does.

hal2udp's People

Contributors

jzolee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.