Shop OBEX P1 Docs P2 Docs Learn Events
Tachometer with IR LED and BOEBOT RECEIVER — Parallax Forums

Tachometer with IR LED and BOEBOT RECEIVER

ErikLErikL Posts: 4
edited 2015-01-02 17:32 in BASIC Stamp
Hi guys, hopefully somebody might be able to help me out with this. My dad likes to work on watches and wants to have a tachometer that measures the rpm of various unknown hairsprings. I am trying to help him out with his project and my initial idea was to use an IR LED/BOEBOT RECEIVER combo. I have the circuit built on my basic stamp and thus far have tested one program which senses when the IR beam is reflected. My thought was to then implement a counter using the count command to find the rpm value for various springs. I tried the sample program from the help menu with some minor changes to pin assignments and the powering of the IR LED instead of a pushbutton but all I get is a constant readout of 0 rpm. Is it possible to use the count command with the state of an IR receiver or am I making an incorrect assumption?

The code for testing the IR circuit is below:

' {$STAMP BS2}
' {$PBASIC 2.5}

irDetect VAR Bit
DO
FREQOUT 10, 1, 38500
irDetect = IN13
DEBUG HOME, "irDetect = ", BIN1 irDetect
'PAUSE 100
LOOP

The code for the counter program is below:

IRsensor VAR Bit

DurAdj CON $100 ' / 1

Capture CON 1000 ' 1 second

cycles VAR Word ' counted cycles


Main:
DO
FREQOUT 10, 1, 38500
IRsensor = IN13
PAUSE 100

COUNT IRsensor, (Capture */ DurAdj), cycles
DEBUG CR, "RPM: ", DEC cycles, CR
PAUSE 1000
DO : LOOP UNTIL (IRsensor = 1) ' wait for button press
LOOP
END
The initial help program was for a active low pushbutton circuit and I noticed that when IRsensor = 1 in the second DO LOOP it continues to repeat and when I change it to 0 the program stops. So I am wondering if it doesn't have time to recognize a change in states or if the state itself is not an "impulse" like the change of a pushbutton? I unfortunately cannot use a hall effect sensor because the hairspring is obviously metal which means it could be effected by a magnetic field and the oscillations could be effected. So I am currently at a roadblock, any help would be much appreciated.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2014-12-28 13:35
    You're not going to be able to do this with just a Stamp. The problem is that the IR receiver requires a modulated IR source, but the Stamp can only do one thing at a time. When the Stamp is producing modulated IR using the FREQOUT statement, it's doing nothing else. When the FREQOUT ends (to do the COUNT sensing), the IR stops. Page 191 in "IR Remote for the BoeBot" (here: http://www.parallax.com/sites/default/files/downloads/70016-Web-IR-Remote-for-the-Boe-Bot-v1.1.pdf) shows how to make a modulator for the IR LED using a 555 timer that you can turn on and off with an I/O pin (HIGH / LOW). You can turn the modulator on, do your COUNT, then turn the modulator off and display the count.
  • ErikLErikL Posts: 4
    edited 2014-12-28 14:12
    Ah, thanks for the help. I guess it is time to buy some more components. I also had a quick question with reference to the circuit diagram. Does the NC for the potentiometer mean not connected? I have never seen that symbol in any schematic, granted I don't do too much in the way of electronics. If this is true is the pot then acting like a variable resistor and simply connected to pin 6 and pin 7 of the timer chip?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-12-28 19:02
    ErikL wrote: »
    Does the NC for the potentiometer mean not connected?

    Yes, NC stands for not connected. It is relatively common to see "NC" on schematics.
    ErikL wrote: »
    If this is true is the pot then acting like a variable resistor and simply connected to pin 6 and pin 7 of the timer chip?

    Right again.

    Pots are often used as a voltage divider but here the pot is being used as a variable resistor (as a single component of a more complex circuit).
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-12-29 10:33
    You could use the BASIC Stamp as a tachometer if you were using a standard IR LED and phototransistor. First you would have to make sure the IR LED and phototransistor were reflecting properly against the surface you wanted to detect and then you could use the count command over the course of say, one second to count the pulses. Multiply that times 60 and you have rotations per minute (RPM). This was used in a Mill Machine Tach Project by Ken Gracey. Sadly the original links are broken. It used a Hall-Effect sensor, however the IR LED and Phototransistor could be used just as easily.
  • ErikLErikL Posts: 4
    edited 2014-12-29 11:28
    I thought about using a phototransistor but the watch hairspring has a center spoke that would be used as the data point for breaking the beam of an IR LED. I don't know if this would work with the phototransistor because of the size of the center spoke and the competition with the ambient light.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-12-29 15:01
    The manner I am speaking of would require the IR to reflect off one of the spokes of the internal gears. It may be difficult to get sufficient focus to do that, but no more than trying to use the 40 kHz detector. The benefit is that if you can detect the threshold of the signal between seeing a spoke and not, you could dial it into the logic threshold and use that to give a 0 or 1 response for a spoke / no-spoke.
  • ErikLErikL Posts: 4
    edited 2015-01-02 17:32
    So, I finally received the 10k pot and 555 chip today and was attempting to build the circuit and run the test code which Mike Green suggested and I am having some issues. When I run the program I just get a value of 0 on the debug screen no matter how I adjust the pot. I have checked over the circuit multiple times and I am fairly certain it is correct. I don't know if I should post a pic of the actual circuit on the bread board or if any of you might have an idea what the problem might be without a pic. I bought the capacitor from RadioShack. It is the .01microfarad 50v 10% PC-Mount capacitor. You can actually see the part if you go to their website and search part number 272-1065. Here is a link for the specs: http://www.radioshack.com/0-01uf-50v-10-pc-mount-capacitor/2721065.html#.VKdGGBs5C01

    In an attempt to provide a little more information here is my circuit in "word" form. Maybe I am not reading the schematic correctly:

    Pin 1 of 555 chip: have a jumper going to the ground as well as one end of the capacitor
    Pin 2 of 555 chip: the other end of the capacitor as well as a jumper going to pin 6 of the 555 chip
    Pin 3 of 555 chip: one end of a 220 resistor and the other end of resistor to free space on the breadboard
    Pin 4 of 555 chip: one end of a 220 resistor and the other end of resistor to free space on the breadboard which is then jumped to pin of basic stamp
    I have the IR LED cathode sharing same row as free end of resistor from pin 3 which is then jumped to pin and anode of IR LED jumped to ground
    Pin 5 of 555 chip: nothing
    Pin 6 of 555 chip: one end of jumper with other end of jumper going to free space on bread board which then shares same row with middle pin or "wiper" of Pot
    Pin 7 of 555 chip: one end of 470 resistor with other end going to VDD as well as one end of jumper which goes to free space on bread board which then shares one other pin of Pot
    Pin 8 of 555 chip: jumper going to VDD

    I don't know if this helps at all however I am definitely stuck trying to get this calibration circuit to work and a peculiar thing I noticed was if I remove the IR LED and run the program I get a debug screen which shows varying frequencies related to how I adjust the pot but then when I replace the IR LED it goes back to 0 with no change regardless of pot adjustment.
Sign In or Register to comment.