What i am looking for is an Arduino to control 2 outputs, Given 3 inputs.
All 3 inputs will come from my laptop computers DB25/serial/lpt port. This port has 3.45vdc available.
The three inputs of the arduino will be machine safety, a 12.5khz signal generated by the laptop. When this signal is active i want the arduino to respond to the other 2 inputs. Each a different pin on the DB25. HIGH is 3.3v LOW is about .2v on this computer.
I have 5 volts available to drive the arduino.
Inputs -
Charge Pump -12.5khz signal. When the arduino see's this signal it will allow the other 2 inputs to effect change on the outputs. If this signal disappears regardless what the other inputs say, i want all outputs to default/OFF
Spindle - when commanded HIGH output will supply ground to ac drive starting spindle motor, again only if charge pump signal is present.
Stepper power - same thing as spindle. This could turn on anytime charge pump is present. does not need to be triggered separately, but can be through extra pin on db25.
My main issue is getting the arduino to respond to the charge pump input. when i check it with my meter I'm seeing about 1.5v as result of the 12.5khz square wave.
As i understand the PulseIn() function should be approx. what i need, but i am not sure if the voltage i have available is compatible with the arduino.
please feel free to correct any misunderstanding on my part. first time at this, terrible with electronics. but trying to learn!
Stepper power - same thing as spindle. This could turn on anytime charge pump is present. does not need to be triggered separately, but can be through extra pin on db25.
Running that through an Arduino is going to impose a delay and some jitter. How much delay will your project tolerate? How much jitter?
The charge pump output is generated by the MACH 3 cnc software.
The steppers do not run through this circuit, the connection from laptop to stepper board is direct. This is only the "Current Enable" for the steppers that i wish to control.
When current enable is grounded, the steppers respond to step/dir inputs from the laptop. When ungrounded the current enable for the steppers is off, and they will not move. The only jitter this would generate is if the OUTPUT from the arduino pulsed on and off in time with the charge pump. We do not want that.
As of now, the current enable and spindle on/off are switched on and off using nte3098 opto isolators.
The arduino only needs to provide a solid signal be it path to ground or 5v. When the charge pump is over 10khz the #1 output should be "ON", steadily.
When #2 input gets signal to start the spindle {turn on the other opto isolator} i want it to only do so if the charge pump signal is "seen" or present.
Sometimes mach is flakey, and the software will run at, what i can only describe as half kernel speed. In these situations where the square wave is under the 10khz threshold everything turns off, thereby disarming the machine.
This is also to stop the machine from jittering as the the computer boots up and down, as the lpt ports go through undefined states. Due to noise and packaging, using a schotky diode charge pump circuit to turn on a mosfet is not giving the desired results.
I purchased my first Arduino kit yesterday, an OSEPP Uno R3 Basics kit. Have been watching spark funs 8 hour intro course on youtube, as well as reading through the tutorials book it came with.
So far, I've made it through the Blink sketch! woot! I feel i am familiar enough with the device at this time to try take things a step further. {Getting it to connect to my Mac was interesting, as my Arduiono software does not have the "tools" option. You just have to keep attempting to upload a sketch until you stumble across the correct com port, and macs can have ALOT of com ports!}
I just wanted to stop here and make sure i was understanding the directions within the code.
Digital Pin 8 is to be my INPUT from computer {generating the 12khz clock signal}
Analog Pins A0, A1 {labeled IN on the board} are to be the 2 OUTPUTS to driving my optocouplers.
I would like to get this all hooked up in the next few days, and see what kind of results i get.
No change on led when charge pump signal is turned on/off.
I guess the first thing i need to do, is find out if the arduino is receiving the charge pump signal, and if so what the actual frequent of this charge pump is. Documention says its 12.5khz, but i have no way to confirm this as i do not have an o-scope.
Back to the books! Ive got to learn what all this code means before i can even hope to trouble shoot the circuit
Well, so far i have my little project doing everything i need it to.
Now i want to shrink it onto an attiny45. However, i do not think the FreqCount library will port over to the at tiny.
Any suggestions on using at tiny friendly code to count the incoming pulses?
Here is the code i have come up with so far. Im sure it is not very elegant code, this is my first time messing with this sort of thing. But seems to be working.
#include <FreqCount.h>
const int ledPin = 13;
const int SpinPin = 12;
void setup() {
pinMode(ledPin, OUTPUT); // initialize the LED pin as an output:
pinMode(SpinPin, OUTPUT); // initialize the LED pin as an output:
Serial.begin(57600);
FreqCount.begin(100);
}
void loop() {
if (FreqCount.available()) {
unsigned long count = FreqCount.read();
Serial.println(count);
if(count >=400 && count <= 1400)
{
digitalWrite(ledPin, HIGH); // Enables Stepper Current Opto USE RESISTOR!
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
if (digitalRead(13) == HIGH && digitalRead(3) == HIGH)
{
digitalWrite(SpinPin, HIGH); // Enables Spindle Opto USE RESISTOR!
}
else {
// turn LED off:
digitalWrite(SpinPin, LOW);
}
}
}