i am working on a cnc machinge that uses a probe to determing its location in a 3d space. ive worked out how to control the probe wirelessly with two arduinos. One being a sender and the other a receiver. However, i have been using a 355/415 MHZ radio transceiver and the lag between communication is 16-32ms long which is too long i need sub 10ms. This could be my code which i will post but i think its the devices.
I am looking for a module that is preferably linked together because i will have multiple cnc machines going at once and i dont need false triggers. ive been leaning towards infared but i accidentally purchased two pin IR sender/receiver parts and they wont do the job i believe
RECEIVER USING ARDUINO UNO
#include <RCSwitch.h>
/*
Simple example for receiving
http://code.google.com/p/rc-switch/
Need help? http://forum.ardumote.com
*/
#define ENABLE 5
RCSwitch mySwitch = RCSwitch();
int x = 0;
int i;
int y;
void setup() {
Serial.begin(230400);
mySwitch.enableReceive(0); // Receiver on inerrupt 0 => that is pin #2
pinMode(ENABLE,OUTPUT);
digitalWrite(ENABLE,HIGH); // enable on
}
void loop() {
if (mySwitch.available()) {
int value = mySwitch.getReceivedValue();
while (value == 1) {
digitalWrite(ENABLE,LOW); // enable on
Serial.println("Recieved");
// delay(500);
//
// digitalWrite(ENABLE,HIGH); // disable
value = mySwitch.getReceivedValue();
}
digitalWrite(ENABLE,HIGH); // disable
}
mySwitch.resetAvailable();
}
Why are you using an analog sensor when you are only checking for a "0" value? A digital sensor will also check for contact with your object. Analog conversions take time.
Paul_KD7HB:
Why are you using an analog sensor when you are only checking for a "0" value? A digital sensor will also check for contact with your object. Analog conversions take time.
Paul
That could be a possible change. I am using a switch and it is floating and when i trigger it the switch goes to ground. i am unsure if the digital will fluctuate due to floating I can try that.
But i belive that would only affect microseconds at best. i forgot my timing measurements on the O-scope between trigger and signal sent but it is very minuscule
why do you need infrared or probes at all? if you're simply building a cnc machine and need it to know where it is in 3d space just put some encoders on your stepper motors. That will allow you to read the position of the stepper motor just like you would to a servo motor. This way you will always know where the machine is without ever having to "find" it.
NeilSawhney:
why do you need infrared or probes at all? if you're simply building a cnc machine and need it to know where it is in 3d space just put some encoders on your stepper motors. That will allow you to read the position of the stepper motor just like you would to a servo motor. This way you will always know where the machine is without ever having to "find" it.
Sorry for the misunderstanding, i am not building a machine. I am adding taking a way a wired probe and created a wireless probe on Large manufacturing CNC machine.
6 FT is workable. You don't need different frequencies. You just need different codes to be sent.
The 3-pin receivers have internal ICs that decode at 38kHz, there are 40kHz models as well, but stick to 38.
Think of your TV remote. The command sent is based on the button pressed. The receiving ends only need to respond to whatever commands you program them to listen to. They will 'see' commands sent to other intended receivers, but if the code is not something they have an action to perform in response to, nothing happens. There is zero point in going with different frequencies.
These are not simple 'high/low' devices. Their output is a series of highs/lows. Every command sent is data, like a number.