PDA

View Full Version : Dual 7-Segment LED Display



erice1984
- 1st July 2007, 05:09
Edit: Read 3rd Post

-Eric

Pic_User
- 1st July 2007, 06:02
I don't want to use a larger than 8 pin PIC, so my thought is for two 7-Segment LED displays.

Can I use a Serial to Parallel to save on pins and having to go with a different PIC or what?

I am lost and can't find anything on google or 3 other forums on this, schematic and IC's would be very much appreciated!

-EricHi Eric,

Welcome to the MELabs PICBASIC and PICBASIC Pro Forum.

Although you think you have asked a complete question, there is not enough information included, to allow the members to help.

Why do you need a 8 pin PIC? Size, expense, weight, religion?
Serial to Parallel to save on pins?? Do you want to add peripheral components to save on PIC I/O pins? Multiplex?
What do you want the two 7-Segment LED displays to show? Decimal points too?
What do you want to measure? How many pins does the PIC input need?

a dual 7 segment LED display
http://winpicprog.co.uk/pic_tutorial_7seg_board.htm

PIC DUAL DICE (dual 7 segment LED display)
http://kitsrus.com/pdf/k71.pdf

-Adam-

erice1984
- 1st July 2007, 06:25
measuring knock sensor on an engine.

Size mainly because the unit needs to be mounted and look as "nice" as possible.

With that said one could conclude that cars and looking good are part of my religon :)

As far as pins go, the 8-pin micro only has 5 pins to play with and I need one for the sensor input and 1 for an LED warning light output (to draw attention to the displayed value) As this value if large enough can result in death of the engine, yet another part of my religon...

With what I have read about the PIC's is that you can use serout and i figured it could do the serout command and then hit the parallel converter for the LED, and such. I might be trying too hard though as well.

EDIT: So nevermind on the 8-pin pic, I will go with the PIC16F684 then run a black ribbon cable for the LED Display.

Another EDIT:

PIC16F684 Has 12 I/O PINS

01 - Input from Knock Sensor
02 - LED on knock count (KnCnt) > 4 = Turn that flippin' LED on!
03 - Segment A
04 - Segment B
05 - Segment C
06 - Segment D
07 - Segment E
08 - Segment F
09 - Segment G
10 - Segment H
11 - LED Display A
12 - LED Display B

Would like to use alpha numeric display, because if knock count does go over a predefined count then I want it to display EE

Thanks for all help

-Eric

Melanie
- 1st July 2007, 08:45
7-segment LED Displays can display a limited number of alpha characters - 'E' being one of them. The problem is when you want to display characters that contain diagonals like 'K' or 'M' or 'Z', and then you need a 'starburst' LED display, but unfortunately you then also need to drive far more segements.

There usually isn't a segment 'H' on 7-segment LED's unless you're counting the Decimal Point that's normally found on them.

erice1984
- 1st July 2007, 09:46
Good stuff, Thanks.

I have not at all coded before and I just got PBPro.

I have got this so far to flash an LED on and off

LED_F: 'LED Flash loop begins here
if X0 <= 5 then
LED = 1 'Turns on the warning LED
pause 500 'Pause 1/2 second with LED on
LED = 0 'Turns off warning LED
pause 750 'Pause 3/4 second with LED off
X0 = X0 + 1 'This adds 1 to variable X0 each time it loops
goto LED_F 'Returns to begining of LED Flash loop
else
LED = 0 'Makes sure LED is off
X0 = 0
REturn 'Returns to main code

Let me know if that would work. Also I am kind of in a bind here trying to figure out how to decipher the input from the knock sensor. Knock sensors are piezo capacitive or something like that, basically they generate small amount of voltage (~2-5mV) from vibration, and generate spikes in the signal when 'knocked' on for lack of better terms. So its an analog signal, and I need to make this thing be able to see the spikes, count them and display on the LED Segments.

Analogy for Knock sensor (begin)
Think of the sensor as a doctor with a stethoscope, the doctor listens and hears your heartbeat crisp and clear, when some other sounds are in there its not normal and the doc says "hey there is a problem."

Same thing for the knock sensor, except it doesnt want to hear a heartbeat, just a smooth nice low vibration of the engine running, now when it hears other sounds the car's engine managment system says "hey there is a problem"
Analogy for Knock sensor (end)

When that happens, it pulls timing back, driver experiences a hesistation (lack of power), and it usually, when no damage has been done, picks back up and moves along :)


Voltage comparator or AD Converter?

-Eric

skimask
- 1st July 2007, 10:09
Have you ever put a 'scope on a knock sensor?
Small signals indeed. You'll probably need to amplify them quite a bit, filter out the noise, determine what is steady state for your particular application (then have to redetermine what is steady state over a wide range of temperature's, fuels, driving conditions, etc.etc.), and I could go on and on...
Vehicle's have high speed DSP's in them for a reason, one of them to determine if the engine is knocking or not. A PIC generally can't handle this sort of job (read that as needing some sort of high speed FFT) without external help (fairly tight bandpass filters, amplifiers, etc). Knock sensors are generally sensitive to the 2-3khz range, which is what abnormal combustion resulting in knocking GENERALLY sounds like, but during normal combustion, these sensors are also putting out some voltage. It also depends on how tightly it's put in. Too tight and it's too sensitive, too loose, not sensitive enough. The torque value on the knock sensor for my Nissan is 18ft-lbs...not much at all. And the service manual specifically states 18ft-lbs in big bold lettering with a warning talking about how doing it by feel won't be nearly good enough for the ECM.
Not saying it can't be done...Anything's possible. But, without a 'scope, and/or good baseline data vs. good knocking data, in the first place, I don't see anything useful coming out of this, especially if you're messing with a computerized engine. How would a person get it to knock? On the old engines, just turn the distributor a bit, disconnect the EGR valve, create a vacuum leak to lean it out and power brake it, something like that...but today, short of forcing an ECM into a 'limp home' mode, I don't see how you can get it to knock reliably to get a decent reading on it. Not to mention that today's engines run on the ragged edge of knocking as it is... A little bit of knock is ok, a very little bit. In fact, most engines will knock just a tiny bit under part-throttle acceleration. And, one of the more important things...if you are retro-fitting an engine that didn't come with a knock sensor and were just going to plug one into a freeze plug hole or onto a bolt head...blocks and knock sensors are designed to work together. You can't just go slapping a knock sensor into any old hole and expect it to go 'BAM, it's knocking'.
At any rate, what's the end application? Maybe it can work...anything's possible...
Also, for the sake of ease, I'd lose the 7-segment LED and get a cheap 8 character LCD. A lot easier to work with in PBP (built-in commands), fewer wires/connections, less processing power, about the same price if you get a couple on eBay, and you can display more info.

erice1984
- 1st July 2007, 19:07
between shifts at higher rpm most engines will knock a little bit, also tapping near the sensor to get a response. The engine is a 4G63 motor in my friends EVO 8.

Reason for the seg-LED is this is all he wants on it. Also it is smaller than using LCD, I know code is going to be longer but I guess that is a trade off, and all the PIC is going to be used for.

8MHz clock isnt fast enough?

skimask
- 2nd July 2007, 05:06
between shifts at higher rpm most engines will knock a little bit, also tapping near the sensor to get a response. The engine is a 4G63 motor in my friends EVO 8.

Reason for the seg-LED is this is all he wants on it. Also it is smaller than using LCD, I know code is going to be longer but I guess that is a trade off, and all the PIC is going to be used for.

8MHz clock isnt fast enough?

EVO 8 - not going to spend much time doing part-throttle acceleration is it?
8Mhz not fast enough? - most likely not, but I think your main limitation is going to be the speed of the A/D converter.
Are you tapping into the existing knock sensor line? Can you tap on the block and watch the timing back off or what?

erice1984
- 2nd July 2007, 05:14
thats the interesting part, if you grab a screw driver and tap very close to the sensor it picks up small stuff, drop the hood closed about 18" up and you will see readings.

and yes, tapping into the exsisting signal wire.

What if it was run at 20MHz ?

Yeah he doesn't spend much time at part-throttle, mostly easy driving, but on ramps and such its WOT. Same with me usually, I got a swapped GC Impreza (2000 2.5rs) with a 2002 wrx motor (EJ205) Did all the wiring myself :) so I have mastered diagrams, not to mention I am going to school for auto engineering, and already graduated from UTI auto technician.

skimask
- 2nd July 2007, 05:37
thats the interesting part, if you grab a screw driver and tap very close to the sensor it picks up small stuff, drop the hood closed about 18" up and you will see readings.
What are you measuring with?


What if it was run at 20MHz ?[QUOTE]
A/D converter speed doesn't care about oscillator speed, well, not really. The A/D converter will only run as fast as it will run, doesn't matter how fast you run the oscillator.
The older A/D converters will 'only' run at about 20ksps, the new ones around 100ksps. Problem is, once you get up to those speeds, you're going to need good filtering at the front end.

[QUOTE]Yeah he doesn't spend much time at part-throttle, mostly easy driving, but on ramps and such its WOT.
What I meant was, it's an EVO-8...probably a hot rod, street racing, etc.etc...

So, write some code, try it out, see what happens, come back with questions....

erice1984
- 2nd July 2007, 05:45
A/D converter speed doesn't care about oscillator speed, well, not really. The A/D converter will only run as fast as it will run, doesn't matter how fast you run the oscillator.
The older A/D converters will 'only' run at about 20ksps, the new ones around 100ksps. Problem is, once you get up to those speeds, you're going to need good filtering at the front end.

Thats the problem, I know that is kilo samples per second, but as far as filtering I am lost. I have never had to deal with this stuff before.

thanks.

skimask
- 2nd July 2007, 05:48
I have, just dont know how to interpret the signal, was looking for suggestions, and I have some code written for display etc.

thanks.

Well, what does your baseline (no knocking) signal look like?
What does your knocking signal look like?
I know what they 'should' look like according to the books, but what do YOUR signals look like, with YOUR input circuit, filters, etc.
Post some 'scope pictures or something...

erice1984
- 2nd July 2007, 06:17
Wish I did have a pc o-scope, and my friend lives 1000 miles from me, so I am waiting on him.

These sensors arent that accurate in the first place. but I guess I am waiting on him to get me some info on what the waveforms look like and what knock looks like with engine running and not running.

erice1984
- 2nd July 2007, 08:57
alright, so i figured out how to amplify the signal using an LM324N

Only thing now is, should I use a comparator so when the knock hits and spikes it throws the voltage above causing a high signal? That would be my thought, and first approach.

Next, how do I get the PIC to read those and more or less count them?

erice1984
- 3rd July 2007, 00:51
I found an IC that will do all the filtering etc for me and is digitally programmable... made by Intersil, the HIP9011