Required:
Sinden Lightgun(s)
atmega32u4 based arduino(s) like Pro Micro, Arduino Micro, Leonardo
Pi4, Pi4 power
Optional Pi4 hdmi cable and USB keyboard to tweak settings if required
SD card
SD card reader for PC to flash bare bones image or pre-built PS2 image when ready
DuPont wires (probably female to female)
OSSC or RetroTink 5x Pro - MinimOSD low cost composite alternative will be documented soon
USBasp arduino programmer - only required if need to update the arduinos more than once, for example if an improved version of the hex is released


Steps:

Upgrade Lightgun(s) to v1.6 firmware in windows software
Use HarryDog's bare bones for the Pi

Inside RetroPie tab select raspi-config
Go to interfaces
Enable serial port
BUT don't enable console over serial port
Save Exit

Now enable the 2nd GPIO serial

Go onto command line

cd /boot
sudo nano config.txt
add this line to the bottom:
dtoverlay=uart5

Now 2nd serial appears on: 
/dev/ttyAMA1

now set the applications to load on start up:

cd /opt/retropie/configs/all
sudo nano autostart.sh
add the following at the start

cd /home/pi/Lightgun/Player1
sudo mono-service LightgunMono.exe
cd /home/pi/Lightgun/Player2
mono-service LightgunMono2.exe

save and exit
*note, only one has sudo on purpose

Now point lightguns to use serial:
cd /home/pi/Lightgun/Player1
sudo nano LightgunMono.exe.config
Change secondary serial to:
"/dev/ttyS0"
Make sure it points to "/dev/ttyACM0" for the first lightgun

Now point second lightgun to use serial if applicable:
cd /home/pi/Lightgun/Player2
sudo nano LightgunMono2.exe.config
Change secondary serial to:
"/dev/ttyAMA1"
Make sure it points to "/dev/ttyACM1" for the second lightgun


I recommend setting the outputs in the configs to the following for PAL:
Offset for PS2 PAL recommended
<add key="OffsetX" value="-3.25" />
<add key="OffsetY" value="0" />
<add key="OffsetXRatio" value="1.07" />
<add key="OffsetYRatio" value="01" />

Not sure about NTSC
One user had the following
<add key="OffsetX" value="3.3" />
<add key="OffsetY" value="-2" />
<add key="OffsetXRatio" value="1.01" />
<add key="OffsetYRatio" value="0.90" />


This is the Pi sorted, that image should now boot and autostart the lightguns

To program the Pro Micro use the Sinden Lightgun windows application, on the select lightgun.  It is recommended not to have your Sinden Lightguns connected to your windows PC in case you damage their firmware.

Connect a pro micro via USB to the PC.  Choose the com port in the bottom right of the select lightgun tab.  Select Guncon2 and Flash Arduino.  When finished that pro micro should be ready.  Do this for 2 arduinos if required.  If you need to program the arduino more than once you have to use a programmer, I recommend a cheap one like a USBasp.

You need to connect the pro micro RX to a Pi4 TX, and also a pro micro ground to a Pi4 ground.  It is recommended to use simple DuPont wires for this purpose.

Lightgun1 is on GPIO14 also known as pin8, there is a ground on pin 6 or pin 14 you can use.
Lightgun2 is on GPIO12 also known as pin32, there is a ground on pin30 or pin34 you can use.

Connect each pro micro to the PS2 usb.  If working they should be detected and show calibration screen.

On the guncon2 calibration screen you must hold dpad down while shooting on the calibration screen.  If your alightment is off, hold dpad left for 3 seconds until the cursor freezes.  Then shoot the cursor.  They should now perfectly align.  If you have misalignment at the sides of the screen you need to change the offsets referenced above.

Use an OSSC or RetroTink 5x Pro to add a white border for the lightgun to track.
