Pogopins difference

I ordered a batch of new pogopin connectors at the same supplier where I bought the first batch, sadly I noticed the new batch is slightly different size and swapped magnet orientation. So if you get those connectors for your ammo clips and blasters, get enough in ONE batch. I’ll add a modified version of the printable files soon.


Yes it has been a while since my last post however here is the first package with all the required data for the ammo clips.

ATTAG Frammo V1.3

First I started with blue clips and quickly found out that the light of the LED almost can’t pass the material. So I have picked yellow, also because it is easier to find in case you drop it when you are in a match. And I tried it with flying wires. Of course you can do it, but I can not recommend it because at the end the PCB aren’t really expensive at all and the money you invest in them you save on the wires you don’t require then.

So I opened fritzing and created a PCB (layout and link in the above file) and ordered a stack of them. Please don’t mind the circuit view in fritzing the soldering is pretty self-explaining in the pictures you see here.

Use the small display lift as you see in this picture:

Print as many of the cases as you need:

Solder like this:

Basically just GND,VCC,SC and SDA and the resistor for the LED. Soldering the pogopin connector is a bit tricky because the magnets attract the tip of the soldering iron but it is doable. Positive pin of the LED to the lower connection to the edge.

There you go, your stack of FRAMmo

By the way, all of this isn’t really required to make ATTAG work at the end, it is a nice addon and SOME game modes will require them. However, a cheaper way is to just leave the display out of them. The ammo left will be shown on the blaster display anyway. This here is just a fancy addon. I’ll add a case version without display window at a later point.

Last but not least, if you mess up your electronics or health by trusting in my work – your problem. No warranties given.

ATTAG ESP-NOW handshake working

Just a small update, the handshake by ESP-NOW is working, I haven’t tested the range yet but this is not an issue which stops the PCB from being created, because the WiFi stuff is on the ESP MCU anyway.

I have chosen to overwrite the MAC addresses of the blasters with 0x00 to 0x0F (0-15). This isn’t really required and I already had multiple people complaining about this: “They already have unique addresses.” But in my eyes it makes things easier to handle. Take it or leave it, anybody can change my lousy code once it is released. 😉

I still have some headaches with audio, the ferrit beads don’t change anything except from consuming a lot of space, completely useless because without any effect. Not to mention that it is a real pia to get sound working on the server parallel to the lvgl graphics stuff. It is possible by moving the elements to seperate tasks but it still isn’t really good. The server doesn’t need to play any fancy sounds, just some beeps but that seems to be more difficult than playing a wav. Wav playing works but the DAC output is way lower than pushing a simple tone() to that pin, and the start game / end game signals need to be loud enough to hear them in 100m distance. Of course the blasters could signal too but that might end in a multiple sound chaos due to delays in start command receiption. Anyway, I am on it.

ATTAG audio and wifi update

Now I spent like two weeks on the I2S audio stuff and I still can’t get it to work, I know it is sort of functional on the physical basis so it is okay how it is connected to the PCB but I think I’ll just put that aside for a moment because I am just too dumb for the code.

That just stops me from further progress and at least I got some audio working with the DAC path. I’ll just get back to I2S once I am done with the rest. The DAC stuff is far from ideal, especially about the noise and every electronical way to get rid of interference just didn’t turn out what I expected. I am still waiting for some ferrit beads to add, the capacitors mentioned in the PAM specs actually don’t make much difference.

For the WiFi communication it is a comparable situation, the LR mode simply doesn’t work and I don’t wanna wait until someone drops an eye on it at espressif. So I’ll do a step back and try ESP-NOW which should be able to achieve ranges around 200m outdoor and maybe even 50m indoor. I just hope this works better with the current espressif package than LR.

Meanwhile I ported the blaster code to platformio just as the server code. So at the end noone has to switch between Arduino IDE and Platformio. I’ll get more into detail how to use the code, once this is at release level. It will contain heavy inline documentation for almost every line of code, so even nobrainer like me can get it to work. 😉

ATTAG – multiple IR receivers #2

I was testing the IR receiption using the IRMP lib with the D32 board now and it turns out it got the same issues like the S3, but at least it works in single core mode. However as soon as you try to put the IR listening to the second core, the D32 ends in a boot loop.

There probably is a way to fix this but meanwhile I put focus on the secondary microcontrollers für IR receiption. In the last post I attached a picture with a set of possible candidates. I suggest to drop those without TX/RX capabilities which are the ATTINY variants and go for one of the ESPs. The ESP-01 is the cheapest variant and got all required I/O to get the job done. Any other ESP8266 or ESP32 will do too but are actually an overkill for the small task.

Why TX/RX? It is the simplest way to send the information to the main board, for an ATTAG 2.0 version those could even communicate via wifi, so a hit receiver on a helmet or backpack wouldn’t require a cable. But that is nothing for the first release version. My lasertag experiences tell me additional hitpoints are not really important. As long as all players play fair, not covering the IR receiver.

Since it also needs to provide information who actually shot just an 0 or 1 isn’t enough. That is where the TX/RX comes in handy. All receivers will be connected to RX of the main board then, giving the opportunity of a flexible number of detectors.

Here the cleaned up breadboard with one working IR receiver ESP-01 connected to RX of the D32 board. Two things left to test, then I’ll get some PCB for a “release candidate”. First thing to test is the shutdown/wakeup of the PAM audio board. The static noises are just annoying so it makes sense to activate the amp only when it is required. I am not sure if the switiching will be fast enough though. Up to now I could just switch it off but not reenable it. Other way of course using some capacitors. Second, the IR sender. I had some working circuit already but it was a bit overkill and required two more diodes, the TIP120 is too big so I’ll go a step down to a smaller transistor.

much cleaner now… 🙂

ATTAG – some fun today

… wait, where does the white wire belong? 😉

Even though this works until now, I really need to put this on a double size breadbord and use short connecting wires.

However with this chaotic wiring I already checked the following:

  • I²C Display – working
  • I²C FRAM – working
  • ID Pot – working
  • Multi-Core with digitalread – working
  • DAC sound with PAM amplifier – working
  • WLED lights – working

ATTAG – how to for multiple IR receivers

The IR detection got one problem which needs to be solved, the IR libraries are only able to receive at one pin. Which means technically it would be possible to hardwire multiple reveivers but then there is risk of mixing valid and unvalid signals and it is never possible to detemine where you have been hit.

So I am going to try to get the source done to read from one pin directly connected to the mainboard plus an optional feature to read from other hitpoin pins.

This however requires the receivers to run on their own circuit.

For this you will be able to choose from a large variety of boards that can be programmed with Arduino IDE. Basically the one the right here ATTINY85 (with the chip missing) will most likely do. Others need a programmer, such as the second in the row. So it will be up to you what to choose, I’ll test this with multiple of these little friends, the ESP32 variations will be a total overkill though.

ATTAG – waiting for D32

While I am waiting for the D32 as S3 replacement I already made the PCB for it, but before I get a sample of that I am going to check if it works with the pins I have chosen. This is a hybrid board for either I²S sound or the internal DAC using a PAM8302A amplifier. It doesn’t make a big difference in the price but maybe some of you want to pick what you already got. It also still got the HC-12 433MHz in mind, just in case it comes handy in the future again. Currently there is no fix for the WiFi LR mode available but maybe I have better luck with the D32 on this too. The sound of the I²S board is far better than on the 8KHz internal DAC though it requires more memory for higher quality sounds. I don’t want to add external memory even though it would be possible through the SPI interface for which I also reserved some solder eyes, just in case someone wants to use external memory. Don’t consider the circuit to be rock solid from the picture, it is an UNTESTED layout. I’ll provide the fritzing files as soon as this passed my tests and I got the first samples of it.

A nice feature of the D32 is the battery port, however the 3.7V will be probably too weak for the WLED, audio and for the IR. I am a total electronics idiot maybe it would be sufficient but I prefer a swappable battery pack like a power bank.

Auto printing a set of PDF from web on multiple printers.

While I am stuck at the ATTAG project again I had to solve a completely different problem. If you are running an online shop you probably came across the issue that you have to print different types of documents on different printers. Like product labels, invoices, shipping labels. It is pretty annoying if you have to handle multiple orders and every step requires a change of the print settings over and over again. This often leads to documents printed on the wrong printer, paper mess and so on.

So I was looking around if there are some ready-to-use solutions. And yes there are but at insane costs compared to triviality. For a long while we had a working solution that used javascript inside the pdf document to choose the correct printer. But this only worked for Firefox and after the newer generations seem to block this due to security issues.

So actually it is pretty simple but you need to create PDFs of your documents which then can be retrieved. I am not covering this part here. You may do this with FPDF or any other PDF generator on your shop server.

This guide expects WINDOWS to be used.

First step is you need to install these:

  1. A webserver package such as xampp, just the Apache webserver and php will be used
  2. Python (tested with 3.X)
  3. Ghostscript
  4. GSPrint

Since the browsers won’t allow you to execute a program on your local PC you need to let a local webserver do that. In XAMPP control you can set the Apache webserver to autostart with windows. You may have to run XAMPP with adminstrator priviledges for that!

Once you installed it, create a small print.php script containing the following:

$pyscript = 'C:\\gs\\print.py'; // the path to python print script
$python = 'python.exe'; // you may need the absolute path of python here, like C:\\programs\\python\\python.exe or wherever you installed it
exec($python." ".$pyscript, $output);
echo "Printjobs started...";

I extracted all the ghostscript / gsprint stuff to C:\gs, put it wherever you like but keep in mind where, you will need it later.

The following is the python script which chooses the correct printer per document and starts the printjob through ghostscript and gsprint. You may also use any other pdf viewer/printer for this which works with command line execution such as the PDF-XChange Viewer.

Of course you have to edit the paths, url and currentprinter according to your settings. Your python may need some packages used here, install them with

pip install requests

pip install win32api

pip install win32print

from windows command line (START-> cmd)

#!/usr/bin/env python
import win32print
import win32api
import requests

GHOSTSCRIPT_PATH = "C:/gs/bin/gswin32.exe"
GSPRINT_PATH = "C:/gs/gsprint.exe"

LOCAL_FILE = "C:/gs/invoices.pdf" 
currentprinter = "Samsung C1810 Series"
r = requests.get(url, stream=True)
with open(LOCAL_FILE, 'wb') as f:
params = '-ghostscript "'+ GHOSTSCRIPT_PATH  +'" -printer "'+currentprinter+'" -portrait -copies 1 "'+LOCAL_FILE+'"'
win32api.ShellExecute(0, 'open', GSPRINT_PATH, params, '.',0)

LOCAL_FILE = "C:/gs/slabels.pdf" 
currentprinter = "BIXOLON SRP-770II"
r = requests.get(url, stream=True)
with open(LOCAL_FILE, 'wb') as f:
params = '-ghostscript "'+ GHOSTSCRIPT_PATH  +'" -printer "'+currentprinter+'"  -portrait -copies 1 "'+LOCAL_FILE+'"'
win32api.ShellExecute(0, 'open', GSPRINT_PATH, params, '.',0)

LOCAL_FILE = "C:/gs/plabels.pdf" 
currentprinter = "Colorlabel"
r = requests.get(url, stream=True)
with open(LOCAL_FILE, 'wb') as f:
params = '-ghostscript "'+ GHOSTSCRIPT_PATH  +'" -printer "'+currentprinter+'" -portrait -copies 1 "'+LOCAL_FILE+'"'
win32api.ShellExecute(0, 'open', GSPRINT_PATH, params, '.',0)

Your printjob can now be executed from within your webshop admin, once the PDF documents have been generated, with a simple link such as

<a href=”http://localhost/print.php”>print at once</a>

That is actually all, easy as that. Good luck. Of course you can also reduce this to 2 or 1 printer or add multiple more.

EDIT: 2024-03-08

Here is another version with PHP / Viewer only, so no GS or Python required:

$url = 'https://www.yourdomain.com/yourpdf.pdf';    
$file_name = basename($url); 
if (file_put_contents($file_name, file_get_contents($url))) { 
    echo "downloaded PDF"; 
} else  { 
    echo "download failed"; 
echo "<br>";
echo "pdf will be printed...<br>";
echo 'C:\\Program Files\\Tracker Software\\PDF Viewer\\PDFXCview.exe /printto "BIXOLON SRP-770II" C:\\xampp\\htdocs\\yourpdf.pdf';
echo "<br>";
passthru('"C:\\Program Files\\Tracker Software\\PDF Viewer\\PDFXCview.exe" /printto "BIXOLON SRP-770II" C:\\xampp\\htdocs\\yourpdf.pdf', $output); 


And if this still not enough you may check out the FPDF Javscript plugin:


This embeds a slim javascript code to the PDF which then points the PDF reader to open the correct printer, it looks like this:

12 0 obj
/Names [(EmbeddedJS) 13 0 R]
13 0 obj
/S /JavaScript
/JS (var pp = this.getPrintParams\(\);pp.printerName = 'BIXOLON SRP-770II';this.print\(pp\);)

However this might not work with the inline PDF parser of the browser so it is most likely required to set the options in the browser to open the PDF in an external viewer sucher as the PDF-X Change viewer. I am not sure which other viewers are executing the script but this one does.