IR receiver extend no volts

Thread Starter

sirchuck

Joined Feb 14, 2016
150
Which on a 38MHz Arduino is (if I don’t have a math error) is 26μS. Should be fast enough for your finger flick. Maybe fast enough for a bullet. Are you trying to detect a bullet?
Yup, I was trying to detect a bullet. But testing with a finger flick to see if it could handle that.

Currently, setting the pin detections to Digital instead of Analog looks promising. If when I get to bullet phase of tests I'll see if it needs even further tweaking.


Please post the complete schematic for the circuit you have now. It is entirely possible that a simple component change will solve the problem.

ak

18 posts and counting . . .
I'll have to figure out how to build a circuit to show you all on here.

But it's simply 2 IR LED's with the receiver sending a signal to the GPIO pin. Some slow code is the first culprit. I found this reference which should let me speed it up. I'll get you a schematic when I figure out where to build one to show.

https://www.reddit.com/r/esp32/comments/f529hf
 

BobTPH

Joined Jun 5, 2013
11,524
A loop to detect the change on the GPIO might work, but it would have to check millions of times per second, and the processor could not do anything else while checking.

The better way is to have the signal trigger an interrupt. This is equivalent to checking the state after each instruction, and the processor can be merrily doing anything else it wants to.
 

Thread Starter

sirchuck

Joined Feb 14, 2016
150
A loop to detect the change on the GPIO might work, but it would have to check millions of times per second, and the processor could not do anything else while checking.

The better way is to have the signal trigger an interrupt. This is equivalent to checking the state after each instruction, and the processor can be merrily doing anything else it wants to.
Ok sounds good. I'll have to dig up some example code to figure out how to tell it to listen for in input to trigger the interrupt, but it doesn't seem like we'll get any faster via code. Which, is probably fine for me.
 

Thread Starter

sirchuck

Joined Feb 14, 2016
150
You'll need something a lot faster than a finger flick to simulate a bullet passing. :rolleyes:
Helpful.

But, keep in mind, it was failing with a finger snap test. Logic should then suggest it would also not work with something faster than a finger snap -- a bullet. Hence, the reason for my initiation of the post.

I do not have an oscilloscope or an easy way to build the circuit to print on this page yet. Maybe something on digikey can help this nOOb.
 

BobTPH

Joined Jun 5, 2013
11,524
So what is the status now? It works with polling of a digital input? If that is the case, you probably do not need any hardware changes.
 

Thread Starter

sirchuck

Joined Feb 14, 2016
150
So what is the status now? It works with polling of a digital input? If that is the case, you probably do not need any hardware changes.
Yes, it's working fine with your code suggestion change. That's good enough for now until I can get some bullet tests at some point. :D Good job.
 

Thread Starter

sirchuck

Joined Feb 14, 2016
150
At this point, I'm much more interested in the schematic than any build documentation. A clear schematic will tell us everything about the capabilities of what you have now.

ak
I understand, but I need a way to get you that schematic. Right now it's just on a breadboard. I could paint shop it later tonight but I'm sure there are tools online that will help me make it pretty for you to follow. I'm not an electrician so I don't know the symbols to make it nice for you.
 

Thread Starter

sirchuck

Joined Feb 14, 2016
150
For those of you asking for a schematic I found a place to kind of do it.

Parts:
2 - 200 Ohm Resistors for LED's
1 - 10k - 1M resister to vary the distance the receiver will pick up the light signal.
1 - IR Receiver
1- IR Emitter
1 - 5v USB battery pack
1 - ESP32 Microcontoller

Negative receiver pin gets connected to positive battery, positive pin gets connected to ground through resister and GPIO

I don't have an oscilloscope to show you any wave forms, and I don't know a wave form from a hole in the ground anyway. :D I didn't see a microcontroller in the diagram builder so I used a switch for the GPIO pin.

circut.png
 

Thread Starter

sirchuck

Joined Feb 14, 2016
150
Is the GPIO pin acting as an output or input? Either way, what is its function?

ak
So, my use case requires 30 GPIO's, and they will all act as inputs waiting on a 0 signal when the LED Light is broken. ie: when the bullet passes through. :)

I don't see how the circuit could get any simpler. However, it would be nice to know if I could throw a capacitor on someplace so the 0 signal would last a little longer to make up for any lag the microcontroller can't handle.

I don't know enough about capacitors to make them function like that, only to hold and slowly release a charge, but I'd need to release the 0 a little longer. :D
 

WBahn

Joined Mar 31, 2012
32,876
So, my use case requires 30 GPIO's, and they will all act as inputs waiting on a 0 signal when the LED Light is broken. ie: when the bullet passes through. :)

I don't see how the circuit could get any simpler. However, it would be nice to know if I could throw a capacitor on someplace so the 0 signal would last a little longer to make up for any lag the microcontroller can't handle.

I don't know enough about capacitors to make them function like that, only to hold and slowly release a charge, but I'd need to release the 0 a little longer. :D
If all you want is a go/no-go indication, then you can wire them so that you only need a single GPIO pin. But I notice in your frame you have fifteen across the vertical and fifteen across the horizontal, which makes it look like you want to determine where the bullet passed, not just when. If you just want "when" you only need a vertical curtain or a horizontal curtain, not both. If you are looking to get position, then you do need something more, but not necessarily 30. You could get by with 8 pretty easily and, with a bit more effort, 4 or 5. With even more work, you could get it down to just one, but that is probably more work than it is worth.
 

be80be

Joined Jul 5, 2008
2,395
int ifRead;
int hashit = 0;
const byte InputPin = 12;
void setup() {
Serial.begin(9600);
pinMode(InputPin, INPUT);
}
void loop() {
ifRead = analogRead(InputPin);
Serial.println(ifRead);
if( ifRead == 0 ){
hashit = 1;
}
if(hashit == 1){
hashit = 0;
Serial.println("You have a hit!");
delay(2000); // This hold up the hold ball of wax for 2 seconds so you not see anything that happens in the delay
Serial.println("Starting Again");
}
}
 
Top