Shop OBEX P1 Docs P2 Docs Learn Events
Re: Interfacing bs2 to shaft sensor and lcd — Parallax Forums

Re: Interfacing bs2 to shaft sensor and lcd

KERBSKERBS Posts: 26
edited 2004-12-16 00:55 in BASIC Stamp
jumpin.gif·'m really in over my head!!!
···· I want to input a speed signal ( hall effect wheel sensor), a rate signal (also a hall effect sensor reading magnets on a rotating shaft), calibration constants corrispond to real world units for the above signals. run some basic to output live speed, and rate of application to an LCD.·
···· the only thing is im way behind the 8 ball.· I bought a boe starter kit and started in on it, but i can see that at this rate ill be well into my nineties before get anywhere.
can someone point me in the right direction? or at least let me know if the bs2 can accomplish this?

yeah.gif
·· Any·basic stamp pros·out there want to take a real novice under his or her wing?
·

Comments

  • Ken GraceyKen Gracey Posts: 7,387
    edited 2004-10-13 03:57
    Kerbs,

    Yes, the BS2 can easily do this. Here's exactly what you are looking for:

    http://www.parallax.com/html_pages/robotics/machining/RPM_display.asp

    This uses a parallel LCD but you could use a serial if you desire. Do you still think you will be in your nineties when you figure this out? If so, there's another guy on this list who will soon be in his 90s and he's a good Stamp programmer!

    Ken Gracey
    Parallax, Inc.
  • KERBSKERBS Posts: 26
    edited 2004-10-15 17:44
    thank, that helped.
    ive got a test board hooked up, with a pulse generator, I ran a simple do:loop program on my stamp to simulate a situation. when i dubugged it seemed like some of the pulses got missed at higher frequencies ie 1000hz. is this because of overhead? how do i eliminate that?
  • BeanBean Posts: 8,129
    edited 2004-10-15 17:57
    Kerbs,
    How fast of pulses do you need to measure ?

    Terry
  • Ken GraceyKen Gracey Posts: 7,387
    edited 2004-10-15 18:05
    Kerbs,

    Are you using COUNT or PULSIN? Which Stamp are you using?

    If you are using the same arrangement as I have on the mill speedo then you will need to have the magnet very close to the sensor, if you are detecting changes in magnet poles rather than a magnet passing by the sensor. I think I placed the sensor and magnet within a few millimeters or so.

    Ken Gracey
  • BeanBean Posts: 8,129
    edited 2004-10-15 18:21
    Ken,
    It sounds like Kerbs is trying to count every pulse without missing any.
    Is that true Kerbs ?

    Terry
  • KERBSKERBS Posts: 26
    edited 2004-10-15 22:49
    Basic stamp 2, my simulation was done using count.
    As to the question regarding missing pulses. If I understand things correctly, count measures frequency. this would be a useful value for determining "live" rate (speed and shaft rotation), however, accumulated figures (area and toal lb applied) would have to be estimated by some means. if we also count and store accumulated pulses, calculations for area and lbs accumulated could calculated directly.
    By the way, thank you very much for helping. I really feel much more confident with all this help
  • KERBSKERBS Posts: 26
    edited 2004-10-18 15:25
    Is there a way to be counting and accumulating total pulse in the back ground to use for totals while I am monitoring the frequency of the pulses to use for "live" rates (Speed and application rate)?
  • KERBSKERBS Posts: 26
    edited 2004-10-19 15:02
    Can I use Another logic IC to do the counting
  • Ken GraceyKen Gracey Posts: 7,387
    edited 2004-10-19 16:25
    Kerbs,

    Yes, I've seen this done with weather stations (anenometers/rain buckets) and with wheel encoders for robots. I think the part is called a binary ripple counter. Others on this forum can recommend an exact part. It counts and increments a value you can retrieve at any time. Here's an example:

    http://www.sfu.ca/phys/430/Lab5.pdf

    Use Google "BASIC Stamp binary counter" or something similar and you'll get some labs from universities like the one above.

    Ken Gracey
    Parallax, Inc.
  • KERBSKERBS Posts: 26
    edited 2004-10-22 21:43
    Should I comunicate with the LCD via serial or paralell?
  • KERBSKERBS Posts: 26
    edited 2004-10-22 22:14
    OK, Here is what my plan is to this point. I will use a 8 or 16 bit counter to accumulate pulses from both sensors, these I will poll periodicly to produce readings for distance traveled, total acres applied, total revolutions, total product applied. I will use the count command on the bs2 to read pulse rates (frequency) to produce readings for aplication rate ( lb/ minute) and speed ( miles/ hr). The basic stamp will perform calculations based on these numbers and output to an LCD the desired information in useful units.
    To this end I have collected these Items cp82c54 with 3 independant 16 bit counter, 74LS590 8 bit counter, 74HC165 Parallel in/Serial out interface chip, and a 44780 LCD. Now, can any one help me from here. Do I need a to use the 16 bit counter, or will the 8 bit unit work for me. And Since the 16 bit counter has 3 independant counters, can I use it for counting both signals from the 2 sensors? And once I get this assembled, how the heck do I write the code?? AAAAAAAAAAAAAH
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-10-25 15:43
    You'll probably need to add a DS1302 RTC chip with coin-cell (CR2032) and crystal to keep real-time. You may also need a 24LC640 3-wire EEPROM to store data.

    top-level Pseudocode:

    while 1 DO
    Read time until one second has passed
    Read wheel counters, convert to distance traveled, and store.
    Read product application counters, convert to produce amount, and store.
    Generate desired metrics for LCD (Application Rate, Speed)
    Display Metrics on LCD
    END WHILE
  • Ken GraceyKen Gracey Posts: 7,387
    edited 2004-10-25 18:04
    Kerbs,

    You shouldn't write the code starting with a massive pile of parts wired up to the BASIC Stamp. You need to start in small pieces, working from a breadboard. First, get the counter working with the sensors. Then, develop the code to have the Stamp do the math for application rate and speed. Use DEBUG to show the values. Once it is working add an LCD for display (I recommend a serial version for starters - keep it simple and switch to a parallel if you are going to make several such gizmos).

    Start with a couple of components and a BASIC Stamp. Then, post your specific question for the particular part and task. We can help you much easier that way. Okay? Build this one step at a time, keeping the whole project in mind.

    Ken Gracey
    Parallax, Inc.
  • KERBSKERBS Posts: 26
    edited 2004-12-05 20:58
    Any one else have any input on the subject, im really really stuck
  • BeanBean Posts: 8,129
    edited 2004-12-06 03:44
    What part are you having trouble with ?

    Are you getting pulses from the shaft sensors ?

    Can you count the pulses (or pulse frequency) ?

    Can you communicate with the LCD ?

    As Ken has said earlier, you must tackle projects one piece at a time. Get one part working then move on to the next. I would start with the LCD, because then you can use the LCD to debug and test the other parts of the system.

    Bean.
  • KERBSKERBS Posts: 26
    edited 2004-12-16 00:55
    Having prob with reading freq at very low hz. 0.30 - 8.0 hz i've got all else worked out.
Sign In or Register to comment.