All of those except the reciever response, I can substitute an original tsop into the same circuit and it works, but the tssp doesn't
Do you have access to an oscilloscope ?
Sadly not, but I do have a decent multimeter that will do hz etc
Show us good images of the circuit.
Probably easier to get an idea from this, the lm339 chips harvest the sensor trigger and feed them to the nor gate in the middle, which triggers the arduino pin. There's a seperate 5v supply on there and a transistor for the ir drive, the 38k from the arduino pin switches the transistor. Works lovely with the original sensors but my supply of replacements is exhausted.
Schematic please ![]()
Don't have one Larry, I probably did have when I built it but my notes folder is pretty poor...... Lesson learned.
Information I'm gathering suggests that I do in fact need to pulse the 38k signal as per the recommendation in the datasheet, suggested in the original but worked ok without. I will look at my options for this without rebuilding too much
Try the sketch from post #8 on your TSOP4048.
Are these two arduino micro boards running identical code or is one a transmitter and the other a receiver?
Is the code in post #16 just transmitter code or are the IR detectors (Tsop4038) also wired somehow to the arduino running this code? If so, which arduino pin is the IR detector connected to?
On this breadboard setup, using the new tssp4038 IR detectors, are you also using an Arduino Micro? I'm asking because there are significant differences between the Micro and more common Arduinos such as the Uno and Nano with respect to the timer configuration and the external interrupts.
There are two micros, one is providing the 38k modulation on pin 10, and receiving the signals from my two lines of sensors. The other is primarily for timing and running an lcd display.
On the bread board I'm still using a micro to generate the 38k yes. I now believe it is this that I have issue with
It is still not clear exactly what you have connected the output of the TSOP4038 to. Maybe try an external pullup resistor on it (say 10k).
The outputs are connected to lm339 comparators. I used this method so that I could group a bank of them to achieve a single output.
The TSOP4038 / TSSP4038 have open collector outputs so multiple devices could be connected together in parallel without problems.
There is probably a lot I did that could have been simpler. I researched and built with zero previous electronics experience other than 12v vehicle electrical systems. It's 8 years since I did so and I don't remember all the details but I think I may have used this method as it gave me an option to add an individual led per sensor for alignment purposes.
I can't contribute much more but probably the simplest test of the basic TSSP4038 is to connect it to a 5 volt supply and connect a led (with series resistor say 1K) between its output pin and the 5v rail. See if the led flashes when you use a TV remote control. The next stage is to configure an Arduino to generate a 38KHz carrier and feed this into an IR led via a 330 ohm resistor. The easiest way of generating the 38KHz carries is to use the Arduino's built in tone() function. See if you can get the TSSP4038 led circuit above to respond.
The other thing I'd look for is an explanation of how the original TSOP4038 devices failed, maybe look at the maximum voltage (5.5 volts).
Appreciate the help you have offered, I did pretty much what you're suggesting yesterday and achieved a response. I am pretty sure at this point that the 4038 does not accept a continuous 38k signal, despite the suggestions otherwise. I will report back once I have solved it.
Did you try the offered sketch with the 4038 ?
It keys the 38kHz.
Here is an earlier single IR beam receiver sketch.
Either an IR remote OR beam receiver can be used in this sketch.
//
//
//
// Version YY/MM/DD Comments
// ======= ======== ====================================================================
// 1.00 23/02/02 Running code
//
//
//
#define PULSE62_13 cli(); PINB = bit(PINB5); PINB = bit(PINB5); sei()
#define LEDon HIGH
#define LEDoff LOW
#define noRX HIGH
#define goodRX LOW
#define ENABLED true
#define DISABLED false
const byte heartbeatLED = 13;
const byte IR_Receiver = 4;
const byte IR_LED = 3;
bool IR_LEDstate = LEDoff;
bool rxFlag = ENABLED;
byte lastStatus;
//timing stuff
unsigned long heartbeatTime;
unsigned long IR_ledTime;
unsigned long startMillis;
// s e t u p ( )
//********************************************^************************************************
void setup()
{
Serial.begin(115200);
pinMode(heartbeatLED, OUTPUT);
pinMode(IR_LED, OUTPUT);
pinMode(IR_Receiver, INPUT_PULLUP);
} //END of setup()
// l o o p ( )
//********************************************^************************************************
void loop()
{
//********************************************** h e a r t b e a t T I M E R
//is it time to toggle the heartbeatLED ?
if (millis() - heartbeatTime > 500ul)
{
//restart this TIMER
heartbeatTime = millis();
//toggle LED
digitalWrite(heartbeatLED, digitalRead(heartbeatLED) == HIGH ? LOW : HIGH);
}
//********************************************** I R L E D T I M E R
//is it time to toggle the IR TX LED ?
if (millis() - IR_ledTime >= 5)
{
//restart this TIMER
IR_ledTime = millis();
//is the IR TX LED ON ?
if (IR_LEDstate == LEDon)
{
//stop modulation
noTone(IR_LED);
//update the LED status
IR_LEDstate = LEDoff;
}
//******************************
else
{
//start IR TX LED modulation
tone(IR_LED, 38000);
//update the LED status
IR_LEDstate = LEDon;
}
}
//********************************************** I R r e c i e v e T I M E R
//this TIMER should never expire if the IR beam is not blocked
//if this TIMER is enabled, has the TIMER expired ?
if (rxFlag == ENABLED && millis() - startMillis >= 20)
{
//disable this TIMER
rxFlag = DISABLED;
Serial.println("IR beam was broken.");
}
//**********************************************
//check the IR receiver
sampleIRreceiver();
//**********************************************
//Other non blocking code
//**********************************************
} //END of loop()
// s a m p l e I R r e c e i v e r ( )
//********************************************^************************************************
//check the receiver
void sampleIRreceiver()
{
byte currentStatus;
//**********************************************
//read the IR receiver sensor
currentStatus = digitalRead(IR_Receiver);
//*****************************
//did the status change ?
if (lastStatus != currentStatus)
{
//update to the new state
lastStatus = currentStatus;
//*****************************
//When the TX IR LED is toggling at 38kHz, the receiver output is LOW.
//At this point, we should be receiving a signal from the TX IR LED.
//
//has the IR beam been detected ?
if (currentStatus == goodRX)
{
//allow the TIMER to run
rxFlag = ENABLED;
//restart this TIMER
startMillis = millis();
}
}
} //end of sampleIRreceiver()
//********************************************^************************************************
I've ordered a new breadboard and some jumpers, mine are really old and have been badly stored so I'm fighting intermittent connections with them. I'll continue with this when they arrive, hopefully later today.
I'm hoping to avoid a total recode of my timing gates but what will be will be.
