VFD and stepper drivers installed in the electrical box.
Vexta driver autotest feature shows that motors are in good condition and 5 phases cabling is ok.
Need to integrate the control panel for further validation.
I have replaced the Probotix cape by a Furaday cape to get more I/O pins.
Here is the updated schematic diagram:
I needed this feature for my lathe control panel project. The goal is to drive the jog steps size by the rotation speed of the jog wheels.
The algorithm has been validated from 5 Hz to 100 kHz.
Maximum measurement error is 1%. See curves below.
The patch is available here: https://github.com/f1oat/machinekit
loadusr -w ../setup.sh loadrt threads name1=servo-thread period1=1000000 loadrt hal_pru_generic prucode=$(HAL_RTMOD_DIR)/xenomai/pru_generic.bin pru=0 num_encoders=1 num_pwmgens=1 pru_period=2500 halname=hpg addf hpg.update servo-thread addf hpg.capture-position servo-thread setp hpg.encoder.00.chan.00.A-pin 7 #925 ENCxI setp hpg.encoder.00.chan.00.counter-mode 2 #Up Counter (counts rising edges on A, always counts up, B ignored) setp hpg.pwmgen.00.out.00.pin 921 #PWM1 setp hpg.pwmgen.00.out.00.enable 1 setp hpg.pwmgen.00.pwm_period 1000000 setp hpg.pwmgen.00.out.00.value 0.5 start loadusr -w sleep 1 loadusr -w python encoder_test.py
#!/usr/bin/python import subprocess import time import os def readpin(p): r = subprocess.check_output('halcmd -s show pin ' + p + '|head -1',shell=True) lst = r.split() return lst def setpin(p, v): subprocess.check_output('halcmd -s setp %s %d' % (p, v), shell=True) freq = 5.0 prev_freq = 0.0 maxerror = 0 f = open('result.csv', 'w') line = 'in(Hz), out(Hz), err(%), latency(ms)' print line f.write(line + '\n') time.sleep(2) while freq < 100e3: period = int(1e9/freq/2500) * 2500 # because pru_period=2500 real_freq = 1e9/period if (real_freq <> prev_freq): prev_freq = real_freq setpin('hpg.pwmgen.00.pwm_period', period) time.sleep(0.2) measured_freq = float(readpin('hpg.encoder.00.chan.00.velocity')) latency = float(readpin('hpg.encoder.00.chan.00.latency')) * 1e-6 error = abs(real_freq / measured_freq - 1.0) maxerror = max(maxerror, error) line = "%8.1f, %8.1f, %4.2f, %3.0f" % (real_freq, measured_freq, error*100.0, latency) print line f.write(line + '\n') freq = 1.1*freq f.close() print "Max error %.1f%s" % (maxerror*100.0, '%')
Brainstorming, CAD, CAM, simulation, wood, machining, gluing, sanding, HIPS … the control panel is almost ready!
The structure of the control panel is made of 5mm plywood. The red color is coming from a 1mm sheet of HIPS. Everything machined on my CNC-6040 router with 3.17mm carbide endmill.
The touchscreen is a Beetronics 12″ model. Connected through HDMI to the BeagleBone Black board. Easy configuration: there is native support for the touchscreen USB pointing device in the Machinekit Linux image!
Step by step manufacturing of the control panel.
First step was CAD design with ViaCAD software.
Plywood panel machined with 3.17mm carbide endmill. Some pockets to have 2mm thickness for industrial buttons fixture.
MPG and lights will be managed by an Arduino UNO. Stay tuned …
My new project is the retrofit of an Emco Turn 120P CNC lathe.
For the motion controller, I have chosen Machinekit running on a Beaglebone Black board. 12″ touchscreen with Gmoccapy GUI. A Controllino PLC to manage all non-realtime I/O such as the pneumatic chuck, the tailstock, the pumps, etc …
The original 5-phases stepper motors has been kept. They are driven by two Vexa UDK5128N drivers. Need 110V AC source for them, coming from an auto-transformer.
The original spindle DC motor has been replaced by a 3 kW AC motor driven by an Hitachi NE-S1-022 VFD. This VFD is controlled over MODBUS by the Machinekit controller through the PLC. I have patched the standard MODBUS over TCP stack to have a gateway to the RS485 bus.
Here is the global schematic diagram of the electronics.
Next step is the modification of the Probotix PBX-BB cape to give access to the eQEP2 quadrature encoder for the spindle position sensor.
The Wino-board is very interesting for IoT home projects. It is an Arduino tiny board including Wifi interface.
The pitch of the connectors is 2mm to optimize the footprint. But this is not so easy to use with 2.54mm pitch common breadboards. So, I have designed a small adapter to convert from 2mm to 2.54mm pitch.
Full project including Gerber files and Target 3001! design : Winoboard adapter V05.zip
After trying to implement auto bed leveling feature with a retractable switch, I decided to use a small induction sensor. I experienced poor mechanical reliability with the retractable switch mostly because the PLA bracket was melting when the 2 extruders were hot.
I have modified the original hot end holder design by Ultimaker so that a support plate for the induction sensor can be tightly screwed.
Here is the original design compared to the new one
The induction sensor is a TL-Q5MC1-Z from Omron. Even it is rated for 10 to 30 VDC power supply, it works very well down to 2.5V, including the embedded red LED indicator. The detection distance of the aluminum plate is about 2mm. So I have replaced the 3mm glass plate by kapton tape to accommodate this short detection range.
The sensor is connected to GND, +5V and Pin13 of the Ultimaker controller board so that the ZMIN endstop switch is still active. Keeping the ZMIN endstop is useful for security reason in situation where the induction sensor does not work anymore, or the aluminum bed is not present.
I have modified the Marlin firmware as below:
- Activation of the 3 points bed leveling feature
- Optimization of G28 and G29 sequences
- Support of a sensor connected to the Pin 13 of the controller board
The project resources are available here:
- Hot-end holder 3D model in STEP format
- Omron sensor Mounting plate 3D model in STEP format
- Modified Marlin firmware
- Ultimaker forum interesting technical discussion
My first experience with Machinekit: the retrofit of an old Intelys C3000 machining center! Three months of work with many new things to learn:
- Beaglebone Black configuration and interfacing
- PRU integration
- Machinekit compilation and configuration
- QML programming to modify Machineface
- Setup of a X86 VM to execute my machine configuration in simulation mode
- PCB routing with Target3001! EDA
- How to engrave a PCB with a CNC router
- and lot of fun
Many thanks to the Machinekit and LinuxCNC community for helping me on some tricky configuration issues.
The customized Machineface GUI is available from https://github.com/f1oat/
BobCAD-CAM is able to manage multiple machine setups in the same project. This is a very useful feature when the workpiece should be cut in several phases with a different fixture for each of them. Below an example with 3 machine setups.
The generated G-Code file contains all operations in the same file, except if you enable manually only one fixture. So, saving one different G-Code file for each machine setup is possible, but quite painful and risky.
To solve this issue, I have designed a custom BobCAD-CAM postprocessor and a dedicated LinuxCNC/Gmoccapy panel to select from one single G-Code file the operations to be executed for a given machine setup. Also, the Gremlin preview is automatically updated according to the selected machine setup. Here is a video showing how it works:
In the BobCAD-CAM generated G-Code file, the section associated to each machine setup is surrounded by if / elseif / endif statements for dynamic selection.
... (Machine Setup - 1 Facing) (FACING) O100 if [ #<_selected_setup> EQ 1 ] T1 M6 G53 G0 Z#<_ini [ AXIS_2 ] SAFE_POSITION> S15915 M3 G0 X60.150 Y-22.600 M7 (MIST COOLANT) G0 (Machine Setup - 2 Pocket) (POCKET) M5 T2 M6 S3559 M3 M7 (MIST COOLANT) G0 G0 X5.969 Y.000 G0 Z35.480 ... (NEXT MACHINE SETUP - Machine Setup - 2) O100 elseif [ #<_selected_setup> EQ 2 ] T1 M6 G53 G0 Z#<_ini [ AXIS_2 ] SAFE_POSITION> .... (NEXT MACHINE SETUP - Machine Setup - 3) O100 elseif [ #<_selected_setup> EQ 3 ] .... G0 Z25.480 G0 Z55.800 O100 endif M5 M30
The #<_selected_setup> is a custom named parameter linked to a Gmoccapy panel where the setup number can be selected from 1 to 6.
For those who are not using Gmoccapy or LinuxCNC, another option is to get the chosen machine setup by reading an analog input with a M66 statement.
I have spent some hours to configure properly my BobCAD-CAM postprocessor for good result. One tricky aspect is the tools management: if the tool does not change from one machine setup to the next one, the original postprocessor does not include any further tool change statements in the G-Code file. This is not compatible with my O100 if/elseif/endif hack because, the tool change sequence would be issued only for first machine setup. So, I have added a systematic tool change in the following section of the posprocessor:
16. Machine Setup Change " " "(NEXT MACHINE SETUP - ",setup_name,")" " " n,"O100 elseif ","[","# EQ ", program_block_5, "]" n,t,"M6" n,"G53 G0 Z#<_ini","[","AXIS_2","]","SAFE_POSITION>" n,s n,spindle_on n,rapid_move,force_x,xr,force_y,yr,rotary_xyr_angle n,program_block_1 "G0" output_rotary_angle
I am not yet fully happy with this solution because I have some unnecessary tool change requests in some situations. But, at least it works, in any case!
I have now to test this modification on the real machine … Stay tuned!