Sunday, September 13, 2009

First Project (the simplest!) - Part 2

After a long time I restarted playing with servomotors to control the intake air system ram. Here my latest achievements with servo motors:



Stai tuned....

4 comments:

Unknown said...

Hi! Awsome job! First of all sorry for my pure english! :D
So I have some same project with the Aprilia ECU. At this time I'wd like to make a gear indicator. I have the RPM and speedometer signal than I'll calculate the actual gear.
But now. I use a pic microcontroller to make some A/D conversion to measure for ex. the water temperature.
How do you do this wheeling smthg?
Do you have a circuit? Can you post that?
Thanks at all!

Max said...

Hi! the gear indication is calculated by comparing the instant EngineRatio / RearWeelRatio, the code is:
uiTmp = (unsigned int) ( ((float)uiRPM_ENGINE) * GEAR_FACTOR / ((float)uiRPM_REAR) );
CalculateGear (uiTmp);
where CalculateGear is:
//****************************************************************************
// @Function void CalculateGear(uint)
//
//----------------------------------------------------------------------------
// @Description This is the function to calcuate the inserted gear
//
//----------------------------------------------------------------------------
// @Returnvalue None
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 12/27/2008
//
//****************************************************************************

void CalculateGear ( unsigned int uiG )
{
#if NEUTRAL
// Check Neutral
if ( !IO_ubReadPin ( IO_P4_0 ) )
{
uiGEAR = 0;
IO_vSetPin( IO_P10_5 ); // WEELING LED ON for NEUTRAL
}
else
{
IO_vResetPin( IO_P10_5 ); // WEELING LED OFF for other gears
#endif

if ( uiG < (GEAR_6_LIM) )
{
uiGEAR = 6;
}
else if ( uiG < (GEAR_5_LIM) )
{
uiGEAR = 5;
}
else if ( uiG < (GEAR_4_LIM) )
{
uiGEAR = 4;
}
else if ( uiG < (GEAR_3_LIM) )
{
uiGEAR = 3;
}
else if ( uiG < (GEAR_2_LIM) )
{
uiGEAR = 2;
}
else if ( uiG < (GEAR_1_LIM) )
{
uiGEAR = 1;
}
#if (NEUTRAL==0)
else
{
if ( (uiOldGEAR == 1) || (uiOldGEAR == 2) )
uiGEAR = 0; // Better to display a "dot" simbol to indicate the gear is not valid (i.e. neutral)
}
#else
}
#endif

if ( uiOldGEAR != uiGEAR )
{
iGearShift = uiGEAR - uiOldGEAR; // Store Gear Up-Down direction
}
uiOldGEAR = uiGEAR;

ucDisplayDigit[0] = (unsigned char) uiGEAR;
return;
} // End of function CalculateGear
the define NEUTRAL is a compiler define to enable the sense of the neutral signal (I have just scoped the signal that reach the usual Green Light "N"). the SW works also without since it, this is only an additional doublecheck.
Clearly the function "IO_ubReadPin ( IO_P4_0 )" read the Neutral signal from port P4.0.

Unknown said...

Thanks for the code but I use assembly... :) But now I know how to do it. The hardest part now is to find the wires for speed and rpm pulse on my bike... :)
Thanks again

Max said...

Let me know your progress...
Check on http://www.randomexploits.com/projects/ecu/home_ecu.htm the connection to the Aprilia ECU