Electric fan control on Sd4x

A1C calibration can be modified and configured to operate all EFI-SD4x ECUs in 4 cylinder, 6 cylinder and 8 cylinder configurations.
efloth
Posts: 263
Joined: 2021 Feb 15, 22:12
Location: Sacramento CA
Vehicle Information: 1991 F150 4.9L J1X 80lb Injectors E85
1995 F150 5.8L MOB1

Re: Electric fan control on Sd4x

Unread post by efloth »

Yes, I was interpreting that all wrong. The link below helped me understand the fundamentals of the output but both examples use an external transistor. is that what you mean by TTL Logic in your diagram?

https://www.microcontrollertips.com/wha ... drain-faq/
efloth
Posts: 263
Joined: 2021 Feb 15, 22:12
Location: Sacramento CA
Vehicle Information: 1991 F150 4.9L J1X 80lb Injectors E85
1995 F150 5.8L MOB1

Re: Electric fan control on Sd4x

Unread post by efloth »

Finally figured it out! I'm using a pull-up resistor connected to the 5 volt reference pin. That is then connected to the ECU pin and the high input of the relay board. Once I implement the optocoupler circuit, I will send pictures and schematics.
efloth
Posts: 263
Joined: 2021 Feb 15, 22:12
Location: Sacramento CA
Vehicle Information: 1991 F150 4.9L J1X 80lb Injectors E85
1995 F150 5.8L MOB1

Re: Electric fan control on Sd4x

Unread post by efloth »

Got the optocoupler circuit figured out. I was able to use a bunch of available pads/traces and solder it right in. Not my prettiest work but should get the job done safely. IC is Cosmo 1010. More to come.
16754587949462793753550687613464.jpg
16754635748093224233156273100999.jpg
16754639754621460549477974246787.jpg

Code: Select all

Float (Relay On)
91	01	46	B0	Pin 24			
91	02	46	B1	Pin 23			
91	04	46	B2	Pin 22			
91	08	46	B3	Pin 21			
91	10	46	B4	Pin 20			
91	20	46	B5	Pin 19			
91	40	46	B6	Pin 18			
91	80	46	B7	Pin 17


Drain (Relay Off)		
71	fe	46	B0	Pin 24			
71	fd	46	B1	Pin 23			
71	fb	46	B2	Pin 22			
71	f7	46	B3	Pin 21			
71	ef	46	B4	Pin 20			
71	df	46	B5	Pin 19			
71	bf	46	B6	Pin 18			
71	7f	46	B7	Pin 17			
wwhite
Posts: 304
Joined: 2021 Feb 16, 15:53
Location: Victoria, BC, Canada
Vehicle Information: 1994 Flarside, XLT, 351w E4OD
SD48b, Quarter Horse, Burn2

Re: Electric fan control on Sd4x

Unread post by wwhite »

That’s awesome. That spare pad area you used is where the knock sensor chip would be on 6cyl sd47 hardware, fyi
efloth
Posts: 263
Joined: 2021 Feb 15, 22:12
Location: Sacramento CA
Vehicle Information: 1991 F150 4.9L J1X 80lb Injectors E85
1995 F150 5.8L MOB1

Re: Electric fan control on Sd4x

Unread post by efloth »

Dupe
efloth
Posts: 263
Joined: 2021 Feb 15, 22:12
Location: Sacramento CA
Vehicle Information: 1991 F150 4.9L J1X 80lb Injectors E85
1995 F150 5.8L MOB1

Re: Electric fan control on Sd4x

Unread post by efloth »

Should be able to start putting the truck back together next week. Thinking about writing the code in a super simple way. It will just be:

If fan is on and ect is below 205f (thermostat temp) turn fan off.
If fan is off and ect is above 211f turn fan on.

The relay board has selectable hi/low inputs so I have already tested wiring it to the ac clutch 12v wire with good success. I will use two relays for each input for redundancy.

Any issues with the code idea?
efloth
Posts: 263
Joined: 2021 Feb 15, 22:12
Location: Sacramento CA
Vehicle Information: 1991 F150 4.9L J1X 80lb Injectors E85
1995 F150 5.8L MOB1

Re: Electric fan control on Sd4x

Unread post by efloth »

This code worked out beautifully. I hard coded on/off setpoint values because I did not know how to reference an address this late in the code. I am not sure how to add a new reference address that would allow it.

Code: Select all

Sub_c600:
c600: ef,59,f9            call  bf5c             Sub_bf5c ();  'call datalogging routine
c603: 33,46,09            jnb   B3,R46,c60f      if (B3_R46 = 1)  { ' check if fan is on. If not skip to c60f
c606: 99,60,b6            cmpb  Rb6,60           ' compare ect with 60
c609: d6,03               jge   c60e             if (Rb6 < 60)  { 'if < 60 'if > 60 skip to c60e, turn fan off if not
c60b: 71,f7,46            an2b  R46,f7           B3_R46 = 0; }
c60e: f0                  ret                    return; }

c60f: 99,69,b6            cmpb  Rb6,69           'compare ect with 69
c612: de,03               jlt   c617             if (Rb6 >= 69)  { ' if ECT >= 69 turn fan on. skip to c617 if not
c614: 91,08,46            orb   R46,8            B3_R46 = 1; }
c617: f0                  ret                    return;
efloth
Posts: 263
Joined: 2021 Feb 15, 22:12
Location: Sacramento CA
Vehicle Information: 1991 F150 4.9L J1X 80lb Injectors E85
1995 F150 5.8L MOB1

Re: Electric fan control on Sd4x

Unread post by efloth »

This worked out great. Use the cooling fan scalars I added to adjust on/off setpoints. Make sure the on setpoint is greater than the off setpoint or you may end up with very undesirable results.
Attachments
A1C_230830 with fan patch.xdf
(297.87 KiB) Downloaded 52 times
decipha
Posts: 4797
Joined: 2021 Feb 15, 12:23
Location: Metairie, LA
Vehicle Information: Work Truck
'19 F-150 3.3L

Re: Electric fan control on Sd4x

Unread post by decipha »

very nice

so long as it works thats all that matters.

For reference not that it matters but here's the fan code I wrote for RZASA a few years back.

Code: Select all

1xab42 vector list calls 8xff28
8xff28 calls 1dcd7

1dc31 - begins vsf code
1df95 - end of vsf code
0x365 == 869 bytes of code

1xdcd7 code injected

<----deciphas fan code---->
3/19/2019 0200

:fan_disable
if vsbar > 58 , fans_off
if atmr1 > 3 , hsf
if engofftmr < 13 skip
if vbat < 11.5 , fans_off
if engofftmr < 3 , fans_off
if engofftmr > 254 , fans_off
:hsf
if !hedfhp goto lsf
if ect >= hsf_on goto hsf_rqst
if !hsf_rqst skip
if ect > hsf_off goto hsf_rqst // a/c would continue
:lsf
if !edfhp fan__ac
if ect >= lsf_on goto lsf_rqst
if !lsf_rqst skip
if ect > lsf_off goto lsf_rqst // a/c wouldn't apply anyways
:fan__ac
if !ac_rqst goto fans_off // turns off lsf normally
if !hedfhp goto lsf_rqst
:hsf_rqst
edf_ppm == xxx  // give air for idle hsf
if !lsf_rqst skip 2
pcm_pin_lsf == off // turn off lsf before turning on hsf
lsf_rqst == 0
hsf_rqst == 1
pcm_pin_hsf == on // coded inverted hsf and pin location
goto exit
:lsf_rqst
if !edfhp exit
edf_ppm == xxx // give air for idle lsf
if !hedfhp skip
pcm_pin_hsf == off // turn off hsf before turning on lsf
hsf_rqst == 0
lsf_rqst == 1
pcm_pin_lsf == on // coded inverted lsf and pin location
goto exit
:fans_off
edf_ppm!
if !lsf_rqst skip 2
pcm_pin_lsf == off // turn off lsf
lsf_rqst!
if !hsf_rqst skip 2
pcm_pin_hsf == off // turn off hsf
hsf_rqst!
:exit
f0 return


b1 74 34
9b e2 4f 34
d9 xx

b1 03 34
98 34 7c
db xx

b3 d6 ff 34
99 0d 34
d1 xx

b1 b8 34
9b 01 63 07 34
d1 xx

b3 d6 ff 34
99 03 34
d1 xx

b3 d6 ff 34
99 fe 34
d1 xx

99 00 00
df xx

99 69 79
d6 xx

b3 d2 f7 3c // load fan flags 377 bit4=hsf bit5=lsf

34 3c xx

99 68 79
d2 xx

99 00 00
df xx

99 65 79
d6 xx

35 3c xx

99 63 79
d2 xx

b3 e2 ce 34
35 34 xx

99 00 00
df xx

a1 00 04 34
c3 e8 c6 34

35 3c xx

71 ef 6a // pcm pin 19 lsf off

71 20 3c

91 10 3c

91 01 6d // pcm pin 46 hsf on

20 xx

99 00 00
df xx

a1 00 02 34
c3 e8 c6 34

99 00 00
df xx

71 fe 6d // pcm pin 46 hsf off

71 ef 3c

91 20 3c

91 10 6a // pcm pin 19 lsf on

20 xx

01 34
c3 e8 c6 34

35 3c xx

71 ef 6a // pcm pin 19 lsf off

71 20 3c

34 3c xx

71 fe 6d // pcm pin 46 hsf off

71 ef 3c

c7 d2 f7 3c

f0



its in the rzasa xdf you can enable it and disassemble it if you want the actual listing
Post Reply