MIMA Code Discussion - Insight Central: Honda Insight Forum
 
Go Back   Insight Central: Honda Insight Forum > 1st-Generation Honda Insight Forum > Modifications and Technical Issues

Please Visit our Site Sponsors Page
Insightcentral.net is the premier Honda Insight Forum on the internet. Registered Users do not see the above ads.

» Auto Insurance
» Featured Product
» Wheel & Tire Center

Reply
 
LinkBack Thread Tools
Old 02-03-2011, 04:33 PM   #1 (permalink)
Administrator
 
retepsnikrep's Avatar
 
Join Date: Dec 2005
Location: Thirsk North Yorkshire UK
Posts: 3,950
Send a message via MSN to retepsnikrep
Default MIMA Code Discussion

As Mike will be developing a new mima and I'll be utilising my own system I thought it would be a good idea to have some thoughts on common code problems / issues and ideas.

Mike uses assembly and now C, I use pic basic pro and a little assembly. Others are welcome to contribute with whatever language they like as it's ideas and principles that are the key here.

I'll start the ball rolling I'll be using a pic with a hardware serial usart port/pin to drive my serial lcd display for a few reasons. 1) It's not affected by interrupts in the code. 2) Once a byte has been sent to the usart then it will be sent in the background to the display. 3) It allows speed upto the max for the serial lcd of 38400 baud. 4) Only needs one pin.

I'm going to try and dispense with relays to switch over from ecm to mima signals using the MAX4619. The MCM signals will be sunk through this switch IC into the pic hopefully also avoiding the need for buffer/drive transistors.

Measuring the VSS pulses accurately will be a key to making a decent cruise control mode so ideas for that would be useful. I thought about a diode feeding an R/C filter so that the pulses charge up a capacitor which is measured by an ADC input. We could time the VSS pulses but maths can then be tricky. I'm already using pic timer1 for my software 2khz pwm. I wonder how long the cmdpwr pulses can be interupted before the mcm throws a wobbly or a change is felt by the user in motor activity?
retepsnikrep is offline   Reply With Quote
Sponsored Links
Advertisement
 
Old 02-20-2011, 12:26 AM   #2 (permalink)
Administrator
 
retepsnikrep's Avatar
 
Join Date: Dec 2005
Location: Thirsk North Yorkshire UK
Posts: 3,950
Send a message via MSN to retepsnikrep
Default

I'll post my logic analyser file here when i get a chance to capture some data. Back at work so wont be for a day or two. Mike I believe you use interrupts from the cars original signals to generate the pwm? I don't, I generate the pwm independently with no reference to the original signals. In my software flow I manipulate the three mima signals then operate the relay last. Perhaps that is the difference?
retepsnikrep is offline   Reply With Quote
Old 02-20-2011, 09:52 AM   #3 (permalink)
Senior Member
 
Mike Dabrowski 2000's Avatar
 
Join Date: Mar 2003
Location: NE CT
Posts: 3,261
Default Mima -v2

On the VSS measurement, this is basically a frequency measurement. Which is typically measured in a microcontroller by using one of the built in hardware timers to measure the number of crystal controller processor clock cycles between the rising or falling edge of the VSS pulses.
The VSS connected to one of the microcontroller interrupt pins, and generates an interrupt when it switches high or low(timer configuration).
In the ISR (Interupt Service Routine) the timer will have reached some number of counts of the precise clock cycles when the next VSS pulse interrupt happens the ISR grabs that count and puts it in a variable for later use in the speed determining routine.
The timer is reset to zero, and is restarted , and the ISR sends program execution back to what was happening when the VSS pulse happened.

Depending on the clock frequency which in MIMA is 20mhz/4 or 5mhz, one can get a very accurate time between pulses number.
As the car goes slower, the time between VSS pulses may exceed the timers max count, which generates a different interrupt.
This ISR simply increments a counter for the number of overflows, and again goes back to the program flow.
The number of overflows* the counters max count + the timers last value, * the time in microseconds of the clock , and we have the highly accurate raw speed information required for very accurate speed measurement.

The ISR takes the same number of cycles to move the count to a variable and restart the timer on each VSS pulse, so for max accuracy, you preload the timer with that number of counts so the next period accounts for the deadtime of the counter.
The VSS pulses are ~ 1mph/hz, so at 100 mph, the time between pulses would be ~ .01 sec . The counter can count at a max of 5 mhz, so we will be seeing 50,000 counts between pulses.
Of course we don't need that much accuracy, so the clock frequency can be divided by 2-4-8 times before being applied to the counter.

The pulse integration with RC filter and subsequent conversation with the A/D technique you are suggesting is ok for non precise frequency measurements will be effected by the temperature effects on the capacitors time constant, and the pulse frequency.
At frequencies below 20 HZ, the capacitor ripple will begin to effect accuracy, as will the max 1025 value that the A/d will yield.
Is that resolution and accuracy good enough?
Worth trying, but my intuition thinks it will not?

The serial LCD is a nice solution for microcontrollers with a small number of I/O pins.
IMHO That is the only advantage

The speed of update for a parallel LCD is in the micro seconds range, put data on port, toggle r/w clock once job is done, and it also retains the last data sent.
The cost of a parallel LCD is roughly half of the serial type, and is much greater than the cost of a microcontroller with the extra port pins.
Interrupts will not effect the parallel updates, but could do so if one occurs during the much longer serial write? One can update the display right after a VSS interupt, to potentially solve that issue, but that depends on the number of serial writes required for the screen update as well as the BAUD rate.

I will try to incorporate both display interfaces on what I build.


OK this will be the new place to discuss the next generation MIMA.
Let me start by thanking all the people that are enjoying MIMA, and want you to know that anything that is developed for MIMA -V2 will be designed to be backwards compatible .

Two heads are better than one, and 160 should be great, with all of the people driving around with MIMA, I hope we can tap into their experience with MIMA to make MIMA-V2 all it can be.

Like any product, field trials are the best way to determine what was a good idea and what was not.
(IMA battery issues is a good example)
Lets keep what is good, and fix what is not good.
When we are at the 2015 insight gathering, the goal will be that everyone there will have a MIMA controller in their Insight.

Getting the cost down so the basic IMA control technology will be available for a price that many more people can afford, and for a price where it can be made for a modest return on cost to produce it.

Making the install as simple as possible.

Redefining the user interface which Peter has so nicely began to do, will also be high on the list.
MIMA started back in 2005, and here we are 6 years later beginning the next generation of the system.
Should be fun.

Last edited by Mike Dabrowski 2000; 02-20-2011 at 10:55 AM.
Mike Dabrowski 2000 is offline   Reply With Quote
Old 02-23-2011, 03:57 AM   #4 (permalink)
Administrator
 
retepsnikrep's Avatar
 
Join Date: Dec 2005
Location: Thirsk North Yorkshire UK
Posts: 3,950
Send a message via MSN to retepsnikrep
Default

Interesting Mike food for thought.

I managed to capture some data using my logic analyser and learnt a few things. Others can view the data if they download the free software from here. The files are recorded using V1.14. Downloads

My data file is here. I'm using my own version of IMA control.

www.solarvan.co.uk/Logic/MIMADATA230211.zip

I captured the following sequence.

Analyser on.
Ignition on
Engine start and tickover
Regen for a couple of seconds at tickover
Back to idle
Assist for a couple of seconds at tickover
back to idle and Ign Off.

As a refresher Mike's MIMA and my own IMA control use the below rules.

Quote:
The Insight ECM sends CMDPWR 2khz 50% duty cycle pulses to the MCM to tell it to assist(>50% duty) or charge(<50% duty cycle)

The ECM also pulls the MAMODE 2 signal low when in the assist mode, and it is high when in the regen mode.

The ECM replaces the 20KHZ 50% duty cycle MAMODE 1 signal with a 20KHZ 25% duty cycle signal when assist is desired.
The signal is noisy especially when regen is turned on as that is emi/rf nightmare. But it is quite easy to see through the mush and work out what's happening.

Interesting before the engine is started the MAMODE1 signal is at 25% duty i did not expect that. Mamode 2 is high and CMDPWR is 50% expected.

During the start cycle when IMA is spinning motor up CMDPWR remains at 50% but MAMODE1 goes to 75% duty and MAMODE2 goes low. The MAMODE1 behaviour was unknown to me here, I thought it was always either 50 or 25%. The way the IMA spins up is much more aggresive than trying to command assist with my own IMA so that may be useful for a quick start! Command the start up cycle then straight into max assist. Anyway food for thought.

At around 10.4s I dial up 5A of regen for a few seconds. You can see this easily as noise on the other channels is very apparent.

At around 17s I dial up 10A of assist for a few seconds.
retepsnikrep is offline   Reply With Quote
Old 02-23-2011, 09:56 AM   #5 (permalink)
Senior Member
 
Join Date: Apr 2005
Posts: 495
Default Analyser files

Ran the viewer, take your point about noise corruption on the signals distorting and interfering with the duty cycles during regen and assist.

It make me remember about looking into opto isolators and fibre optic lines as conductors of the signals, we had problems at work with a laptop monitoring a railway signalling computer system, one of the options was a fibre optic modem between the the two. In the end they used an RS485 /RS232 convertor with a high specification for DC isolation between the systems
__________________
London UK.

Last edited by E27006; 02-23-2011 at 10:11 AM.
E27006 is offline   Reply With Quote
Old 02-23-2011, 10:06 AM   #6 (permalink)
Senior Member
 
Mike Dabrowski 2000's Avatar
 
Join Date: Mar 2003
Location: NE CT
Posts: 3,261
Default

Peter,
I am using the logic displaysoftware for the first time, so maybe I am missing something?
I see the time at the top of the data only goes from 0 ms to 2840ms?
You are talking about the events at 10 and 17 seconds?
How do I get the whole file to display?

Also what are the other channels showing?
It may be useful to acquire the rpm (NEP) signal so we can see what the engine is doing?
Is the viewer different that the actual Logic software?

Last edited by Mike Dabrowski 2000; 02-23-2011 at 10:46 AM.
Mike Dabrowski 2000 is offline   Reply With Quote
Old 02-23-2011, 10:48 AM   #7 (permalink)
Administrator
 
retepsnikrep's Avatar
 
Join Date: Dec 2005
Location: Thirsk North Yorkshire UK
Posts: 3,950
Send a message via MSN to retepsnikrep
Default

Mike

I didnt acquire any other signals on this occasion as I would need to hack more wires to do so. I will get round to it later. We are both only using the three main signals so I only looked at them. I have no problem with regen/assist at tickover.

You can zoom in/out by right or left clicking the screen if I remember correctly, try the help. I'm at work so can't assist at present. I'm using the software I linked too below.

Malcolm
The nosie mush is the sensitive analyser problem, I doubt it has any effect on the pwm operation or the cars would have ground to a halt long ago. I also tried tying all the unused analyser signal inputs to gnd and that made no difference. I don't think we need to bother with isolation. I can see enough through the mush at present. Adding the anaylser wires also increases the emi pickup ironically.

I have adjusted my IMA control software to fine tune the regen when engine is ticking over. I can now adjust the duty up/down by 1% at a time to get max regen without stalling engine. This uses the 5 way joy button.

Press button right gives the 4 levels of assist in 25% steps
Press button left gives the 4 levels of regen in 25% steps
Press button up when above assist or regen active increases assist or regen by a further 1%
Press button down when above assist or regen active decreases assist or regen by a further 1%
Pressing button in toggles between the rally max power on throttle press mode and the above fixed levels of assist/regen control.

Last edited by retepsnikrep; 02-23-2011 at 11:03 AM.
retepsnikrep is offline   Reply With Quote
Old 02-23-2011, 11:07 AM   #8 (permalink)
Senior Member
 
Join Date: Apr 2005
Posts: 495
Default signals during starting

Very interesting file. Please can we have some more!

The % figures quoted are taken from the analyser, click the small cog icon and you can select duty cycle as a parameter to measure

At 5850.4 msecs, Mamode1 goes from 16% duty cycle to 86% and at the same time Mamode2 goes high (regen) to low (assist) getting everything ready to deleiver power to the IMA motor spinning up the engine

6702 ms to 6703 ms is (I think) the changover point where the IMA motor has started the engine.Mamode2 changed from low(assist) back to high (regen), the duty cycle of Mamode1 changes from 84% to 54%

6702ms minus 5850ms = 150mSec. Isn't that the time period quoted in one of the Honda publications for Autostop restart?
__________________
London UK.

Last edited by retepsnikrep; 02-23-2011 at 11:40 AM. Reason: Corrected signal name error
E27006 is offline   Reply With Quote
Old 02-23-2011, 11:11 AM   #9 (permalink)
Senior Member
 
Mike Dabrowski 2000's Avatar
 
Join Date: Mar 2003
Location: NE CT
Posts: 3,261
Default

reset, I had not unzipped the file, so I was looking at the zipped data, which was totally bogus.



Now I can see everything.
One thing that I notice is that your MAMODE 1 and CMDPWR drop out for 1 ms when you change things. I don't believe that happens in my code, or on the stock signals?
Could that be what is allowing regen in idle?

Last edited by Mike Dabrowski 2000; 02-23-2011 at 11:43 AM.
Mike Dabrowski 2000 is offline   Reply With Quote
Old 02-23-2011, 11:46 AM   #10 (permalink)
Administrator
 
retepsnikrep's Avatar
 
Join Date: Dec 2005
Location: Thirsk North Yorkshire UK
Posts: 3,950
Send a message via MSN to retepsnikrep
Default

Nice to have your input Malcolm.

I suspect the noise might uspet the pwm measurement option a bit.

The Mamode2 simple high/low signal is high for regen/standby and low for assist. If you say high = regen only we may get confused.

If you are right about the 150ms spinup time that's very interesting. I wonder if it is rpm limited and only spins engine at say 1000-1500rpm? I believe you do get an error code if engine does not start within a few seconds of IMA cranking.

I have noticed the starting is a bit more energetic since the power mods as it is developing more power/torque
retepsnikrep is offline   Reply With Quote
Sponsored Links
Advertisement
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Powered by vBadvanced CMPS v3.2.2

All times are GMT -4. The time now is 04:36 PM.



Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Content Relevant URLs by vBSEO 3.3.2