Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How can I input from sensors and display on screen as a graph

Not open for further replies.


Newbie level 3
Feb 10, 2013
Reaction score
Trophy points
North Iowa USA
Activity points
Hey now, first post so be gentle, ha.
I work on old VW diesels.
No computers, all mechanical.

They don't run like originally intended because the fuel isn't as thick as it was 20 years ago.
Fuel viscosity plays a part in the timing advance curve.

Closest thing to an engine analizer on these old machines is a diesel pulse detector hooked up to a timing light.

I would like to take 3 (possibly 4) inputs:
and one from a injector pulse detector
...and maybe later add one more analog input sensing the internal pump pressure. 12 volt to 0 from a VDO oil pressure sender.

and have them display as a graph on a laptop screen that shows RPM along the X, and timing BTDC along the Y.

Engine behavior:
The TDC mark on the flywheel will indicate 360 degrees for calculating the timing advance BTDC (before top dead center) and RPM.
The injection pump goes around once for every 2 turns of the engine so a white or reflective area near #1 on that sprocket would mean I'm reading the right TDC mark for cylinder 1 (not 360 out on #4).
The diesel pulse occurs about 12 degrees BTDC at idle to 1500 RPM.

A little history so you get an idea of my skill level.
I got an AS degree for electronics,.. back in '89 so I'm a little rusty but it's coming back.

First question would be what hardware should I use?
3 inputs isn't much, input one address and 3 of the digits can represent the sensor inputs.
I'd like to use a USB I/O board with a PIC.
Like the DIY one.
But I can easily be turned by someone less ignorant than me.
If there is a PIC out there with 1 8-bit (3-bit ha ha) digital input
and one analog input would be great for reading the internal pump pressure later.

Next what programming language should I study up on?
What I use for hardware will probably effect that.

Hi craiger,

I am not expert in automotive electronics. All i can tell you is to begin with you can find Arduino Boards [1] very easy to use as lots of ready made low cost boards can be found. There are ready made add on boards called shields are available for Arduino. There is huge Arduino users community plus you will find ready made sample codes and code libraries for your use.

[1]: Arduino :

Another option is to use: MikroC. MikroC compiler is very easy to use because lots of built-in library functions for ADC, Timers, PWM, I2C, SPI, UART, LCD etc etc.

you may use PIC18F series microcontrollers they have built in ADC, PWM channels, timers, lots of digital IO. For example PIC18F4550 comes in 40 pin DIP package with built-in internal oscillator (so you dont even need external crystal). and lots of other peripherals such as UART, I2C, SPI, USB, ADC, PWM, timers etc.

You may also find development boards as well such as following:


As far as programming language is concerned, both the above mentioned tools (ie. Arduino and MikroC) use C language. C is very mature language and good option for Embedded applications.


It will be hard to install sensors in an engine that does not already have them.

Photosensors are a natural choice. You will need to position a photosensor exactly at TDC, to detect the timing mark as it passes. You are measuring the elapsed time between TDC and the transit of the timing mark. You will start the timer at TDC and stop timing when the timing mark passes.

The timer is a pulse generator running at maybe 360 Hz, or 3600 Hz, or whatever is convenient to divide by engine RPM's.

It's a challenge how to detect TDC. I don't have an idea about how to do it electronically. Unless it might be by gluing a post on the pulley, putting an led by the mark at the engine block, and detecting the interruption with a photosensor.

That is starting to sound like two photosensors, precision mounted. And light sources too.

By detecting TDC each revolution, you could count revolutions per 6 seconds. Then you multiply by 10 to get rpm.

Although a microcontroller could perform all functions, it can be done with the right assembly of counters and digit displays.

asimlink, I've heard of arduino when searching for stepper motors.
Wasn't sure what it was I will definately look into it further.
Thanks for the links.
What do you think of this 28 pin PIC development board?:
A little cheaper as a kit.
That page also gave me some pointers on how to program in C.

BradtheRad, For engine sensors:
Roger Brown built a tach that runs off a photosensor pointed at the injection pump sprocket with 2 white spots.
I'm going to see what he used for that.
It needs to be about 1/2 to 3/4" away from the surface, there are metal standouts on the flywheel that will take it out if mounted any closer.
If anyone knows of one off the top of their head that would work...
Some photosensors come with their own light. Like an optoisolator that reflects.

For TDC there is a threaded hole in the trany,
I'll build the photo sensor into the plastic plug that screws into it.
The large flywheel diameter should make it more accurate than a pully.

As far as the math goes, since we are measuring something that happens before TDC,
I'll have to measure TDC to TDC then divide by 360 to get the time per degree(TPD).
Then subtract the amount of time between pulse and the second TDC to get the "time before top dead center" and divide it by TPD to find the degrees BTDC.

It could be done with several chips but I really liked the small PIC developer as soon as I saw it.
It's all ready to plug into the USB port, the board is already built so I don't have to design/build my own and can support the work someone else has done.

I've been doing alot of searching on here. Data logging seems close to what I'm doing so got some info from that.

Where do I look for info on how to get the data to display on screen as a graph?

hello craiger,

Arduino are general purpose embedded boards. People use them in variety of applications such as:
Wireless sensor networks, motor control, wi-fi enabled or ethernet enabled data logging devcie. People also run Cosm [1] code and make their device to log data to this free cosm service. You can even plot graphs from your device using cosm code and cosm service from

The USB_IO_Board board that you mentioned is fine. It contains PIC18F2550 which is just a low pin count version of PIC18F4550. Both microcontrollers use same datasheet.

For getting your data on Graphic LCD you may see my blog [2] that i wrote sometimes back. In that experiment I showed how easy it was to interface a graphic lcd using MicroC compiler with PIC18F4550. Since PIC18F2550 is almost the same thing you may read and use the information i presented in my blog to enable your hardware to display or draw anything on Graphic LCD.


hope this helps!

I feel like I'm reading Spanish.
Many new words I don't recognise yet, ha. cosm??? arduino
I'll look into both of them. Thanks for the links.

Thanks for the GLCD info too. That looks small/easy,... makes me wonder if I even need a computer screen.
I'll have to look into those; check the size/resolution and see how spendy they are.

I think the PIC18xxx is especially for USB connecting. Do I have that right?
I see the chip on your blog is a PIC16xxx and the USB connector isn't for moving data. (Never mind that's just what is written on the chip not what is listed above).
Just using it for the clock and power.

If I provided an 8Mhz clock and used the car battery for power and ground it could be independant.

That would simplify this project, get me familiar with the PIC chips,
but I'd probably have to build my own board, (unless someone is selling it as a kit)
and I don't learn as many useful skills as I would diving into arduino and learning C. I intend to do that reguardless of what direction this project goes.

I didn't come into this with a rigid plan but I've been throwing it around in my head for years.
Every time I wonder why one VW Rabbit diesel has more power and gets better MPG than another.
Thanks for giving me some direction.

Hello craiger,

For beginners Arduino is an easy to do platform. Learning curve is little. And I think learning curve is very important factor. It all depends how you want to stand against the hurdles. If you have less patience, and less time then you should avoid diving into difficult things and instead should try to get something that is achievable.

PIC18FXXXX are general purpose 8 bit microcontrollers.
You may find lots of PIC microcontrollers. If you are making a product then , yes you need to choose the microcontroller that best suits your target budget. But for general experiments you may pick any microcontroller that has lots of peripherals.

If you want to run PIC microcontroller circuit on Car batery or 12V then you'd need to make a DC to DC power supply that brings the +12V down to +5V (which is operating voltage for most of the microcontrollers)
These days 12V DC to +5V dc converters are not an issue, you could make your own or can use the USB chargers for mobile phone that are made to operate from Cigarette lighter 12V inside car. These USB chargers have switch mode dc-dc converter inside that convers 12VDC to +5V DC.


Not open for further replies.

Part and Inventory Search

Welcome to