03-22-2008, 11:39 AM
|
#81 (permalink)
|
Master EcoModder
Join Date: Dec 2007
Location: Norfolk, Va. USA
Posts: 869
Thanks: 14
Thanked 33 Times in 28 Posts
|
Give me e few days
O.K.
DCB, I'll get to work on the vehicle info you requested. I know not how long it will take.
But,
after researching the Arduino i have found that i am even more at a loss than i was before.
I have no idea how to run the rs323 or usb programming stuff.
SO
after all is said and done someone is going to have to be willing to give me step by step instructions, in plain language, for the programming process.
I don't own a laptop either. I think it would get in the way of safe driving anyhow. I would rather buy a Palm thingy.
or a *duino [as soon as you tell me how]
I can even research through my shop computer (Mitchell On Demand 5.5) which wires need to be tapped for injector pulse and vss pulse.
You just tell me
Make
Model
Year
Engine
VIN [optional]
S.
__________________
When you are courting a nice girl an hour seems like a second. When you sit on a red-hot cinder a second seems like an hour. That's relativity.
Albert Einstein
|
|
|
Today
|
|
|
Other popular topics in this forum...
|
|
|
03-22-2008, 11:48 AM
|
#82 (permalink)
|
Batman Junior
Join Date: Nov 2007
Location: 1000 Islands, Ontario, Canada
Posts: 22,527
Thanks: 4,078
Thanked 6,976 Times in 3,612 Posts
|
Schultz:
You're pretty much the "ideal customer" - the type of person I envision will be most likely to build one of these gauges.
The end goal is to provide a person like yourself a detailed recipe on where to go to buy or order the components, how to put them together, download & install the programming, and then operate the device.
|
|
|
03-22-2008, 12:13 PM
|
#83 (permalink)
|
nut
Join Date: Dec 2007
Location: Southen West Virginia
Posts: 654
Thanks: 0
Thanked 37 Times in 26 Posts
|
if you guys want an atmel based system to chew on here is a programmable nitrous controller I wrote that is based on rpm and uses pwm to drive a solenoid. It uses an atmega32 and 4x20 lcd with 4 buttons. The menu interface is very simple and can do anything you can imagine, it is on the bottom half of the code. This was written in Codevision AVR C
Code:
/*********************************************
This program was produced by the
CodeWizardAVR V1.24.0 Standard
Automatic Program Generator
© Copyright 1998-2003 HP InfoTech s.r.l.
http://www.hpinfotech.ro
e-mail:office@hpinfotech.ro
Project :
Version :
Date : 1/22/2005
Author : Rick
Company :
Comments:
Chip type : ATmega32
Program type : Application
Clock frequency : 16.000000 MHz
Memory model : Small
External SRAM size : 0
Data Stack size : 512
*********************************************/
#include <mega32.h>
#include <delay.h>
#include <stdio.h>
// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x15
#endasm
#include <lcd.h>
// Declare your global variables here
unsigned long int timecount = 0; //global time counter
unsigned long int period;
unsigned long int time, oldtimecount = 0;
unsigned int rpm = 0; // engine rpm
unsigned int pulsecount = 0;
char lcd_buffer[16]; // LCD display buffer
char display = 1;
char Key = 0, menutimer = 0,per = 0;
eeprom unsigned int pprpm = 2;
eeprom unsigned int cutoff_rpm = 6500;
eeprom unsigned int start_rpm = 3500, fullpower_rpm = 4500;
// External Interrupt 0 service routine
interrupt [EXT_INT0] void ext_int0_isr(void)
{
if (pulsecount == pprpm*2){
time = timecount<<8;
time = time + TCNT0;
if (time > oldtimecount) period = time - oldtimecount;
else period = 4294967295 - time + oldtimecount;
rpm = (60000000/(float)period)*(float)pprpm*2;
oldtimecount = time;
pulsecount = 1;
}
else pulsecount +=1;
}
// Timer 0 overflow interrupt service routine
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{
if (timecount == 16777215) timecount = 0; else timecount += 1;
}
void setpwm(void)
{
if (rpm <= cutoff_rpm) {
if (rpm < start_rpm) per = 0;
if (rpm > fullpower_rpm) per = 255;
if ((rpm >= start_rpm) && (rpm <= fullpower_rpm))
{
per = ( (unsigned long int)(rpm-start_rpm )*255/( (unsigned long int)fullpower_rpm-(unsigned long int)start_rpm) );
}//else
}//if cutoff-rpm
else per = 0;
OCR1A = per;
} // setpwm
//////////////////////////////////////////////////////////////////////KEYSCAN/////////////////////////////////////////////////////////
void KeyScan(void)
{
Key = 0;
if (PINB.0 == 0) // UP
Key = 1;
if (PINB.1 == 0) // left
Key = 2;
if (PINB.2 == 0) // right
Key = 3;
if (PINB.3 == 0) // down
Key = 4;
} // KeyScan Subroutine
void main(void)
{
// Declare your local variables here
// Input/Output Ports initialization
// Port A initialization
// Func0=In Func1=In Func2=In Func3=In Func4=In Func5=In Func6=In Func7=In
// State0=T State1=T State2=T State3=T State4=T State5=T State6=T State7=T
PORTA=0x00;
DDRA=0x00;
// Port B initialization
// Func0=Out Func1=Out Func2=Out Func3=Out Func4=Out Func5=Out Func6=Out Func7=Out
// State0=0 State1=0 State2=0 State3=0 State4=0 State5=0 State6=0 State7=0
PORTB=0xFF;
DDRB=0xFF;
// Port C initialization
// Func0=Out Func1=Out Func2=Out Func3=Out Func4=Out Func5=Out Func6=Out Func7=Out
// State0=0 State1=0 State2=0 State3=0 State4=0 State5=0 State6=0 State7=0
PORTC=0x00;
DDRC=0xFF;
// Port D initialization
// Func0=In Func1=In Func2=In Func3=In Func4=In Func5=Out Func6=In Func7=Out
// State0=T State1=T State2=T State3=T State4=T State5=0 State6=T State7=0
PORTD=0x00;
DDRD=0xA0;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: 2000.000 kHz
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x02;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: 15.625 kHz
// Mode: Ph. correct PWM top=00FFh
// OC1A output: Non-Inv.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
TCCR1A=0x81;
TCCR1B=0x05;
TCNT1H=0x00;
TCNT1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: 250.000 kHz
// Mode: Phase correct PWM top=FFh
// OC2 output: Non-Inverted PWM
ASSR=0x00;
TCCR2=0x64;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: On
// INT0 Mode: Rising Edge
// INT1: Off
// INT2: Off
GICR|=0x40;
MCUCR=0x03;
MCUCSR=0x00;
GIFR=0x40;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x01;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
// Analog Comparator Output: Off
ACSR=0x80;
SFIOR=0x00;
// LCD module initialization
lcd_init(16);
// Global enable interrupts
#asm("sei")
while (1)
{
setpwm();
KeyScan();
if (Key == 1)
{
while (Key != 0) KeyScan(); // wait for key to let go.
if (display <= 10) display = display + 1; else display = 2;
menutimer = 0;
};//if key = 1
if (menutimer == 100) {menutimer = 0; display = 1;};
switch (display)
{
case 1:
{lcd_gotoxy(0,0);
_lcd_ready();
_lcd_write_data(0xC);
lcd_putsf(" ");
lcd_gotoxy(0,0);
sprintf(lcd_buffer,"%4u RPM %u%%",rpm,(int)((double)per/2.55));
lcd_puts(lcd_buffer);
break;
}//1
case 2:{
if (Key == 0){
lcd_gotoxy(0,0);
lcd_putsf(" ");
lcd_gotoxy(0,0);
lcd_putsf("Start RPM ");
sprintf(lcd_buffer,"%-4u",start_rpm);
lcd_puts(lcd_buffer);
lcd_gotoxy(10,0);
_lcd_ready();
_lcd_write_data(0xF);
}//if
if (Key == 2){
while (Key != 0) KeyScan(); //debounce
menutimer = 0;
if (start_rpm/1000 < 9) start_rpm = start_rpm + 1000;
else start_rpm = start_rpm - 9000;
} //if
break;
}//2
case 3:{
if (Key == 0){
lcd_gotoxy(0,0);
lcd_putsf(" ");
lcd_gotoxy(0,0);
lcd_putsf("Start RPM ");
sprintf(lcd_buffer,"%-4u",start_rpm);
lcd_puts(lcd_buffer);
lcd_gotoxy(11,0);
_lcd_ready();
_lcd_write_data(0xF);
}//if
if (Key == 2){
while (Key != 0) KeyScan(); //debounce
menutimer = 0;
if ( (start_rpm-start_rpm/1000*1000)/100 < 9) start_rpm = start_rpm + 100;
else start_rpm = start_rpm - 900;
} //if
break;
}//3
case 4:{
if (Key == 0){
lcd_gotoxy(0,0);
lcd_putsf(" ");
lcd_gotoxy(0,0);
lcd_putsf("Start RPM ");
sprintf(lcd_buffer,"%-4u",start_rpm);
lcd_puts(lcd_buffer);
lcd_gotoxy(12,0);
_lcd_ready();
_lcd_write_data(0xF);
}//if
if (Key == 2){
while (Key != 0) KeyScan(); //debounce
menutimer = 0;
if ( (start_rpm - (start_rpm/1000*1000) - ((start_rpm-start_rpm/1000*1000)/100*100) ) /10 < 9) start_rpm = start_rpm + 10;
else start_rpm = start_rpm - 90;
} //if
break;
}//4
////////////////////// full power rpm
case 5:{
if (Key == 0){
lcd_gotoxy(0,0);
lcd_putsf(" ");
lcd_gotoxy(0,0);
lcd_putsf("100% RPM ");
sprintf(lcd_buffer,"%-4u",fullpower_rpm);
lcd_puts(lcd_buffer);
lcd_gotoxy(10,0);
_lcd_ready();
_lcd_write_data(0xF);
}//if
if (Key == 2){
while (Key != 0) KeyScan(); //debounce
menutimer = 0;
if (fullpower_rpm/1000 < 9) fullpower_rpm = fullpower_rpm + 1000;
else fullpower_rpm = fullpower_rpm - 9000;
} //if
break;
}//5
case 6:{
if (Key == 0){
lcd_gotoxy(0,0);
lcd_putsf(" ");
lcd_gotoxy(0,0);
lcd_putsf("100% RPM ");
sprintf(lcd_buffer,"%-4u",fullpower_rpm);
lcd_puts(lcd_buffer);
lcd_gotoxy(11,0);
_lcd_ready();
_lcd_write_data(0xF);
}//if
if (Key == 2){
while (Key != 0) KeyScan(); //debounce
menutimer = 0;
if ( (fullpower_rpm-fullpower_rpm/1000*1000)/100 < 9) fullpower_rpm = fullpower_rpm + 100;
else fullpower_rpm = fullpower_rpm - 900;
} //if
break;
}//6
case 7:{
if (Key == 0){
lcd_gotoxy(0,0);
lcd_putsf(" ");
lcd_gotoxy(0,0);
lcd_putsf("100% RPM ");
sprintf(lcd_buffer,"%-4u",fullpower_rpm);
lcd_puts(lcd_buffer);
lcd_gotoxy(12,0);
_lcd_ready();
_lcd_write_data(0xF);
}//if
if (Key == 2){
while (Key != 0) KeyScan(); //debounce
menutimer = 0;
if ( (fullpower_rpm - (fullpower_rpm/1000*1000) - ((fullpower_rpm-fullpower_rpm/1000*1000)/100*100) ) /10 < 9) fullpower_rpm = fullpower_rpm + 10;
else fullpower_rpm = fullpower_rpm - 90;
} //if
break;
}//7
/////////////////////////////// cutoff
case 8:{
if (Key == 0){
lcd_gotoxy(0,0);
lcd_putsf(" ");
lcd_gotoxy(0,0);
lcd_putsf("Cutoff RPM ");
sprintf(lcd_buffer,"%-4u",cutoff_rpm);
lcd_puts(lcd_buffer);
lcd_gotoxy(11,0);
_lcd_ready();
_lcd_write_data(0xF);
}//if
if (Key == 2){
while (Key != 0) KeyScan(); //debounce
menutimer = 0;
if (cutoff_rpm/1000 < 9) cutoff_rpm = cutoff_rpm + 1000;
else cutoff_rpm = cutoff_rpm - 9000;
} //if
break;
}//8
case 9:{
if (Key == 0){
lcd_gotoxy(0,0);
lcd_putsf(" ");
lcd_gotoxy(0,0);
lcd_putsf("Cutoff RPM ");
sprintf(lcd_buffer,"%-4u",cutoff_rpm);
lcd_puts(lcd_buffer);
lcd_gotoxy(12,0);
_lcd_ready();
_lcd_write_data(0xF);
}//if
if (Key == 2){
while (Key != 0) KeyScan(); //debounce
menutimer = 0;
if ( (cutoff_rpm-cutoff_rpm/1000*1000)/100 < 9) cutoff_rpm = cutoff_rpm + 100;
else cutoff_rpm = cutoff_rpm - 900;
} //if
break;
}//9
case 10:{
if (Key == 0){
lcd_gotoxy(0,0);
lcd_putsf(" ");
lcd_gotoxy(0,0);
lcd_putsf("Cutoff RPM ");
sprintf(lcd_buffer,"%-4u",cutoff_rpm);
lcd_puts(lcd_buffer);
lcd_gotoxy(13,0);
_lcd_ready();
_lcd_write_data(0xF);
}//if
if (Key == 2){
while (Key != 0) KeyScan(); //debounce
menutimer = 0;
if ( (cutoff_rpm - (cutoff_rpm/1000*1000) - ((cutoff_rpm-cutoff_rpm/1000*1000)/100*100) ) /10 < 9) cutoff_rpm = cutoff_rpm + 10;
else cutoff_rpm = cutoff_rpm - 90;
} //if
break;
}//10
}//switch
delay_ms(50);
menutimer += 1;
}//while 1
}
that book I recommended earlier in this thread and the free version of codevision is all that is required to understand this setup totally. Once you read that book understanding this code will be really easy. I don't think you can get a simpler to program system than an atmel. Also this code can be modified to display mpg without a lot of effort, just kill the pwm output for the nitrous solenoid and modify the menu to calc your mileage #s you want.
|
|
|
03-22-2008, 05:17 PM
|
#84 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
That's kinda cool Rick I like the software debouncing. Got a schematic?
Anyway, here are some misc updates,
here is an action shot of the original obdgauge (my elmscan cant get here soon enough), the injector version will only have things that we can deduce from the injector signal and vss for now:
And here is a link for palm compatability
http://www.qcontinuum.org/obdgauge/compatibility.htm
PalmPilot series
Palm III series
Palm V series
Palm VII series
m100 series
m500 series
Tungsten (T, T2, T3, C)
i705
Zire 71
And the sourceforge thingie was approved, guess they didn't mind the first category being "Topic :: Games/Entertainment :: Real Time Strategy" Go for the best MPG score!!!
https://sourceforge.net/projects/opengauge/ , guess I'll start by checking in that Mpg.java thing.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
Last edited by dcb; 03-22-2008 at 05:23 PM..
|
|
|
03-22-2008, 06:09 PM
|
#85 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
Quote:
Originally Posted by MetroMPG
I have a feeling that it will be easier for a rank novice developer (eg. me) to eventually make a working MPGuino than to develop the circuitry, interface & code for a Palm based gauge.
|
I believe this is an accurate assesment, once it is developed. Something that isn't terribly expensive and can be programmed and updated without fancy hardware, and is open source? It is going to happen, there is going to be a freedunio type version of opengauge, it is just going to take a while to develop into something useful.
I'm thinking that even for the palm/laptop V1 that it makes sense to start with the freeduino because it is only $24, won't require much extra investment for v1 as just a signal processor (has a 232 chip on it already) and can possibly be upgraded to a stand alone version later on.
Ok, I'm convinced, I just ordered one
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
|
|
|
03-22-2008, 06:32 PM
|
#86 (permalink)
|
nut
Join Date: Dec 2007
Location: Southen West Virginia
Posts: 654
Thanks: 0
Thanked 37 Times in 26 Posts
|
Hopefully that bit of code can give people some ideas. It should compile and run on the atmega168 everyone is ordering. I think we should consider that making a bunch of different types of v1 systems might actually be the best. That way anyone that has a palm device can do the interface circuit and use that. From there porting to windows mobile using either the same interface circuit or a bluetooth obd2 interface to get the mpg display working on those devices. Since windows mobile and windows smartphone are getting pretty popular that might be a good thing to invest time in after the palm system is working. Flexibility being the key to a solid v1 system so we can attract donations and build a bounty pot for the later more advanced features that will be harder to implement. Also the windows based systems are typically on an internet enabled phone so having it upload to this website in realtime might be a pretty neat feature.
For those without either device or no interest in those devices and wanting a pretty much permanent install with v2 and beyond capability could do the atmel based system. If we try and keep the code in some language that all the different devices understand it would be much easier to keep the systems all together with features.
If I get time this weekend(after grading papers) I will try and modify the menu system on that code I posted to build a mpg display with the assorted submenus to input the vss and injector correction factors. I will try and get it more in line with the palm menus if possible.
Also the cars with a carb could be included in v1 if we find a cheaply priced flow rate meter. Then a magnet and sensor can be used for the vss signal. Those 2 inputs would be enough to use for an input to the v1 system to give mpg info.
|
|
|
03-22-2008, 07:34 PM
|
#87 (permalink)
|
I"m not lurking!
Join Date: Jan 2008
Location: Kansas City, MO
Posts: 128
Thanks: 0
Thanked 1 Time in 1 Post
|
Sheesh. I"m replying to Coyote's post #84, and there are three more posts already. I've had to rewrite my post. LOL. Atmel chips it is. I'll order an Arduino tonight.
Sweet, Coyote. How much memory did it take in the ATmega32? How many pins did you use for the LCD? (Edit: Nevermind. it looks like you used the serial port) It's been a while since I worked in C; I'm surprised how easy I could still follow what you're doing. But I'm sure I couldn't debug it right now. It's gonna be good getting back into it.
Can you draw up a schematic for the input board? Aggh. The book you recommend is $103. I like the vibrating gas pedal idea. Perhaps we can implement an electric shock option for those who still don't get it.
Quote:
Originally Posted by MetroMPG
I agree with this, but not to the abandoning of other approaches. For lots of reasons already mentioned in this thread, I prefer the *duino/LCD standalone route, and I want to pursue that as well.
|
What dbc said above. No abandonment, just taking it in steps. We'll get a handle on the VSS and injector signals and pass them to palm for calculations, logging and user interface. V1 done. Then, we'll get the calculations and logging in the cpu, add an LCD interface, and it becomes a stand alone MPGuino. V1b
@Schultz. I'll need VSS and injector wiring info on a 1996 Chevy Cavalier, 2.2l, please.
@dbc. Yes, any suggestions on Palm selection would be appreciated.
__________________
Roll on,
Stew
Last edited by s2man; 03-22-2008 at 08:18 PM..
|
|
|
03-22-2008, 07:43 PM
|
#88 (permalink)
|
Batman Junior
Join Date: Nov 2007
Location: 1000 Islands, Ontario, Canada
Posts: 22,527
Thanks: 4,078
Thanked 6,976 Times in 3,612 Posts
|
Quote:
Originally Posted by s2man
I like the vibrating gas pedal idea. Perhaps we can implement an electric shock option for those who still don't get it.
|
NOW we're talking!
|
|
|
03-22-2008, 11:24 PM
|
#89 (permalink)
|
Master EcoModder
Join Date: Dec 2007
Location: Norfolk, Va. USA
Posts: 869
Thanks: 14
Thanked 33 Times in 28 Posts
|
wanna hear it, here it goes
Here you are S2,
But you gotta tell me where to get a *duino and some of the other stuff you men have been talking about.
I am working on the belief that your car has cruise. none of my info shows any other variant.
So,
Forgive me for not providing pics or diagrams, I will have to figure out how to get info from my garage computer to MY PC.
for a 1996 Cav. 2.2
The PCM is located under the front of the car, behind the bumper on the right [passenger] side.
Connector #1 Pin #10 is a black wire that feeds Injector #1
Connector #3 Pin #1 is a Dark green wire with a white tracer that feeds the pulses to the cruise. 4000 pulses per mile.
I chose that one because it feeds pulses at a fixed rate.
Connector #3 pins # 11&12 yellow & purple from the vss on trans feed variable alternating current, the vss on the trans is a small generator.
I will talk to my son [the CompuGeek] and see if i can network the two 'puters or carry info on one of those sticks he keeps in his pocket or what I need to do. I may have to put that puter on the web and just work from there.
Hope this helps,
S.
__________________
When you are courting a nice girl an hour seems like a second. When you sit on a red-hot cinder a second seems like an hour. That's relativity.
Albert Einstein
|
|
|
03-23-2008, 12:25 AM
|
#90 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
More fun with hardware
FYI, I'm going to try my luck with the $17 serial board: http://www.nkcelectronics.com/arduin...omplete-k.html
It will interface with the palm without any adapters and can shave $14 off of V1 by not requiring a $7 daughterboard for serial. It should also be capable of standalone LCD operation also, though you will need an available serial port to program it and the palm pilot.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
|
|
|
|