Showing posts with label press. Show all posts
Showing posts with label press. Show all posts

Sunday, 5 April 2020

Rexon RDM150D Retrofit ESTOP Stage 2

Summary
This blog details the second stage retrofit of a Rexon RDM150D drill press. The second stage added movement monitoring of the spindle and a requirement to  deactivate the drill press run switch after triggering the ESTOP. The first stage retrofit blog contained details relating to controller design and the drill press wiring.

Electrical Wiring - Stage 1
The first stage changes to the drill press electrical, which included the ESTOP button and controller, are shown in the image below.


Rexon RDM150D Stage 1 Electrical
Rexon RDM150D Stage 1 Electrical

Electrical Wiring - Stage 2
For the second stage retrofit, a proximity switch and a relay were added to the design. Both the new devices were connected to the controller.


Rexon RDM150D Stage 2 Electrical
Rexon RDM150D Stage 2 Electrical
Inductive Sensor
For detection of rotational movement in the pulley responsible for driving the spindle, an inductive sensor was selected.

MCPIP-T12L-001 Courtesy Multicomp
      MCPIP-T12L-001 Courtesy Multicomp

The sensor was manufactured by Multicomp, part MCPIP-T12L-001, which features a PNP output, M12 thread and a 2mm sensing distance.


Inductive Sensor PNP Electrical Connections
Inductive Sensor PNP Electrical Connections
DIN Relay
A relay was added to detect when the manual switch (DPDT) was in the ON state. Providing the manual switch state to the controller served two purposes, firstly the controller could determine when the spindle was active and secondly the same feedback signal could be used to ensure that the manual switch was OFF before the contactor was reactivated.


DIN Relay 2909526 Courtesy Phoenix Contact
DIN Relay 2909526 Courtesy Phoenix Contact

The relay used was a DIN style, 240V input, from Phoenix Contact.

As shown in the second stage electrical drawing above, the input to the relay was driven from the equipment side of the manual ON OFF switch. The pair of secondary side relay Normally Open connections were individually connected to 24V and the Spindle Active input of the controller.


Sensor Hardware and Mounting
An oversight with the Multicomp sensor installation was the devices body length which prevented the sensor being mounted between two pulleys.


Sensor Mounting Bracket
Sensor Mounting Bracket
To mount the sensor inside the top housing of the drill press, a repurposed wall bracket was drilled to the required hole size (M12). Loctite 243 was used on the sensor thread. The bracket was fitted at an angle as shown in the above image. This prevented use of the lowest belt position between the spindle and middle pulleys. A shorter sensor, placed parallel to the belts, would be recommended for those implementing this design.

Triggering the sensor was achieved using a small steel angle fitted to the pulley. For a speed of 3000 RPM, best results were achieved when the length of the steel angle was 20 mm. Two M3 bolts with Loctite 243 and internal star washers were used to fix the steel bracket in position.


Sensor Steel Pulley Bracket
Sensor Steel Pulley Bracket

Sensor Test Measurement
With the Multicomp sensor powered and an Oscilloscope fitted to the Out connection, one measurement was taken at a slow RPM and the second measurement at the fastest RPM.

Slow RPM Sensor Measurement
Slow RPM Sensor Measurement

Fast RPM Sensor Measurement
Fast RPM Sensor Measurement

Relay Mounting
The DIN relay was mounted between the contactor and the controller, as pictured below.

Electrical Enclosure DIN Relay Mounting
Electrical Enclosure DIN Relay Mounting

PSoC Inputs
The spindle and spindle active inputs to the PSoC controller were provisioned in the first stage controller design. Connections were made according to the updated inputs detailed in the section below.

PSoC Inductive Spindle Input
PSoC Inductive Spindle Input

Controller Wiring
A correction was required to the controller PCB overlay. The capture below shows the updated overlay reflecting the controller connections.

Retrofit Rexon Controller Updated PCB Overlay
Retrofit Rexon Controller Updated PCB Overlay

Controller Option
To identify new features were added to the controller, one of the option resistors was populated on the controller PCB.


Enabling Controller Option on PCB
Enabling Controller Option on PCB

PSoC Code Changes
The principal change to the PSoC was the addition of logic for counting pulses from the inductive sensor.


PSoC Windowed Pulse Counter
PSoC Windowed Pulse Counter

A timer solution was implemented fifty percent duty cycle with a period of 499 ms. During the On time the Timer_Spindle component accumulated counts from the Spindle input. At the end of the capture the isr_Spindle fires allowing the count value to be retrieved. For the remainder of the period no counting was performed. The Sync component was used to synchronise the slower PWM_Spindle clock with the Timer_Spindle clock.

Monitoring of the spindle active input and spindle speed was moved into a basic state machine, extract listed below.


/**
* @brief Basic State Machine for handling ESTOP and Spindle signals
*/

void State_Mach_Mon(void) 
{
    switch (Spindle_Monitor_State)
    {
    case (state_m_idle):
        if (Status_ESTOP_Read() == 1u)
        {
            Spindle_Monitor_State = state_m_es_deact;
        }
    break;

   case (state_m_es_deact):
        Control_ESTOP_Write(0x1); 
        if (Status_ESTOP_Read() == 0u)
        {
            Spindle_Monitor_State = state_m_reset;
        }

        if (Spindle_Active_Read() == true)
        {
            PWM_Spindle_Start();
            Timer_Spindle_Start();
            Spindle_Monitor_State = state_m_es_sp_act;
            Spindle_Started = true;
            Spindle_Timer = 100u; 
        }
    break;

    case (state_m_es_sp_act):
        Spindle_Count_Update();
        if (Status_ESTOP_Read() == 0u)
        {
            Spindle_Monitor_State = state_m_es_reset;
        }

        if (Spindle_Active_Read() == false)
        {
            Spindle_Monitor_State = state_m_reset;
        }

        if ((Spindle_Counts == 0) && (Spindle_Timer == 0))
        {
           Spindle_Monitor_State = state_m_es_reset;
        }
    break;

    case (state_m_es_reset):
        PWM_Spindle_Stop();
        Timer_Spindle_Stop();
        Control_ESTOP_Write(0x0); 
        Spindle_Started = false;
        if (Spindle_Active_Read() == false)
        {
            Spindle_Monitor_State = state_m_idle;
        }
    break;       

    case (state_m_reset):
        Control_ESTOP_Write(0x0);
        PWM_Spindle_Stop();
        Timer_Spindle_Stop();
        Spindle_Monitor_State = state_m_idle; 
    break;
    } 
}

Additional changes were made in the code to read pulses measured by the spindle sensor counter and also to determine the configuration of the PCB version (function) resistors.

Option Resistors
Notes for the code option resistors was into the PSoC project.


PSoC Notes for Option Resistors
PSoC Notes for Option Resistors

In the PSoC code, the various resistor combinations were used to define the controller operation.

/**
* @brief Board Options
*/
void Board_Options(void)
{
    if ((Option0_Read() == false) && (Option1_Read() == false))
    {
        System_Flags.Option_None = true;
        UART_UartPutString("No option\r\n");
    }
    else if ((Option0_Read() == true) && (Option1_Read() == false))
    {
        System_Flags.Option_Spd_Mon = true;
        UART_UartPutString("Speed monitor option\r\n"); 
    }
    else if (((Option0_Read() == true) && (Option1_Read() == true)) || ((Option0_Read() == false) && (Option1_Read() == true)))
    {
        UART_UartPutString("Unknown option\r\n"); 
    }
}

Sensor Counts
As the pulse counter configuration provided a 250 ms sampling window, the multiplier for the number of counts was set to 240.

/**
* @brief Read Spindle Counts and Report
*/
void Spindle_Count_Update(void) 
{
    if ((Spindle_Data_Ready == true) && (Spindle_Started == true))
    { 
        Spindle_Counts = Spindle_Raw*240u;
        Spindle_Data_Ready = false;
        ReportData();
    }
    Flag_Timer = false;
}

The Report Data function was used to provide the spindle speed in RPM. Data was output on a UART as shown in the capture below from TeraTerm.



Controller Spindle Speed Output in TeraTerm
Controller Spindle Speed Output in TeraTerm

A timer, defined by variable Spindle_Timer, ensured that when the spindle was not spinning for one second, the drill press motor would be switched off using the contactor.

Final Thoughts
The controller in this blog could be adapted for other workshop machinery, which was not originally manufactured with a method to stop that machinery in a controlled manner. Features such as the spindle rotation monitoring could be removed or disabled and other features added to suit the machine setup.

Downloads


ESTOP v1.1 BOM XLS
ESTOP v1.1 BOM XLS
ESTOP v1.1 Schematics PDF
ESTOP v1.1 Schematics PDF
ESTOP v1.1 PCB PDF
ESTOP v1.1 PCB PDF
ESTOP v1.1 Gerbers
ESTOP v1.1 Gerbers
ESTOP  v1.1 PSoC Doxygen
ESTOP  v1.1 PSoC Doxygen
ESTOP v1.1 PSoC 4.3 Project
ESTOP v1.1 PSoC 4.3 Project
ESTOP Module PSoC Creator Top Design PDF

Saturday, 12 October 2019

Rexon RDM150 ESTOP Retrofit

Summary
In a prior blog, minor repair work was undertaken on a Rexon drill press, model RDM 150D. The drill press came with only the standard run stop switch, no other safety or features. This blog follows the design, build and fitting of an emergency stop controller to the drill press.


Requirements
The requirements for the emergency stop controller were not strict; provide an emergency stop button on the front of the drill press. The stop action would be performed utilising a suitably rated contactor to interrupt the motor. The second feature (option) was to monitor rotation of the spindle to identify belt slippage or spindle stall whilst drilling. In the event of an error the contactor could be used to interrupt the motor.


Original Electrical Wiring
Shown below is a representation of the original electrical wiring for the RDM 150D. The main components shown in the diagram are the run stop switch and induction motor.


Rexon RDM150D Electrical
Rexon RDM150D Electrical
Electrical Wiring Update - Stage 1
The updated electrical wiring is shown below. The changes in the design consist of a circuit breaker, contactor, ESTOP button and controller. As the ESTOP controller and contactor operate from a supply voltage of 24VDC, a suitable AC to DC switch mode power supply is shown in the updated electrical wiring.


Rexon RDM150D Stage 1 Electrical
Rexon RDM150D Stage 1 Electrical
ESTOP Enclosure and Switch
With a clearer picture of the electrical hardware required the electrical enclosures were selected due to limited space. This was especially relevant to the emergency stop button. The switch chosen was from manufacturer EAO, model 84-5041.2B20, with double poles, normally closed contacts and internal LED. The short solder tail pins on the rear of the switch cater were ideal for shallow depth mounting enclosures.
EAO ESTOP Switch
EAO ESTOP Switch
To house the emergency stop switch, a wall mounted enclosure was utilised.


Wall Mount Enclosure
Wall Mount Enclosure


Controller Housing
Two DIN rail devices were required in the updated design, a contactor and an AC DC switch mode power supply. Staying with the DIN rail theme, a DIN rail enclosure was chosen from the Taiwanese manufacturer Dinkle. With all the hardware features required for the controller, an enclosure with 4 sets of 3 way connectors was selected. A similar to Dinkle part is DMEN-T3.


Dinkle DIN Rail Mount Enclosure
Dinkle DIN Rail Mount Enclosure
DIN Rail Electrical Enclosure
To contain items such as the circuit breaker, contactor, switch mode power supply, emergency stop controller and the sundry electrical wiring, a small plastic electrical enclosure was chosen. Supplier ABB manufacture a Europa series of enclosures which are suitable for holding DIN rail equipment. ABB Part number 1SL0880A00. This enclosure does not come with DIN rail and needed to be fitted.


ABB Enclosure
ABB Enclosure
Controller Hardware Design
To perform the operation of controlling the contactor (coil), based on the position of the emergency stop button, a dedicated controller would not usually be required. Series connection of the emergency stop buttons normally closed contacts with the contactor coil would suffice. The updated design does however provide a few other options for expandability so a controller was required.

microcontroller (Cypress PSoC) based solution was implemented in this project. This device was chosen because the internal FPGA could be used to monitor the two emergency stop inputs and activate both of the output drivers responsible for driving the contactor 24V and 0V rails, with the need for very little firmware. Certainly a code free design was not an essential feature nor intended however, using the microcontroller FPGA allowed for quicker implementation.


Hardware Features
As mentioned in the Hardware Design section, separate hardware drivers were used to drive the contactor supply rails of 24V and 0V. Displayed below is a portion of the schematic, with the two FET based switches used for driving the contactor coil.


Driver 0V
Driver 0V
Driver 24V
Driver 24V
The inputs to the controller were designed to convert the external 24V to the internal 5V level used. A voltage divider, with Zener protection, was used to limit the maximum voltage. Two separate inputs were used for the emergency stop contacts.


Controller Inputs
Controller Inputs
Four controller inputs were mapped to the micontrontroller, two for the emergency stop and two for the spindle stall detection option.


Controller Inputs to PSoC
Controller Inputs to PSoC

The emergency stop button contained an LED which was used to feedback the the switch state. Control of the LED was achieved using a single discrete driver as shown below.
LED Driver
LED Driver
Mapping of the inputs and outputs to the microcontroller was performed after the IDE (PSoC Creator) project was successfully generated. Shown in the capture below is the resulting connections to the PSoC.


PSoC IO Connections
PSoC IO Connections
Lastly was the 5VDC power supply for the boards logic devices which included the PSoC and the output driver for the 0V.


Power Supply - 5VDC
Power Supply - 5VDC
PSoC Pin Mapping
Mapping of the PSoC pins using PSoC Creator to generate the application was made concurrently with drafting the schematic.


PSoC Pin Mapping
PSoC Pin Mapping
The capture above was taken from the PSoC Creator project which illustrates the various connections made to the microcontroller.

Below is a capture of the page responsible for monitoring of the inputs from emergency stop switch contacts, driving the contactor to switch off the drill press motor and controlling the emergency stop switch LED.


Emergency Stop Inputs and Outputs
Emergency Stop Inputs and Outputs
The logic shown in the above capture was separated into three parts. Firstly the two glitch filter components provide debounce for the emergency stop switch.


Emergency Stop Switch Glitch Filter
Emergency Stop Switch Glitch Filter
Second were two outputs for driving the contactor FET switches for 24V and 0V.

Lastly were a pair of PWM components with slightly different timing to create the breathing effect for driving the LED.


PWM1 Configuration for Breathing LED
PWM1 Configuration for Breathing LED
PWM2 Configuration for Breathing LED
PWM2 Configuration for Breathing LED
Also included in the project was a tick timer, UART component for debugging, two inputs used for future options and a status LED.


Miscellaneous Project Items
Miscellaneous Project Items
With an application generated from PSoC Creator and a schematic, the controller PCB design was started.


PCB Shape
To determine the shape of the PCB a quick check of the controller enclosure datasheet was performed. The Dinkle datasheet did provide an elaborate design for the PCB shape however the more important spacing for the terminal blocks was also shown.


Dinkle Suggested PCB Layout
Dinkle Suggested PCB Layout
Using a physical Dinkle enclosure and the suggested layout from the data sheet, a PCB shape was finalised.


Control PCB Dimensions
Control PCB Dimensions
PCB Layout
The PCB components were placed with the microcontroller, power supply and switching FET's well separated from each other. Placement of the four 3-way connectors, representing the terminal blocks on the Dinkle enclosure, were made according to the Dinkle suggested layout.


Control PCB Parts Placement
Control PCB Parts Placement
A four layer PCB was used for routing the control board. Two external signal layers and two internal planes. One of the internal planes was solely used for 0V and the second was segmented into planelets for the various power supplies.

The capture below shows the top layer route concentrating on high current paths and breaking out connections from the microcontroller.


Control PCB Top Layer Route
Control PCB Top Layer Route
In the following capture the bottom layer input and output routes are shown.


Control PCB Bottom Layer Route
Control PCB Bottom Layer Route
The capture below shows the two internal planes, 0V to the top and power to the bottom.
Control PCB 0V Plane
Control PCB 0V Plane
Note that the power plane is split into four planelets. One section was for the input supply, a second for powering ESTOP devices, a third for 5V to power logic devices and a digital 5V required only by the microcontroller.


Control PCB Power Plane
PCB Manufacture
The control PCB was manufactured by Chinese board house 3PCB (PCBWay). During the ordering process the surface finish was selected as lead free tin with an option to use gold plating (ENIG). As shown below the PCB received was gold plated.


Control PCB Unpopulated
Control PCB Unpopulated
PCB Population
As is usually performed with a new prototype PCB, sections of the design were loaded then tested in stages. For the control PCB the 5V power supply was populated then tested. This was followed by the high low switches and lastly the microcontroller. The capture shows the mostly populated PCB during testing.


Control PCB Populated
Control PCB Populated
Controller Testing
For testing of the contactor driver outputs, a control register called Control_ESTOP was configured in code which enabled the contactor driver outputs. Toggling the contactor state was possible by toggling the emergency stop button. The code below shows a portion of the code to setup the micro and drive the control register.

/**
* @brief Initialise PSoC Components and ISR
*/
void Init_Components(void)
{
    Status_LED_Write(true);
    LED_PWM1_Start();
    LED_PWM2_Start();
    isr_SysTick_StartEx(isr_SysTick_Handler);
    UART_Start();
}

/**
* @brief Send firmware version to UART
*/
void UART_Print_Ver(void) 
{
    char buf[20] = {0};                 /* Init used vars */
    sprintf(buf, "%s%d%d%d", "Drill Press v" , ver_maj, ver_min, ver_build);  
    UART_UartPutString(buf);            /* Output UART buffer */
    UART_UartPutCRLF(0);
}

/**
* @brief Setup and configure micro
*/
int main(void)
{
    CyGlobalIntEnable;                  /* Enable global interrupts. */
    Init_Components();
    UART_Print_Ver();
    Control_ESTOP_Write(0x1);   /* ESTOP output follows ESTOP button */
    for(;;)
    {

    }
}
ESTOP Housing
Mounting of the ESTOP button was made utilising a wall mount enclosure which, served as the base to attach against the chassis of the drill press.


Mounted ESTOP Button
Mounted ESTOP Button
A double insulated multicore cable (3 pair) was used to connect the mounted button to the ESTOP controller.

ESTOP LED and Contactor
With the necessary switch contacts and LED connections made to the controller, the firmware was loaded into the controller using PSoC Creator. With the ESTOP button in the deactivated position, the LED was always illuminated. In the activated position, the LED pulsed between on and off. A short video of the LED cycling is shown below.



The contactor was connected to the controller and bench tested with the ESTOP switch to verify operation.


Contactor Connection
Contactor Connection
Control of the ESTOP contactor can be visualised with a Wavedrom timing diagram as displayed below. The diagram illustrates the dependency of the contactor and LED on the PSoC operating and executing code. In the diagram the initial state of the ESTOP switch is in the released position. Changing position of the ESTOP switch causes the contactor to de-energise and the LED to begin the PWM operation. Returning the switch to the original position restores the contactor and LED to energised and non-PWM states respectively.
ESTOP Controller Stage 1 Timing


Mounting Electrical
Mounting the electrical components in the ABB enclosure was performed using a DIN rail. This was fitted inside the enclosure and fixed with bolts to a steel flat bar (2mm) on the rear of the enclosure. Additional tapped holes were provided on the flat bar to facilitate mounting to the body of the drill press.

Mounted Electrical Hardware
Mounted Electrical Hardware
The existing electrical cabling was temporarily removed to facilitate removal of the drill press motor.


Drill Press Electrical Disconnection
Drill Press Electrical Disconnection
With the motor belt disconnected and the fixing bolts removed, the drill press motor was removed.


Drill Press Motor Removal
Drill Press Motor Removal
To access the body of the drill press frame the motor mounting plate was removed.
Drill Press Motor Mounting Plate
Drill Press Motor Mounting Plate
Two small bolts were used to attach the steel flat bar against the chassis of the drill press.


Enclosure Mounting Bar
Enclosure Mounting Bar
The motor mounting plate was replaced and drill press motor mounted back onto the plate.

There were some changes to electrical wiring on the drill press, primarily because a miniature circuit breaker was added to the design. This meant that the mains power entered the new electrical enclosure first. Shown below is the wired enclosure.
Wired Drill Press Electrical Enclosure
Wired Drill Press Electrical Enclosure
Mounting ESTOP
To mount the ESTOP button the existing plate showing spindle speeds vs power line frequency was removed.


Drill Press Plate
Drill Press Plate
Two holes were tapped into the drill press to hold the enclosure, then the button was wired and tested.


Wired ESTOP  Button
Wired ESTOP Button
Finalising
To secure the cable between the ESTOP button and the electrical enclosure a metal clip was added.


Drill Press ESTOP Cabling
Drill Press ESTOP Cabling
Finally the cover for the electrical enclosure was fitted in place.


Electrical Enclosure Lid Fitted
Electrical Enclosure Lid Fitted
Downloads
ESTOP Module Schematics
ESTOP Module Schematics
ESTOP Controller Gerber
ESTOP Controller Gerber

PSoC Creator 4.2 ESTOP Controller Project
PSoC Creator 4.2 ESTOP Controller Project


Updates
16/11/2024    Corrected link to PSoC code