OSDYLS - Open Source DIY Lasertag System #7 IR communication
Alright, this post is about the most important thing about OSDYLS, the IR communication.
Before I started this I already bought a bunch of IR diodes and receivers that other people recommended in their attempts or just looked logical to me.
Meanwhile I believe this is the part where most of the DIY attempts got stuck.
Lets go through these projects:
Pewduino
There was much time and energy spent on this project, including own PCB and more, my deepest respect! Luckily today, due to the availability a lot of *duino electronics, noone has to reinvent anything anymore.
He somewhere wrote he would go for a 50mm lens. Reason: focal length.
If you have a look at all these shopable lasertag toys you will notice a pretty small lens and IMHO there is a reason for this.
If you start with a big lens you are able to transport more light to the target. True but it also starts with a bigger diameter and will end up in an even wider diameter at the target. I don´t see any advantage but I might be wrong, I haven´t tested with anything larger than a 30mm lens.
At this point I should mention, that lasertag is different than paintball. You don´t shoot at a big target you actually aim at a pinhole target. So if you have a very focused beam it will be pretty hard to hit your target. On the other hand if you want to differentiate between a head/body/tagger hit your beam shouldn´t be wider than 15-20cm.
Duino Tag
This Lightgun (Arcade game controller) hack uses the inbuild lens of the gun, judging by the photos this is about 25-30mm in diameter with a focal length of about 70mm, the positioning doesn´t look too accurate and there is no additional aperture. It refers to miles tag, a diy laser tag system you will only find with waybackmachine cause the site is offline.
As it is old and there are many parallels I assume Pewduino used this as a major source for information.
Miles Tag
Lasertag system by Danie Conradie @ Hackaday
This is one of the most recent approaches, also using an ESP32. I did find this project after I started mine so I did not adapt that idea from there it was just the nearest probability for a microcontroller to be used. I quickly found out that the D1 Mini could have too few GPIO pins so I swapped to the S2 mini.
And I am not too keen on creating an own PCB for this (I will probably still do but that will be optional.), it just makes anybody interested in building this dependant on a propriatary thing which makes sense if you want to make money with it but not if you go for open source.
However even with all of its features I don´t think this approach got a good range or even works too well outdoor. No lens and I just hope that is not a laser diode he is using even though he mentioned 850nm VCSEL IR lasers. I don´t know, these are used in various professional surveillance systems but on one side I don´t have a good feeling using lasers and on the other they are too costy anyway.
In the comments he states for now he is using normal remote LEDs.
Conclusion
I have to do a lot of experiments and I still believe it doesn´t make any sense to use expensive parts or create proprietary components. This would just end up in an expensive toy and you could just go out and buy some evolver swaptx or any more professional and even more expensive lasertag system.
So I started with some lens tests putting the lens in a printed pipe with 100mm focal length distance to the LED. It already seems like the focal length needs to be adjustable for each lens used. So I need to make the LED position adjustable about 10mm.
Next step is to create two simple circuits, one sender and one receiver to do some basic range tests.
To shrink the beam it is required to use multiple lenses or pass the light the light to a couple of apertures.
IR receiver test setup #1
Quite simple setup, note that the pins in the circuit don´t necessarily match those of the receiver you use. This one is a TSOP 31238. You may notice that my LED resistor is actually a bit too small it should be around 90Ohm for that LED not 30Ohm, but the blinking is so short the LED isn´t crying yet ;-)
The code for the receiver, this is a minimalized version from the IRRemote examples. I disabled the LED feedback code and replaced it with my own, doesn´t make much sense but the original one uses the internal LED which isn´t too powerful and I want to do the feedback with the Neopixels later on.
#include <Arduino.h>
#define IR_INPUT_PIN 39
#define NO_LED_FEEDBACK_CODE
#include "TinyIRReceiver.hpp"
volatile uint32_t value = 0;
int ledPin = 5;
void setup() {
Serial.begin(115200);
initPCIInterruptForTinyReceiver();
pinMode(ledPin, OUTPUT);
}
void loop() {
if (value) {
digitalWrite(ledPin, HIGH);
delay(30);
digitalWrite(ledPin, LOW);
delay(1000);
Serial.println(value);
value = 0;
}
}
void handleReceivedTinyIRData(uint16_t aAddress, uint8_t aCommand, bool isRepeat)
{
value = aCommand;
}
IR sender test setup #1
The sending circuit is a bit more complex, I have "stolen" the concept from another website but replaced the small NPN transistor with a TIP120, the schematics for the transistor in the layout are not quite correct but you know what to wire.
The code, also a minimalized one from the library:
#include <Arduino.h>
#define EXCLUDE_EXOTIC_PROTOCOLS
#define NO_LED_FEEDBACK_CODE
#include "PinDefinitionsAndMore.h"
#include <IRremote.hpp>
void setup() {
Serial.begin(115200);
IrSender.begin();
IrSender.enableIROut(38);
}
uint16_t sAddress = 0x0102;
uint8_t sCommand = 0x34;
uint8_t sRepeats = 0;
void loop() {
Serial.println(F("Send NEC with 16 bit address"));
Serial.flush();
IrSender.sendNEC(sAddress, sCommand, sRepeats);
delay(2000);
}
Sender and receiver in action:
2022-07-21 update
The current setup isn´t satisfying, I made some indoor tests and and got stuck at about 7 meters, which is pretty much crap. Doing more research...
2022-07-24 update - good news!
I managed to increase the distance by putting two diodes in a row and lowering the 3,3k resistor to 220 Ohm, I assume I can go even lower (if I´d just know what I am doing ;-)).
I did a daylight test at 14m indoor without lens. Longest distance I can do indoor. It was pretty bad outdoor in sunlight but I expect this to get better once the sender and receiver are in casings, limiting scattered IR light that might disturb. Though I believe this will never be a sunny day game.
However 14m is not enough.
Comments
Post a Comment