Jump to content
Sign in to follow this  
abecedarian

Hercules engine control

Recommended Posts

I want to avoid splicing wires in the harness so I am routing 5v to the sensors, and grounds for those that need it. Current count is (besides 12v in and ground...):

Sensors (analog):
TPS (throttle position) = 5v, ground, signal.
MAP (manifold absolute pressure) = 5v, ground, signal.
IAT (intake air temp) = 5v, signal.
CLT (coolant temp) = 5v, signal.
FPRS (fuel pressure) = 5v, signal.
O2 (oxygen sensor) = signal.
OPRS(oil pressure) = 5v, signal.
So, 15 connections there.

Sensors (digital):
VR1 (crank sensor) = VR1+, VR1-.
VR2 (cam sensor) = VR2+, VR2-.
IGN (ignition) = IGN (input).
5 connections.

Output (digital):
INJ1 = 12v out.
INJ2 = 12v out.
INJ3 = 12v out.
INJ4 = 12v out.
IGN1 = 5v out.
IGN2 = 5v out.
IGN3 = 5v out.
IGN4 = 5v out.
SYSR (injector / ignition relay) = switched ground (?).
9 connections.

Output (analog):
FPCTRL (fuel pump control) = 12v (motor speed control).

CAN = CANH and CANL.

Hmm... maybe I should tie some grounds together, and maybe target fewer cylinders....

My bike only has two but it'd be nice if some of the 4 bangers could use this too. :)

Nah... they can run two batch fired injector banks and wasted spark. ;):P:D

Share this post


Link to post
Share on other sites

Did some soul searching and unless 47uF / 60V tantalum capacitors come down in price, I'm not doing the Infineon thing. ~$70 USD EACH at Digikey.
And I mean that, considering the cost of the board, when I have it made, and the cost of other components, and assembly... I could have probably bought an aftermarket EFI kit like Microsquirt, and rob myself of the satisfaction of saying "I built this. :D".

Share this post


Link to post
Share on other sites

Well, I figure if I'm re-doing things, might as well go for BP compatibility, (Energia cross-references):

 

IAT is on A0 (F5529) or A7 (Stellaris / Tiva C) - intake air temperature

TPS is on A1 (F5529) or A6 (Stellaris / Tiva C) - throttle position sensor

MAP is on A2 (F5529) or A5 (Stellaris / Tiva C) - manifold absolute pressure

5v ref is on A5 (F5529) or A11 (Stellaris / Tiva C) - sensor reference voltage

O2 is on A6 (F5529) or A8 (Stellaris / Tiva C) - oxygen sensor return (and may not be implemented)

CLT is on A3 (F5529) or A4 (Stellaris / Tiva C) - coolant temperature sensor

FPRS is on A4 (F5529) or A2 (Stellaris / Tiva C) - fuel pressure sensor

OPRS is on A12 (F5529) or A1 (Stellaris / Tiva C) - oil pressure sensor

 

Haven't settled on the VR sensor inputs, but they're pulled up and go low when high-to-low zero crossing occurs... I think... so any GPIO pin that can generate an interrupt should work, and the timers will go buck nutty, as will my head.

 

Damn... I hope I got that correct. If I didn't, there'll be at least one person mad at me: ME! ;)

Share this post


Link to post
Share on other sites

Okay... quick run-down:
post-256-14264605372894_thumb.png

 

As it sets, no unrouted traces; board is ground fill layer top and bottom.

 

Lower left: reverse protection with a P-channel mosfet to keep power off the board if it's backwards and cute LED's to light 'green' if correct and red if wrong polarity; power plane top and bottom with vias to help dissipate heat.
Lower right: MAX9926 variable reluctor sensor interface chip; buffer op-amps above that for reading sensors.
Center: 5v regulator (left) and 3.3v regulator (right) based on TI Webench recommendations.

To do:
Maybe add a fuse. :unsure:
4 low impedance (2-5 ohm / 5A) injector drivers (switched ground).
4 CMOS level ignition drivers.
1-3 relay driver(s) to switch 12v source to the injectors, ignition and other systems. *
1 combined (one or the other) relay driver / PWM motor control for fuel pump pressure control. **

Fix what I messed up 'cause I'm not experienced.

* May rely on relay switched by the main key switch to do this.
** Fuel pump drive will be 5v to switch an external relay if the engine has a return on the fuel pump to the tank or will PWM control the fuel pump via an external controller if the fuel system is return-less, based on programmed manifold pressure values and desired fuel pressure. I think a half-bridge control would work, but would need some sort of 'brake' if the throttle is closed quickly so that too much residual pressure doesn't accumulate and can't be bled off by the injectors.

Anyone want to jump in and help? ;):D
Eagle schematic and board as well as PDF's (I hope) of the Webench generated power supplies attached.

HerculEFI.zip

3v3_V2.pdf

5v0.pdf

Share this post


Link to post
Share on other sites

Hi! This is a cool project, lots of work! I like that you share your iteration steps, very interesting to see.

 

Why do you use a seperate 3.3V supply? TI Hercules should have a 3.3V supply on board.

 

Your reverse voltage protection is a good idea with this mosfet but might be a little oversized. In most cases a reverse protection diode will do the job.

 

For the relay drivers I can reccomend just simple MOSFET switched controlled by 3.3V - BSS123 is a good type to start.

 

With DC motor half bridge driving you can use regenerative braking by activating the upper MOSFET, energy flows right back into your 12V battery.

Share this post


Link to post
Share on other sites

@ - Thank you for the compliment. I know I'm significantly challenged by using the free version of Eagle: 2 layers, limited board size being the biggest issues. That's why I keep posting revision this or that; acts like a journal of sorts, and if someone has an idea they're welcome to comment.

 

Separate 3.3v supply (and 5v even) because I don't see the need to have some parts of the board powered unnecessarily. And the 5v because the sensors can draw a fair bit of current and I've yet to find suitable 3.3v replacements. Eventually, I'd like to develop this into a full stand-alone, configured and updated over CANBUS. I also keep looking at the multi-output supervisor chips TI like the one on the LP; little steps but I can dream. :)

 

I thought about a reverse protection diode, like Schottky but being oriented at a motorcycle, the cranking voltage can drop to below 6 volts under some conditions so the voltage drop across the diode could be enough to trigger LDO, or at least that's my assumption. For me, I'd probably forgo protection, but if I were to offer boards to others, I'd likely add it.

 

Thanks for the recommendation for the MOSFET. I'll look into that.

 

I doubt I'd get much back from regenerative braking in the fuel pump due to it's comparatively low inertial mass but it's an interesting thought.

 

Thanks for the comments. :D

Share this post


Link to post
Share on other sites

I think I'm going to change to 80 pin Molex CMC for the board / harness connection. Before I do, though, I'm ordering some things to check.

 

In other news, I've re-visited the LP schematic and see little reason to not bring 5v to the board and let it do the 3.3v regulation itself. Not sending 5v appears to negate some of the functions the board was 'designed' to demonstrate.

 

However, I wouldn't expect it to run an engine from USB power alone. So, if installed on an engine being tuned, it's not that hard to provide galvanic isolation between the device and its surroundings.

 

I'll order the connector once I have a BOM settled on for the few things remaining constant over the various revisions, adjustments and brain farts.

Edited by abecedarian

Share this post


Link to post
Share on other sites

Keep getting frustrated by routing and various other things like 2-layer limit and Eagle lib's for parts I want to use don't exist, and I suck at making them. :( Maybe I'm looking at this wrong, but it's hard to do software when the hardware isn't even ready, right?

 

Yes, I'm whining. Don't reply. ;)

Share this post


Link to post
Share on other sites

Taking a break from looking at boards and stuff; thinking about how to make it work effectively... and I think I'm being just as convoluted as ever. :D

 

I think I'm going to go with treating the engine as a single, 720 degree cycle, initiated by cylinder 1's camshaft trigger. Cylinder 2 events will be offsets from cylinder 1 by 440 degrees. I mean, since I know cylinder 2 is 80 degrees offset from cylinder 1, that means cylinder 2 ignition fires 440 degrees crank rotation after cylinder 1 ignition (360+80), and cylinder 2 fuel fires similarly after cylinder 1 fuel. The 'offset' will likely be programmable so that other than 80 degree offsets can be accommodated (for those who are adventurous).

 

Don't know if this will make sense, but I tried to 'graph' what I mean.

The below represents 4 crankshaft revolutions, from 0 to 720 (2 revs) and again, 0-720.

Assume constant RPM and load:

0 on the scale is when the cam sensor for cylinder 1 is triggered; scale is 'degrees';

A = injector 1; B = injector 2; injectors fire at TDC compression stroke for that cylinder;

1 = ignition 1; 2 = ignition 2; ignition for both cylinders is 20 degrees advanced 'ahead' of top dead center.

0_____120_____240_____360_____480_____600_____0_____120_____240_____360_____480_____600_____720
+------+-------+-------+-------+-------+------+------+-------+-------+-------+-------+-------+
A------|-------|-------|-----B-+-------|------A------|-------|-------|-----B-|-------|-------+  << Injector events
+------+-------+-------+-------+-------+------+------+-------+-------+-------+-------+-------+
+------|-------|-------|----2--|-------|-----1|------|-------|-------|----2--|-------|------1+  << Ignition events
0_____120_____240_____360_____480_____600_____0_____120_____240_____360_____480_____600_____720
So, "A", injector, fires when the camshaft sensor trigger is detected, and "B" injector fires 440 degrees later; "A" injector fires again just before the start of the next 'cycle'.

 

 

I think one timer to measure from cam trigger to cam trigger, the controller detecting both rising and falling edges of crank tooth signals and a timer to measure between each crank trigger edge would work.

 

Since the crank trigger 'gear' has 32 teeth, that's 11.25 degrees between tooth centers, or around 5.625 degrees between rising and falling signals. So, even if the tooth timer can only fire off 10 'clicks' between rising and falling, and vice-versa, that amounts to 0.5 degrees accuracy, give or take; 100 'clicks' between only makes it better. If the frequency of that timer could be tied, somehow, to RPM....

 

More thinking to do... more to come.

Share this post


Link to post
Share on other sites

RE: Injectors.

Since I have the need for low impedance injectors, I'm going to use two of the venerable LM1949 injector drive controllers. It drives an NPN Darlington, and does peak and hold (high initial current, then low current). It will also drive high-impedance injectors without issues. :D

Share this post


Link to post
Share on other sites

...

0 on the scale is when the cam sensor for cylinder 1 is triggered; scale is 'degrees';

A = injector 1; B = injector 2; injectors fire at TDC compression stroke for that cylinder;

1 = ignition 1; 2 = ignition 2; ignition for both cylinders is 20 degrees advanced 'ahead' of top dead center.

 

 

 

 

0_____120_____240_____360_____480_____600_____0_____120_____240_____360_____480_____600_____720
+------+-------+-------+-------+-------+------+------+-------+-------+-------+-------+-------+
A------|-------|-------|-----B-+-------|------A------|-------|-------|-----B-|-------|-------+  << Injector events
+------+-------+-------+-------+-------+------+------+-------+-------+-------+-------+-------+
+------|-------|-------|----2--|-------|-----1|------|-------|-------|----2--|-------|------1+  << Ignition events
0_____120_____240_____360_____480_____600_____0_____120_____240_____360_____480_____600_____720
So, "A", injector, fires when the camshaft sensor trigger is detected, and "B" injector fires 440 degrees later; "A" injector fires again just before the start of the next 'cycle'.

...

 

A few thoughts to add:

 

- Injector duration will go from approximately 1.2ms (0.8% duty) at idle to 10ms (91% duty) at 11000 RPM. 11000 RPM equals ~183 RP/second, which equals ~5.5ms per revolution. As each injector fires every-other revolution, that gives an ~11ms 'window' where the injector can fire and not overlap the next injector firing cycle. Also should state this is 'worse' case and the injector duration will likely be less than 10ms because the fuel pressure will rise as the turbo builds thus increasing the amount of fuel injected each event.

- Ideally, I'd like to have the injection events start so that they are done before the respective intake valves close. So instead of hard-fast events, they would slide based on engine RPM / injector duration.

 

- The ignition coils I'll be using, as mentioned, use a 5ms logic level transition to fire: controller brings level high, then 5ms later takes it low and the coil fires. If the level stays high too long, more than ~8ms, the coil auto-fires to keep itself from burning out. So, this 5ms 'pre-charge' must be initiated before the coil actually needs to fire.

 

Still thinking.

And am contemplating a trial run on an F5529 LP since I'm a tad more familiar with that than ARM, and it has similar 40 pin BP connections as the Hercules.

Share this post


Link to post
Share on other sites

Pretty slick thread here, I haven't been paying close attention but just caught up on the last page or so.

 

I agree regen braking isn't worthwhile since this isn't an electric motor-driven M/C, just gasoline...

Seeing now that TI has sourced stackable headers that don't *suck*, i.e. the pins are beefier, I sort've wished TI used those in the Hercules LP instead of the non-stackable type.  Having the option of a "baseboard" that the LaunchPad plugs *down* onto sounds like a great way to integrate it into bigger projects.  Hot air could probably take care of that though.

 

I'm working on an MSP430-based deluxe alarm clock + USB tablet charger, and my plan right now is to build the power circuitry & I/O & RTC into a baseboard which the F5529LP will mount onto.

Share this post


Link to post
Share on other sites

Decided I want the MAP sensor on board. No particular reason, and will probably route to the connector for an external sensor. Other things are placed, floating, 'cause I'm not sure what to do with them yet.

 

post-256-14264605401819_thumb.png

 

Need to do some reverse connection protection things, I think, and bring TPS, CLT, and IAT to the board. Fuel pressure, for now, I'm going to leave off-board to mechanical means, and might have a simple oil pressure switch (off / on type) for safety, but still off-board.

 

Next, need to generate an Eagle part for the LM1949 chip. If anyone can come up with a suitable alternative solution for that and the TIP Darlington things, I'd appreciate it. I do not like the idea of a lot of switching noise going on. ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×