Shop OBEX P1 Docs P2 Docs Learn Events
Voice My Bot! — Parallax Forums

Voice My Bot!

BotdocterBotdocter Posts: 271
edited 2010-05-06 01:02 in Propeller 1
I have this chip laying around;

pdfdata.datasheetsite.com/web/57418/ISD4002-120.pdf

Can anyone tell me if it is 'do-able' to let this work with the propeller?

it can record/play 120 seconds in total and every recording has a unique adress so it can be used by microcontrollers. .....or so i read
any help is welcome.


Thanx in advance!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1 Parallax Propeller Robot Control Board
1 Memsic MX2125 accelerometer/ tilt
1 Parallax Ping))) ultrasonic sensor

a few motors and a whole lot of chaos!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-05-01 12:38
    It should be "do-able". The device can operate from a 3.3V supply, so you don't need voltage translation. From the controller's standpoint, it's an ordinary SPI interface which the Propeller can do and there are all sorts of examples in the Object Exchange of SPI interfaces.

    The question is "how much do you know?". The datasheet gives sample circuits which should work. It describes the layout of the information needed to control the device. Can you take some of the SPI examples for the Propeller and modify them to work with this device? It shouldn't be hard, but it's not a beginner's project.
  • BotdocterBotdocter Posts: 271
    edited 2010-05-02 17:13
    Ok i'm quite a newbie although i seem to pick up the language pretty well.

    So i will probably need some help with the code. I'll make the connections first and will return then

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 Parallax Propeller Robot Control Board
    1 Memsic MX2125 accelerometer/ tilt
    1 Parallax Ping))) ultrasonic sensor

    a few motors and a whole lot of chaos!
  • VIRANDVIRAND Posts: 656
    edited 2010-05-04 10:33
    I got that chip to work in Spin but not reliably.
    I'm not sure why but it forgets things when I record more than one
    and turn it off and on again. Maybe I'm overloading the protoboard.
    Anyway, I can't upload my program now due to a technical problem,
    but Maybe I could type it. It works like this:
    Experimentally, I defined each number key as one of the i2c commands
    and there's a few to start recording, a few to start playing, one to skip
    to the next sound, one to go to the beginning, one to goto the end,
    one to sleep, one to powerup, one to powerdown, as I recall.
    Skip to next sound was the one that seemed most unreliable to me,
    where eventually it just stopped working and I'd have to wait for the
    sound to end before playing the next one, and annoying glitches like
    that.

    That's probably all it was, glitches. If you can read the timing diagrams
    on the data sheet and toggle the pins that way in Spin when a key is
    pressed, and hook up the ISD chip like the data sheet says, and mind the
    difference in voltage between Propeller and ISD chips, it should work.

    It seems to me that the ISD chips are 15 years old, and now for around
    the same price you can get a complete digital recorder with a lot more
    time on it, which can be modified for a project by just wiring into the buttons.
    Or you can get a pair of "voice memo keychains" for even less and wire
    into their record/play buttons. Then there are talking greeting cards... etc.

    edit: I found the ISD2560 and ISD25120 to be Very Much easier to program,
    but they are practically both the same chip, with one sampling at 8Khz and
    the other at 4Khz (for twice the time but only good for telephone quality
    voice). They were capable of being operated with record and play "buttons"
    instead of i2c. To choose random sounds though you needed a parallel port.

    Post Edited (VIRAND) : 5/4/2010 10:47:09 AM GMT
  • BotdocterBotdocter Posts: 271
    edited 2010-05-04 12:14
    I do need to choose random sounds. I just wanted to use this chip because it sounded easyer than getting the wav player to work. But now i hear this, i might dive into the wavplayer again.

    Mp3 players or voice recorders wont work because i need to play the sounds have to be accesible randomly.

    Thank you though...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 Parallax Propeller Robot Control Board
    1 Memsic MX2125 accelerometer/ tilt
    1 Parallax Ping))) ultrasonic sensor

    a few motors and a whole lot of chaos!
  • BotdocterBotdocter Posts: 271
    edited 2010-05-04 12:18
    If it forgets your recording, are you overwriting the same adress? I should save all records under a certain adress. If you don't change the adress before rec. Then you will overwrite the last rec.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 Parallax Propeller Robot Control Board
    1 Memsic MX2125 accelerometer/ tilt
    1 Parallax Ping))) ultrasonic sensor

    a few motors and a whole lot of chaos!
  • VIRANDVIRAND Posts: 656
    edited 2010-05-04 19:50
    Botdocter said...
    If it forgets your recording, are you overwriting the same adress? I should save all records under a certain adress. If you don't change the adress before rec. Then you will overwrite the last rec.
    Its not forgetting the recording usually, just either forgetting the end of it,
    or changing the end of it to the end of all recordings. I think its just a glitch
    caused by overloading the voltage regulator on the board though, especially
    at bootup (maybe).
    Although I think a wavplayer would be a simpler and more modern way to do it
    especially IF (because I don't know) the chips maybe no longer in production and
    you might want more than one, but also because all the wav objects are already done.
    I may be able to post my code soon for ISD400X and I'm sorry that I'm delayed but
    glad I happen to have something relevant and moderately significant done in advance.

    My code does not bother with addresses, as it only uses the simple commands
    necessary to record and playback messages in order. I did not implement any
    Read commands, nor address commands, since I was just experimenting with
    the chip at the time, for simply taking messages. I put it on the shelf when someone
    was annoyed with the repetitive sounds I was making with it, and I forgot about it
    before I solved the glitch problem. Thus I think the program is very small and
    simple and I'll try to post it soon. ... BTW it uses tv_text.spin object to display the
    keyboard keys and what they do, and which ones were pressed while testing,
    which is good for trying the chip on a demoboard, but I don't know if the robot
    boards have demoboard compatible pin configuration.
  • BotdocterBotdocter Posts: 271
    edited 2010-05-04 21:25
    Not really. I have no ps2, vga or composite conn.
    I use serial terminal for all my output.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 Parallax Propeller Robot Control Board
    1 Memsic MX2125 accelerometer/ tilt
    1 Parallax Ping))) ultrasonic sensor

    a few motors and a whole lot of chaos!
  • VIRANDVIRAND Posts: 656
    edited 2010-05-05 21:48
    Sorry it took so long to find this, and it may not be exactly what you want
    but the part you need is very small and all the rest of the code can be made
    into an independent Propeller Chip serial terminal with a serial object and a
    keyboard and TV if you like. The ISD driver has a minor read bug but is sufficient
    to operate the ISD-4000 series sound chips. I just added lots of comments to help.

    I could not attach a spin file, due to the nature of a technical problem.

    '' Propeller terminal console for ISD-4000 series voice recorder chips,
    '' Contains code for INCOMPLETE no-PC Propeller serial terminal.
    '' This program was designed to be PC-independent Propeller app.
    '' Serial object not included. Terminal is used as control panel
    '' for ISD-4003 chip using TV display and PS/2 keyboard.
    '' Terminal and ISD code may be separated, completed,
    '' and used independently or as needed.
    '' Pin configuration is "protoboard,demoboard or common" but not Hydra.
    ''
    '' MIT license may apply according to Parallax
    '' No restrictions intended by author virand.com
    '' Unknown date of program. Comments added May 2010.
    ''  
    '' TV and Keyboard driver objects are common, thus not included.
    
    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    VAR
      word  aa            '   This is used by and for ISD par
      byte  ctrlflg       '***These vars used by kb/tv term console
      byte  escflg
      byte  codeflg
      byte  colorflg
      byte  backgcolor
      byte  foregcolor 
      byte  cursor_chr
    
    OBJ    ' *** THESE OBJECTS USED ONLY BY TERM
      text : "tv_text"
      key  : "ComboKeyboard.spin"
    ' serial terminal i/o was never yet implemented for this terminal 
    
    PUB start | i, curr_key, a, b, c, x, y  '***TERMINAL CONSOLE PUB CODE
    
      cursor_chr:=127     'CURSOR 127 is a square cursor
      colorflg:=0         'flags for when special keys are in effect
      escflg:=0
      codeflg:=0
    
      'start term                      ADDED:***ISD CHIP MENU DISPLAY on TV
      text.start(12)                   'TV video jack pins (demoboard)
      key.start(26)                    'PS/2 Keyboard jack pins (demoboard)
      text.str(string($C,8,"Terminal Console for ISD4000 Sound Chip",$D))
      text.str(string($C,8,"1-chip on (twice for new recording)",$D))
      text.str(string($C,8,"2-Play track 1",$D))
      text.str(string($C,8,"3-Play next track (unreliable in play?)",$D))
      text.str(string($C,8,"4-Record new starting at Track 1",$D))
      text.str(string($C,8,"5-Record next track (use 1-1-5)",$D))
      text.str(string($C,8,"6-Pause/Stop (use 3 to continue)",$D))
      text.str(string($C,8,"7-Turn off Sound Chip",$D))
      text.str(string($C,8,"8-Skip to next track (unreliable?)",$D))
    
      text.out(cursor_chr)                 '***TERM CONS: initialize cursor
      text.out(8)
    
      DIRA[noparse][[/noparse]7..0]:=%10001011                'ISD tester pins
    
      repeat                               '***TERM CONS:type on screen loop
        curr_key:=0
        if (key.gotkey==TRUE)
          curr_key := key.getkey
    
    '*** print character to screen (formerly used only for TERM?)
    
    '    if curr_key==true
    '      text.out(8)
    '      text.out(32)
    '      text.out(8)
    
        if curr_key==200            'backspace
          text.out(32)
          text.out(8)
          text.out(8)
          text.out(cursor_chr)
          text.out(8)
          curr_key:=8
    
        if curr_key==192            '<--
          text.out(32)
          text.out(8)
          text.out(8)
          text.out(cursor_chr)
          text.out(8)
          curr_key:=8
    
        if curr_key==9              'Tab
          text.out(32)
          text.out(9)
          text.out(cursor_chr)
          text.out(8)
          curr_key:=2
    
        if curr_key==193            '-->
          text.out(32)
          text.out(cursor_chr)
          text.out(8)
          curr_key:=9
    
        if curr_key==196            'Home
          text.out(32)
          text.out(1)
          text.out(cursor_chr)
          text.out(8)
          curr_key:=1
    
        if curr_key==197            'End (clear)
          text.out(32)
          text.out(0)
          text.out(cursor_chr)
          text.out(8)
          curr_key:=0
    
        if curr_key                 'setcolors
         if colorflg
          text.out(12)
          text.out(curr_key&$0F)
          colorflg:=0
          curr_key:=0
    
        if curr_key==265            'untab = color
          colorflg:=1
          curr_key:=0  
    
        if curr_key==222            'Caps Lock
          curr_key:=0
    
        if escflg                   'ESC for high characters
         if curr_key
          curr_key := curr_key | 128
          escflg := 0
    
        if curr_key==203
          escflg:=1
          curr_key:=27
    
        if codeflg                  '***PrintScr used to TEST odd key codes
         if curr_key
           text.out(curr_key/100//10+48)
           text.out(curr_key/10//10+48)
           text.out(curr_key/1//10+48)
           codeflg:=0
    
        if curr_key==13             'ENTER
           text.out(32)
           text.out(13)
           text.out(cursor_chr)
           text.out(8)
    
        if curr_key==220            'push PrtScrn for key code(activates) 
          codeflg:=1 
          curr_key := 0
    
        if curr_key>31
         if curr_key<254
          text.out(curr_key)
          text.out(cursor_chr)
          text.out(8)
    
    '*** USE KEYS TO SEND I2C COMMANDS TO PUB ISD(commandcode)
    
          aa:=00
          if curr_key==49
            aa:=ISD(%00100_00000_000000)'1=on (2x for record)
          if curr_key==50
            aa:=ISD(%11100_00000_000000)'2=play
          if curr_key==51
            aa:=ISD(%11110_00000_000000)'3=playmore
          if curr_key==52
            aa:=ISD(%10100_00000_000000)'4=record
          if curr_key==53
            aa:=ISD(%10110_00000_000000)'5=recordmore
          if curr_key==54
            aa:=ISD(%00110_00000_000000)'6=stop
          if curr_key==55
            aa:=ISD(%00010_00000_000000)'7=off
          if curr_key==56
            aa:=ISD(%11111_00000_000000)'8=skip  
                     
    
          if aa==true         '*** Used to test if ISD sent back data???
            text.out(aa&255)
            text.out(13)
            text.out(cursor_chr)
            text.out(8)
    
            
    
    PUB ISD(pp):qq|rr,jj,kk   '***I2C DRIVER FOR ISD-400X SOUND CHIPS
        qq:=0                 '***Believed to be output only
        rr:=1
        kk:=pp/2048
        outa[noparse][[/noparse]0]:=0            'Initial state of i2c bus?
        outa:=1            'CE activated?
        outa:=0
        outa[noparse][[/noparse]0]:=0
    
        repeat jj from 0 to 15  'Send command code
          qq:=(qq*2)+ina     'Receive data from ISD? ***BUG???ina???
    '      outa[noparse][[/noparse]0]:=1           '<<<NOT USED
          outa:=(pp&rr)/rr   'BitBang i2c Data Out to ISD
          outa[noparse][[/noparse]0]:=1
          rr:=rr*2
          outa[noparse][[/noparse]0]:=0
    '      outa[noparse][[/noparse]7]:=(pp&rr)/rr  '<<<******REMOVE******
        outa:=1              'Final state. CE released? 
    
        text.out(pp&255|96)     '***Display ("something?") on TERM CONS
    
    
    
    ''  *NEW COMMENTS on probable or likely pin functions* (unconfirmed)       
    ''  OUTA[noparse][[/noparse]0] is ... P0 OUT   Clock i2c out to ISD SCL
    ''  OUTA is ... P1 IN    Write command to ISD SDA (connected to P2?) 
    ''  OUTA is ... P2       Read data from ISD SDA? ***BUG???Not used
    ''  OUTA is ... P3 OUT   ChipEnable i2c port of ISD???
    
    
    '' note: unexplained disappearance of 3 in brackets after outa during posting;
    '' so if you happen to see an outa with nothing after it, insert a 3 in brackets.
    
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I should be typing in Spin now.
    Coming soon. My open Propeller Project Pages and favorite links index.

    Post Edited (VIRAND) : 5/5/2010 10:04:27 PM GMT
  • VIRANDVIRAND Posts: 656
    edited 2010-05-05 21:54
    NOTE:
    The code did not arrive as sent, which is another typical anomaly of "my problem".
    I noticed outa dropped the .
    Now editing to see if I can fix that and other issues. FAIL. Corrections:

    PUB ISD(pp):qq|rr,jj,kk '***I2C DRIVER FOR ISD-400X SOUND CHIPS
    qq:=0 '***Believed to be output only
    rr:=1
    kk:=pp/2048
    outa 0 :=0 'Initial state of i2c bus?
    outa 3 :=1 'CE activated?
    outa 3 :=0
    outa 0 :=0
    repeat jj from 0 to 15 'Send command code
    qq:=(qq*2)+ina 1 'Receive data from ISD? ***BUG???ina???
    ' outa 0 :=1 '<<<NOT USED
    outa 1 :=(pp&rr)/rr 'BitBang i2c Data Out to ISD
    outa 0 :=1
    rr:=rr*2
    outa 0 :=0
    ' outa 7 :=(pp&rr)/rr '<<<******REMOVE******
    outa 3 :=1 'Final state. CE released?
    text.out(pp&255|96) '***Display ("something?") on TERM CONS



    '' *NEW COMMENTS on probable or likely pin functions* (unconfirmed)
    '' OUTA0 is ... P0 OUT Clock i2c out to ISD SCL
    '' OUTA1 is ... P1 OUT Write command to ISD SDA (connected to P2?)
    '' INA2 is ... P2 IN Read data from ISD SDA? ***BUG???Not used
    '' OUTA3 is ... P3 OUT ChipEnable i2c port of ISD???


    Strange failure of all numbers in brackets to post within code? confused.gif

    Post Edited (VIRAND) : 5/5/2010 10:13:26 PM GMT

  • VIRANDVIRAND Posts: 656
    edited 2010-05-05 23:05
    Can anyone else see missing brackets and numbers after outa in my code post?
    Months ago I complained about receiving corrupted Spin files,
    and I didn't even have this computer then.
    I'm guessing the code may have posted correctly, but somehow returns corrupted.

    Post Edited (VIRAND) : 5/5/2010 11:10:54 PM GMT
  • BotdocterBotdocter Posts: 271
    edited 2010-05-06 01:02
    Thank you so much!

    I didn't had the time to look at it yet because my partner de-headed my robot, while waving his legs (dont ask!). But will post when i got to it.

    Have an optical mouse sensor coming in in a few days too. It's for navigation. So a lot of programming to be done! Woohoo!!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 Parallax Propeller Robot Control Board
    1 Memsic MX2125 accelerometer/ tilt
    1 Parallax Ping))) ultrasonic sensor

    a few motors and a whole lot of chaos!
Sign In or Register to comment.