router speed controller {ideas} cirect linuxcnc control

More
04 Jun 2022 09:32 - 11 Jun 2022 09:25 #244568 by robertspark
This is more of an "I was wondering" thought....

I've got a SuperPID for my router controller, and its ~OK.... but I was wondering if anyone has built or knows of a circuit to directly control a router.

No it cannot be VFD controlled.

It would need to be controlled via a TRIAC, the SuperPID uses a BTA26-800CWRG (Triac, 800 V, 25 A, TOP-3, 35 mA, 1.3 V)
4donline.ihs.com/images/VipMasterIC/IC/S...58556ACFDE234799DDF0

Whilst I like the LCD, knobs and switches of the Super PID, I was wondering if anyone has built or knows of a circuit that would integrate with LinuxCNC via maybe a Mesa card?

The SuperPID uses an optical sensor for speed sensing...... it's been ok, but reciently it was not happy and was getting erratic readings.

My router actually has a magnetic disc on the end of the spindle and the original speed controller used {what I suspected and now confirmed} a hall effect sensor to provide speed control and feedback.

I am presently feeding the superPID index signal back to linuxcnc via an encoder index signal 

I was just thinking ..... there must be a better / simpler way with linuxcnc of providing closed loop speed control via a simiple interface.

Open to suggestions (I'm about to get some boards made and shipped so I though I'd get one designed and have a go at getting it to work closed loop in linuxcnc)
Last edit: 11 Jun 2022 09:25 by robertspark.

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

More
04 Jun 2022 11:01 #244569 by robertspark
Hmm..... this may provide a simple circuit for speed control of the router:

forum.arduino.cc/t/voltage-controlled-di...an-attiny85/303732/9

 

swapping out the triac for a BTS26-800CWRG
// 
// AC Phase control is accomplished using the internal 
// hardware timer1 in the ATtiny85
//
// Timing Sequence
// * timer is set up but disabled
// * zero crossing detected
// * timer starts counting from zero
// * comparator set to "delay to on" value
// * counter reaches comparator value
// * comparator ISR turns on triac gate
// * counter set to overflow - pulse width
// * counter reaches overflow
// * overflow ISR turns off triac gate
// * triac stops conducting at next zero cross

// The hardware timer runs at 8MHz. 
// A half period of a 50Hz AC signal takes 10 ms is 80000 counts.
// Prescaler set to 1024 gives 78 counts per half period


#include <avr/io.h>
#include <avr/interrupt.h>

#define DETECT 2      //zero cross detect, interrupt 0, is physical pin 7
#define GATE 3        //triac gate is physical pin 2
#define PULSE 2       //trigger pulse width (counts)
#define INSTELPIN 2   // =A2 (digital pin4) is physical pin 3 

void setup(){
  // set up pins
  pinMode(DETECT, INPUT);      //zero cross detect
  digitalWrite(DETECT, HIGH);  //enable pull-up resistor
  pinMode(GATE, OUTPUT);       //triac gate control

  // set up Timer1 
  TCCR1 = 0;     // stop timer 
  OCR1A = 50;    //initialize the comparator
  TIMSK = _BV(OCIE1A) | _BV(TOIE1);  //interrupt on Compare Match A | enable timer overflow interrupt
  sei();  // enable interrupts
  // set up zero crossing interrupt
  attachInterrupt(0,zeroCrossingInterrupt, FALLING);    
}  

ISR(TIMER1_COMPA_vect){ //comparator match
if(OCR1A>65){ //send no pulse to triac for low input voltage for 0v output
return;
}

//Interrupt Service Routines
void zeroCrossingInterrupt(){   
  TCNT1 = 0;   //reset timer - count from zero
  TCCR1 = B00001011;        // prescaler on 1024, see table 12.5 of the tiny85 datasheet
}

ISR(TIMER1_COMPA_vect){    //comparator match
  digitalWrite(GATE,HIGH); //set triac gate to high
  TCNT1 = 255-PULSE;       //trigger pulse width, when TCNT1=255 timer1 overflows
} 
 
ISR(TIMER1_OVF_vect){       //timer1 overflow
  digitalWrite(GATE,LOW);   //turn off triac gate
  TCCR1 = 0;                //disable timer stop unintended triggers
}

void loop(){     // use analog input to set the dimmer
int instelwaarde = analogRead(INSTELPIN);
OCR1A = map(instelwaarde, 0, 1023, 65, 2); 

// options:
//OCR1A = map(instelwaarde, 0, 1023, 70, 25);// 0v to 180v (220v input)
// OCR1A = map(instelwaarde, 0, 1023, 70, 2); 

}

separate circuit for spindle index feedback.
 
Attachments:

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

More
09 Jun 2022 23:33 #244829 by andypugh
As there is a microcontroller in there, I would suggest not using analog voltage for the speed control, instead use a step-dir interface. (or something else digital). I am thinking on terms of a position-mode step interface, where the microcontroller increases or decreases an internal speed variable in response to pulse inputs.

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

More
09 Jun 2022 23:59 - 09 Jun 2022 23:59 #244833 by PCW
If using a Mesa card, this also could be done with a FPGA oneshot with a trigger in
and end of timeout pulse output. I'll take a look at adding this.
Last edit: 09 Jun 2022 23:59 by PCW.

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

More
10 Jun 2022 20:45 - 15 Jun 2022 10:00 #244904 by robertspark

If using a Mesa card, this also could be done with a FPGA oneshot with a trigger in
and end of timeout pulse output. I'll take a look at adding this.


How is that ^^^^ going to work?

nearly finished my PCB design (added an index / encoder input with a divider as my router seems to have a 4 pole magnetic ring on the end of the spindle measurable with a hall effect sensor
Last edit: 15 Jun 2022 10:00 by andypugh.

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

More
10 Jun 2022 23:11 #244916 by PCW
"How is that ^^^^ going to work?"

Two FPGA pins, one for zero crossing detect input
(connects to the LTV814), the other for the Triac drive pulse
Oneshot with variable time set in hal sets the delay
between zero crossing and pulse output = direct phase control
The following user(s) said Thank You: tommylight, robertspark

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

More
11 Jun 2022 08:12 #244933 by robertspark
ahhh. {light bulb!}

I can get rid of the attiny!

that would be much better to be able to control the triac directly from within linuxcnc. also better given it would be able to switch 50hz or 60hz too.

thanks very much that would be a lot better.

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

More
15 Jun 2022 10:01 #245171 by andypugh
Do we have any spare GTAGs for TRIAC Controller?
:-)

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

More
15 Jun 2022 13:43 #245195 by robertspark

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

More
15 Jun 2022 20:16 #245221 by andypugh
The following user(s) said Thank You: robertspark

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

Moderators: PCWjmelson
Time to create page: 0.217 seconds
Powered by Kunena Forum