Update:I hope the block diagram I attached earlier is now showing.
part numbers listed, but the mosfet is not working as expected. I think my implementation is incorrect because -the relay should be connected to the drain of the mosfet and not the source -even then the mosfet will not switch 2A, 24V to the relay, because then 24V will always be going to the relay
Question: How do I switch on/off 24V, 1A to the EM relay based on the RPI GPIO output?
Update: The 24V relay is fixed, I cannot replace it with a relay module with built in optocoupler.
Concept: Double the 12V suppply to 24V using voltage doubler.
1)'244 buffer from RPI GPIO to increase current
2)opto isolator module from sparkfun datasheet at https://www.sparkfun.com/products/9118 for DC/AC decoupling
3)N channel MOSFET datasheet at https://www.mouser.com/datasheet/2/196/Infineon_IRLB8721_DataSheet_v01_01_EN-1228534.pdf
4)12V to 24 V voltage doubler module datasheet at https://www.amazon.com/Voltage-Regulator-Converter-Waterproof-Transformer/dp/B07V7F93JP/ref=sr_1_4?dchild=1&gclid=CjwKCAjwrPCGBhALEiwAUl9X03GnzvJ8ZT_VVP-ML0_LN_-DjpyOVnPXw9QF5003Lh_7ovsw4Q3bXRoCDQcQAvD_BwE&hvadid=232502440548&hvdev=c&hvlocphy=9032020&hvnetw=g&hvqmt=e&hvrand=9930756018523692093&hvtargid=kwd-302991713261&hydadcr=18917_9698850&keywords=12v%2Bto%2B24v%2Bdc%2Bdc%2Bconverter&qid=1625075949&sr=8-4&th=1
5)24V relay Specifications: Relay Type: General Purpose Coil Voltage: 24VDC Switching Voltage: (250VAC, 30VDC) Max Contact Form: SPDT Contact Rating (Current): 30A Coil Type: Non Latching