Go Down

Topic: Wireless trigger using IR or RFor other MODULE (Read 205 times) previous topic - next topic

ezy75

Jul 17, 2017, 06:18 pm Last Edit: Jul 17, 2017, 06:25 pm by ezy75
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


Code: [Select]

TRANSMIT ATTINTY85
#include <RCSwitch.h>

#define Blink 0
RCSwitch mySwitch = RCSwitch();

void setup() {
 
  pinMode(Blink, OUTPUT);
  digitalWrite(Blink, HIGH);
  mySwitch.enableTransmit(1);  // Using Pin #10
  //Serial.begin(9600);
 
}

void loop() {
   int sensorValue = analogRead(A3);
   
 
   
   while(sensorValue == 0){
       
       
        digitalWrite(Blink, LOW);
        mySwitch.send("0001");
       
        //Serial.println("sent");
//        digitalWrite(Blink, HIGH);
   
    sensorValue = analogRead(A3);

          }
     
    digitalWrite(Blink, HIGH);
     mySwitch.send("1000");
}


Code: [Select]

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();
}


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

ezy75

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

Paul_KD7HB

Neither analog nor digital input should be "floating".

Paul

ezy75

what do you mean should not be floating. if it is connected to a switch and the switch is open then it is floating.

Paul_KD7HB

what do you mean should not be floating. if it is connected to a switch and the switch is open then it is floating.
Please review: http://www.thebox.myzen.co.uk/Tutorial/Inputs.html

Paul

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.

INTP

You need a 3 pin TSOP type IR receiver.

IR is fine for your needs if you have line of sight.

ezy75

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.

NeilSawhney


ezy75

You need a 3 pin TSOP type IR receiver.

IR is fine for your needs if you have line of sight.
I have looked into this device. I believe it outputs a logic low and high when receiving and not receiving a signal so that is very practical.

My questions are can it be set to receive signals at different frequencies?

Can it do 4 different frequencies?

What would be the range of detection if i could get line of sight. Max distance would be like 6 ft

INTP

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.

Go Up