Shop OBEX P1 Docs P2 Docs Learn Events
RF mp3 project — Parallax Forums

RF mp3 project

Marshall WilsonMarshall Wilson Posts: 7
edited 2006-05-19 16:25 in BASIC Stamp
I'm planning on building a project that will play mp3 sound files when magnetic hall effect sensor switches are closed. There will be 10 switches corresponding to 10 sound files. sounds will come from a Gilderfluke unit that is binary-addressible inputs. I will need to transmit the switch values to the Mp3 unit wirelessly. I have 2 BS2 units and an RF transmit & receive unit.

I've never worked with the BS2 unit, nor have I programmed a microcontroller unit before. but I do have a degree in Elect. Engineering so I'm not too dumb.

I was going to connect the hall effect sensors to a diode array to create a 4-bit input string into a BS2. That string would be transmitted to the second BS2 with the RF units using the SEROUT command and some parity checking. Since the data transmitted is extremely simple i hope I can get away without two-way communication. Once the data has been read The second BS2 would output a 4-bit mp3 address to the mp3 unit. Range is not a big issue. I am wondering if I should debounce the inputs and if there is any basic issues I should be thinking about which may be obvious to those of you who've worked with the BS2 before.

I'd rather try to predict now what problems I'll face before I put the thing together and it doesn't work, so any comments would be greatly appreciated!

thanks

-marshall

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-07 23:04
    The BS2 has 16 I/O points, and you'll only need one to send the switch data, so you could simplify things by using P0..P9 as your switch inputs and the NCD operator to select one of 10.· The code would look something like this:

    Main:
    · DO
    ··· channel = NCD (INS & $3FF)
    · LOOP UNTIL (channel > 0)

    · ' transmit channel # (1 - 10)
    · ' insert pause before scanning if desired

    · GOTO Main
    ·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Marshall WilsonMarshall Wilson Posts: 7
    edited 2006-05-09 21:15
    Thanks Jon; For some reason I had it in my brain the BS2 only had 8 input/outputs so I didn't think of directly connectiong the switches. I had a complicated scheme in mind...this is much easier!
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-09 23:06
    The BS1 has 8 I/O points -- it would be a little tricky, but you could probably squeeze the code into it. That said, your serial baud rate would be limited to 2400.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Marshall WilsonMarshall Wilson Posts: 7
    edited 2006-05-11 20:44
    I just got the basic transmit section working with·4 switches - using the debounce code i found in the StampWorks library. I just have to figure out a way to transfer the binary switch data (0000000000, 0000000001, 0000000010, 0000000100, etc) into a binary address output (0000, 0001, 0010, etc ) which is what the Gilderfluke input needs. Perhaps this is what the NCD operator does - I have to look into the details of this later - now that I've verified that my basic premise/system is working. Then, once i have the Gilder working with inputs, i can build the prop around the electronics and refine the code.




    ·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-11 21:28
    So you want to convert a binary value (%0000, %0001, %0010, ... ) to a single output bit output that corresponds to a parallel input to the Gilderfluke?· If yes, then you're on the right track.· Another choice is LOOKUP which would let you re-map the inputs-to-outputs:

    · LOOKUP idx, [noparse][[/noparse]%00000000, %00000001, %00000100 ... ], outPins

    Use the table in LOOKUP to re-map the outputs.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Marshall WilsonMarshall Wilson Posts: 7
    edited 2006-05-19 16:25
    Thanks for all your help Jon - Everything worked out great. The book is installed in the gallery and works well with the wireless and everything. Now I'm planning refinements to future iterations of the idea!

    best,

    marshall wilson
Sign In or Register to comment.