Shop OBEX P1 Docs P2 Docs Learn Events
HELP - BasicStamp Tach with 4 digit 7 segment display — Parallax Forums

HELP - BasicStamp Tach with 4 digit 7 segment display

vpcncvpcnc Posts: 7
edited 2011-07-29 11:08 in BASIC Stamp
I'm New to Basic Stamps, but have a lot of High-Level Programming Language experience, and Electronic Hobbyist Experience.
My Project is a Replacement for an Obsolete OEM industrial Tachometer.

The Equipment Currently had a Slotted Wheel with 80 teeth
It has an Optical Sensor ( led and photo sensor ) set up
The teeth pass between the two and create a pulse stream.
MAX rpm will be about 4000 rpm.
4000 x 80 = 320,000 pulses per minute
or 320,000 / 60 = 5334 pulses per second.


I need a way to Count the pulses
Calculate the RPM based on the Number of Pulses received in a set amount of time.
Display the Calculated RPM on a 4 DIGIT 7 Segment LCD display.

The Display uses 4 common Cathode lines and 4 x Abcdefg data lines for the segments

Here is my Question?
Will ONE basic stamp be able to handle this project or will I need two?
Can One Stamp Count the Pulses, and Keep the LCD display updated while it is getting the Pulse count?

Here is my Idea.
Count Pulses for 1 second. ( 1 second between display updates)
Calculate the RPM - For 1 second of pulses I will use this formula
(Pulses counted / 80 teeth ) * ( 60 / 1 second ) = RPM

For faster display updates I can go to 1/2 second
(Pulses counted / 80 teeth ) * ( 60 / .5 seconds ) = RPM

Display the RPM on the LCD display

I need 11 I/O lines for the Display
4 I/O to Control Digit access
7 I/O for Segment control


Display loop
Switch Access to Digit (1)
turn on the segments for Digit 1
Switch Access to Digit (2)
Turn on the segments for Digit 2
Switch Access Digit (3)
Turn on the segments for Digit 3
Switch Access to Digit (4)
Turn on segments for Digit 4
end of Display Loop

I figure this loop needs to execute about 30 times a second.

I'll build a look up Table for the Digits 0 to 9
Digit segments
g f e d c b a
0 0 1 1 1 1 1 1
1 0 0 0 0 1 1 0
etc...

and use the bits to control which segment output lines are turned on.


From the Reading I've done
There is a Count command that you can set to a specific time duration
Such as Count for 1 second.

During this 1 second, does all other Stamp functions stop, or will the display routines continue to run while the Count is counting pulses?

If this can't be done with ONE stamp, I thought I can use two Stamps.
One to get the Counts and calculate the RPM.
the 2nd to just update the LCD display.

How would I communicate the RPM from one Stamp to the Other Stamp?

I'm sure once I receive my Kit and start to experiment I'll answer some of my own Questions
but I'm on a very short time frame.
I have about 4 days to complete this whole project and thought a JUMP start from one of the Forum experts would be great.

Thanks in Advance for your help.

Comments

  • TappermanTapperman Posts: 319
    edited 2011-07-28 10:08
    vpcnc wrote: »
    I'm New to Basic Stamps

    Welcome ... Being that your new ... will this application tie up the gear so you can't use it? If so, then you might need a second one.

    Your time frame of 4 days is pretty close! And you still waiting for the kit?

    The COUNT function will detect a pulse freq.

    But, as this video shows (variable sweep) ... on the 6 digit model (different CPU) , I had to update the digits 300 times a second before the flicker would go away!

    http://www.youtube.com/watch?v=OvuUaImhz0Y

    I'm not sure the BS2 can handle your app, at least raw? Some of the other experts in here may have a suggestion in that area, to take the work load off of the BS2? I'm not that heavy into displays.

    ... Tim
  • Mike GreenMike Green Posts: 23,101
    edited 2011-07-28 10:20
    As Tapperman mentioned, the COUNT statement will count the number of pulses in a specified time period (like one second) and do it pretty accurately. While the COUNT statement is doing its thing, the Stamp cannot do anything else. The Stamp will not be able to handle doing the pulse counting and refreshing the display simultaneously. Normally, Stamp applications use a separate display controller that handles the refreshing using an internal buffer. Parallax and others sell both parallel interface and serial interface displays that would work very nicely for your application (like this one or this one).

    Even with two Stamps, to avoid serious flicker, you'll have to provide some kind of external hardware, either to buffer the communications between the 2 Stamps or to free up some I/O pins on the 2nd Stamp (like a 2-to-4 decoder and/or a BCD decoder/driver). The cost of one of the display/controller units is less than or the same as that of a 2nd Stamp and would be much simpler to use.

    A single Propeller would handle both tasks very easily and you could use Bean's Propeller Basic.
  • vpcncvpcnc Posts: 7
    edited 2011-07-28 12:59
    Mike Green wrote: »
    serial interface displays that would work very nicely for your application (like this one or this one).

    I wish to keep the .5" high Digit size. the displays you show in your links are small 2 line x 8 or 16 characters.
    Can the individual pixels be controlled to create the larger Digit displays I wish to to have?
    4-Digit-Standard-LCD-Panel.jpg


    If so is there an Example that I can view? Maybe a video demonstration?
    302 x 132 - 17K
  • vpcncvpcnc Posts: 7
    edited 2011-07-28 13:44
    I came across this Article in the Nuts and Volts.
    Article
    Is this what I'm looking to do? Use two Stamps..
    First one Counts the Pulses, calculates the RPM, then ( not sure how yet ) sends the RPM to the 2nd Stamp to update the Display.

    This article seems to describe My 2nd Stamp or am I missing something?
    The article refers to SX/B is that this Stamp?
    http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/CategoryID/9/List/0/SortField/0/Level/a/ProductID/9/Default.aspx

    Now I just need to get my Kit and figure out how to communicate from one stamp to the other.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-07-28 14:15
    The SX/B is a different microcontroller that's used internally in some Stamps like the BS2sx and the BS2p/pe/px series. The Basic used for programming it is only superficially related to the Basic used for the Stamps. The SX/B is also much faster than the Stamps.

    You may be able to find LCDs with 0.5" characters that use the same controller chip as the ones Parallax sells since it's pretty standard. Check on the internet for Matrox and others.

    The main issue you face in using a Stamp for a separate display controller is that the Stamps are not buffered and can only do one thing at a time. It should be possible for the 1st Stamp to signal the 2nd Stamp using one I/O line on each that the 1st Stamp has data to send. When the 2nd Stamp has finished a display cycle and finds this signal true (high probably), it can signal back using another I/O line that it's ready to receive the data. The 1st Stamp will be waiting for this and will immediately send two bytes of data (4 BCD digits), then drop its signal line back to low. When the 2nd Stamp sees this, it will drop its signal line and continue the display processing with the new data.

    The 1st Stamp will have to wait for the 2nd Stamp to be ready to receive, but that shouldn't take more than a few milliseconds since the 2nd Stamp is just refreshing the display.
  • vpcncvpcnc Posts: 7
    edited 2011-07-29 11:08
    Thanks for all your valuable advice and information.
    I wasn't able to find anything under the Matrox brand..
    But I did find one or two LED kits that provide Serial input ( using an off the shelf driver chip I imagine )
    I'm going to try the Dual Basic Stamp approach first, and if that doesn't work out, then I'll order one of these Serial Display units.

    My Basic Stamp Kit should arrive Monday or Tuesday next week, and while that only leaves me a day to meet my dead line, I guess I'll have to push delivery of the equipment back a few days while I test, design, and debug my project.

    Thanks again.
Sign In or Register to comment.