Shop OBEX P1 Docs P2 Docs Learn Events
Strange Problem with project — Parallax Forums

Strange Problem with project

Matthew McCabeMatthew McCabe Posts: 2
edited 2005-12-16 22:22 in BASIC Stamp
hi everyone --

i'm having some trouble with a MIDI controller project and i thought the community might be able to help.

i'm using a BS2sx, which i've connected up to a Halex soft-tip dartboard that i've ripped the guts out of. the dart board is constructed with 10 contacts in the front, and 7 in the rear. when one pin from the front touches a pin on the back, you can determine which area of the dart board has been hit.

everything is working fine -- i have P0 through P9 connected to the 10-pin contact sheet with pull-down resistors, and P12, P13, and P14 connected to an 74HCT259 -- a 3-to-8 demultiplexor (since i don't have enough pins to use a pin for each contact point on the board). P10 is being used to send out MIDI messages.

everything is working great -- if i push with my finger down on the dartboard, the stamp sees it and successfully sends out a MIDI message. each region is connected correctly, and i can see the numbers coming in through my MIDI interface.

the trouble is, when i actually throw a dart at the board, it only senses the impact roughly 50-60% of the time. this is opposed to if i push down on the board region, where it detects 100% of time.

here is the code -- i wonder if anyone has a better implementation idea. i can post a schematic if necessary...

' matthew mccabe
' diffusion darts: basic stamp 2sx program
'
' this program detects dart impacts on a hot-rodded Halex dart board
' and sends out MIDI messages

' this program is based on the program given in Nuts and Volts #22
' by scott edwards

'set up variables
key VAR WORD ' area of the board that was struck
tenpin VAR WORD ' input states of pins p0 - p9
regionCode VAR BYTE ' code for identifying each board region
midipin CON 10 ' pin 10 will be used for MIDI serial out
baudmode CON 60 ' 31,250 bps on the bs2sx
outpause CON 0 ' pause between data sends

LOW 12
LOW 13
LOW 14
LOW 15

' here is the main loop. it waits for an impact on a row
' then calls the subroutine to send out the message
mainLoop:
FOR OUTD = 0 TO 6
tenpin.LOWBYTE = INL
tenpin.HIGHBYTE.BIT0 = IN8
tenpin.HIGHBYTE.BIT1 = IN9
IF NCD tenpin <> 0 THEN hitDetected
NEXT
GOTO mainLoop

hitDetected:
key = NCD tenpin
regionCode = key + ((OUTD + 1) * 10)
' DEBUG DEC regionCode, CR
SEROUT midipin, baudmode, outpause, [noparse][[/noparse]$90, regionCode, 127]
SEROUT midipin, baudmode, outpause, [noparse][[/noparse]$90, regionCode, 0]
RETURN



any help would be appreciated!

Comments

  • Philip GamblinPhilip Gamblin Posts: 202
    edited 2005-12-15 05:27
    From your description, I would try to carefully determine the difference between the 2 actions, touching vs dart impact. What first comes to mind is you're probabmly imparting much more force to the board with your touch than with the dart. I suspect the duration of the force of your is much longer than the brief impulse of force from the dart. Can you tke the dart in hand and press it into the board get 100% repeatability?
  • metron9metron9 Posts: 1,100
    edited 2005-12-15 05:55
    The impact of the dart may only be a 1 mS event. Looking at my scope and a small piezo earphone when I smack the earphone it's about a 1mS event. I assume you are running a voltage through the board. Just add a diode and capacitor and a bleed resistor to your output to hold the signal high for a few mS to give the stamp the time it needs to read the impact.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!
  • Matthew McCabeMatthew McCabe Posts: 2
    edited 2005-12-16 22:22
    metron9 -- yes, i suspected i'd have to use a capacitor to hold the charge for a bit longer than the dart hit... however, i'm a ph.d. music student -- what is a 'bleed resistor' ? a high value resistor that discharges the capacitor when the power is shut off?

    can someone post a schematic or a link to a helpful site / pdf / etc. ?

    many thanks... i'm having a ball learning about this stuff!
Sign In or Register to comment.