Circuit Design Help Needed - Calculation Circuit

Hi all,

I'm not very good with electronics yet, but I have an application which I wish to build myself and hopefully learn something in the process.

I have an equation that performs some multiplicaiton and division to an input from a reed switch or hall effect sensor count. This calculation provides the distance that a wheel has travelled.

Can anyone provide some guidance to designing a circuit that can do this (multiply two sets of two numbers and then divide the totals) and then update the calculated answer onto a 4-digit 7 segment display?

Regards

Steve

Reply to
sstrik
Loading thread data ...

Hi, Steve. You've basically got a couple options. Either you can get really crafty with choosing the size of the wheel (i.e. 10" per revolution), be crafty with both the wheel diameter and an optical encoder you attach to the wheel (i.e. 10"/rev, 100 logic pulses per count = 0.1"/count), or you get a microcontroller to do the job, and do your multiplication/division in software. That's especially helpful because you also have most of your display controller there, too. All you'll need is transistors to drive the display.

For a newbie, it can be pretty simple, especially if your wheel isn't going too fast. If the wheel is slow, you can do this with a BASIC Stamp and one of the Scott Edwards serial input LCD displays.

Good luck Chris

Reply to
Chris

By the way, I'm not sure if you've given any thought to the fact that your switch will be clicking away if the wheel is going forwards or backwards. If this is a problem, you might want to install two switches to determine direction, or just use an encoder with quadrature output. Your microcontroller can then determine direction and add or subtract accordingly to keep accounts balanced.

If you want to do this with gates, flip-flops and counter ICs, you're truly in for an "Acres O' Digital" project. I'd strongly recommend against it.

Good luck Chris

Reply to
Chris

Google for "picaxe." A friendly chip with lots of free software (on the web for free downloading) that might be almost perfect for what you want to do.

Reply to
Charles Schuler

Thanks.

I figured that a chip may be the best way to go.

How could I input different calibrations for the chip to use in the calculations. I figure that depending on wheel diamter and number of pulses per revolution (6 is likely) that the signal could be running at

200Hz. Is this likely to cause many problems?

I'm guessing I need a "calibration" mode to enter the new calibration values for the software to use.

Thanks again for all of your answers (not just Charles) :)

Regards

Steve

Reply to
sstrik

Chris,

I unfortunately can't control the diameter of the wheel (motorbike) and it can be travelling pretty fast (200kmh max). I've been loking at the picaxe chips mentioned by Charles and have run into a small brick wall (probably the thickness of my skull :).

In a maximum worst case my counter may need to go as high as 6,500,000 (measurement of 999.9km) before resetting. It looks like the maximum that the pic can handle is 16-bit numbers ie 65536. Am I looking at this worng?

Essentially at the moment I need to take the count, multiply it by

1000. Take the calibration figure (assume 5000 FTM) by the number of pulses per revolution, 6 to get the second number then divide 1 by 2

A= count*1000 B=5000*6 C=A/B which is distance and then display this value.

I need a method where I can use the devices buttons to alter the 5000 value to whatever is needed to match the required measurement (slightly different from event to event). I also would like to be able to alter the number of pulses per rev probably using three dip switches to count from 1 to 6.

I then also need a reset button to reset the count as each checkpoint is passed. I figured on using a three position switch to control pausing the count, indicating positive count or negative count.

Ultimately the size of the completed circuit is not important, but I'd like to keep the overall cost down. Basically think of a bicycle odometer with more functionality.

Thanks again for your assistance so far.

Merry Christmas.

Regards

Steve

Reply to
sstrik

Hi, Steve. This isn't turning out to be a newbie project here.

First off, the previous suggestions for newbie microcontrollers (BASIC Stamp and its more frugal cousin, the Picaxe) are way too slow here. You're talking about a 2 foor diameter wheel travelling at 200km/hr, which means over a million clicks an hour, or 300 per second. 3 milliseconds between events is just on the edge of what these could reliably count, even if they weren't doing anything else. You also want real-time calculation of a calibration constant (sensor clicks per mile), plus a display and real time control over a couple of separate trip markers.

There are other things, too, which make this kind of a big project. Look at a store-bought device which might be able to perform the functions you need:

formatting link

This device is self-powered, and relatively weatherproof. It's also tested and reliable. If you use the programmable lubrication and maintenance reminder functions, you might be satisfied with the results. And the price is about the same as the Radio Shack BASIC Stamp development kit alone.

Don't want to scare you off, but this doesn't really look like a newbie project.

Microcontroller BASIC Stamp Kit" or a couple of Picaxes and start in learning about microcontrollers in an interpreted language environment. Once you're there, you can get a development kit for PICs and start in on more complicated, higher speed/complexity stuff in assembler.

Good luck Chris

Reply to
Chris

--
Since you know the number of pulses per revolution and you know the
circumference of the inflated tire, why can\'t you just count the
 Click to see the full signature
Reply to
John Fields

et

nd do

ll

Thanks John. I hadn't thought of doing it like that. That would greatly reduce the memory requirements back down to what could be done with a PICAXE chip. The only major concern is the frequency. The signal would be at or about 200Hz maximum with a pulse width of 0.2ms.

Merry Christmas (I now I'm sick in the head doing this on Christmas morning :)

Seve

Reply to
sstrik

use one of the internal hardware counters. should be good tor 1000 times that speed.

calibration needn't be real time. push a button, drive a mile, push a button, calculate.

if it takes 10 seconds to calculate it's no big deal.

Bye. Jasen

Reply to
jasen

--
I don\'t know anything about PICaxes, but I don\'t think 200Hz would
be a problem since, in real time,  all you\'re concerned about is
 Click to see the full signature
Reply to
John Fields

Hi Steve, If you use a micro such as the PicAxe you can feed your pulse train into a pair of counters. You gate one counter on during the even numbered seconds and the other during odd numbered seconds. At the end of each second you turn the gate to one counter off and immediately gate the other on. You can now perform any math on the acquired count, and you will have a whole second in which to do it. You can also have the micro perform multiplexed data display. Although this will take some processing time, if it is well written the time will be insignificant.

If we assume a wheel diameter of 24 inches, then you will only get to 200Hz at 230kph. The hardware counters in the PIC are capable of over 1000 times that rate. You should also make sure that your input from the wheel sensor is properly debounced otherwise you will get wild results.

For calibration I would use a pair of pushbuttons, CalUp and CalDown, that raise and lower an integer calibration constant representing the distance travelled between pulses. For a 24 inch wheel, this equates to 319.2mm per pulse (assuming the pulses are equally spaced at 60 degrees apart). Since you are working with integer math I would use a value of 3192 as the initial calibration constant and then use the pushbuttons to "tweak" it as required. The fractional mm will be significant over any reasonable distance.

If you use 32bit long arithmetic you can easily handle the required math and have processing horsepower to spare by using interleaved counters.

HTH

Regards,

Gerry (From the land Down Under)

** Wishing all a happy and prosperous new year **
Reply to
Gerald Cohn

Just a quick update on where I'm at.

I'm coding an ATMEL AVR micro and coding in assembly (been a fun learnign experience so far.

I am looking to use some form of LCD driver chip for display, rather than the on chip stuff built into some AVR's.

I'm building the code up in small chunks, to try and keep my messy code understandable.

So far it's going well.

Regards

Steve

Reply to
sstrik

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.