Shop OBEX P1 Docs P2 Docs Learn Events
CMUCam Help Required! — Parallax Forums

CMUCam Help Required!

John BoardJohn Board Posts: 371
edited 2012-12-03 17:56 in Accessories
G'day,

I got a nice, shiny new red box today, straight from Sparkfun, with a spankin' new CMUCam in it! The only problem is... I've no clue how to hook it up, and code it... I've looked for docs (and still am), but each one only seems to solve one bit of the problem, nothing really shows the entirety of the solution. Does anyone know where I can lay my hand on "wiring" docs, and coding docs? I'd also be appreciative if anyone has some sample code I could test...

Thanks :D

-John

Comments

  • charleyshfcharleyshf Posts: 165
    edited 2012-11-04 03:37
    Hello,

    Did you look at this page here? http://cmucam.org/projects/cmucam4/wiki/SparkFun_Camera
    That page has a link called "Board Layout and Port Information" among other things, looking at hat shows you the hookups.

    http://cmucam.org/attachments/689/CMUcam4%20Arduino%20Shield%20DOC%20BL&P%20-%20v10.pdf
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-11-08 06:56
    xainnasir wrote: »
    please post the link of the CMUCam which u have bought

    John mentioned in the top post, the camera was from SparkFun. Here's the link.

    I'm pretty sure another version of the CMUcam is being made by Parallax. I don't know how long it will take Parallax to get them produced and up for sale. I'm personally waiting for the Parallax version since I don't like the "shield" form factor.
  • SRLMSRLM Posts: 5,045
    edited 2012-11-08 08:26
    I think xainnasir is spamming...
  • John BoardJohn Board Posts: 371
    edited 2012-12-03 15:12
    Sorry Guys, I've been away on an 'extended holiday'...

    I've found out how to hook it up etc, and I am now writing the code. For simplicity sake I'm using the Prop, this is what I have so far...
    CON
    
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    
      CR = 13
    
    
    OBJ
    
    
      Serial: "FullDuplexSerialPlus"
      Comp: "FullDuplexSerialPlus"
    
    
    VAR
    
    
      long recv
      
    PUB Start
    
    
      Comp.start(31, 30, 0, 9600)
      Comp.str(String("CMUCamv4 Driver", CR))
      Comp.str(String("Author: John Board", CR))
      Comp.str(String("(c) 2012 John Board", CR))
      Comp.str(String("----------------------------",CR, CR))
    
    
      Comp.str(String("Waiting for CMUCam to initalize...", CR))
      waitcnt(clkfreq*5+cnt)
      Comp.str(String("Attempting to connect to CMUCam...", CR))
    
    
      Serial.start(1, 0, 0, 19200)
      Comp.str(string("Serial Started.", CR))
    
    
      waitcnt(clkfreq/1+cnt)
    
    
      Comp.str(string("Toggling LED.", CR))
    
    
      ledOff
      Serial.rxStr(@recv)
      comp.str(string("Recieved: "))
      comp.str(recv)
    
    
      repeat
    
    
    PUB Stop
    
    
      Serial.stop
    
    
    PUB ledOn
    
    
      sendCommand(String("L0", 13))
    
    
    PUB ledOff
    
    
      sendCommand(String("L1", 13))
    
    
    PUB getVersion
    
    
      sendCommand(String("GV", 13))
    
    
    PUB resetSystem
    
    
      sendCommand(String("RS", 13))
    
    
    PUB sleepDeeply
    
    
      sendCommand(String("SD", 13))
    
    
    PUB sleepLightly
    
    
      sendCommand(String("SL", 13))
    
    
    PUB sendCommand(Command)
    
    
      Serial.Str(Command)
    
    
    DAT
    {{
    ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
    │                                                   TERMS OF USE: MIT License                                                  │                                                            
    ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
    │Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation    │ 
    │files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,    │
    │modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software│
    │is furnished to do so, subject to the following conditions:                                                                   │
    │                                                                                                                              │
    │The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.│
    │                                                                                                                              │
    │THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE          │
    │WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR         │
    │COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,   │
    │ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                         │
    └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
    }}  
    

    Can anyone see any issues with it? It doesn't seem to be turning off the Red LED on the board.

    Note: This code is very preliminary, I only started working on it like 1/2 hour ago...

    As another note, I myself don't like the sheild formfactor either :P I would have waited for parallax to release their version, however I need something up and running ASAP.

    Thanks,

    John
  • John BoardJohn Board Posts: 371
    edited 2012-12-03 15:58
    Disregard the last post... I just sent a command to the CMU and it responded ;D I'll post the relay code here later.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-03 16:11
    John Board wrote: »
    As another note, I myself don't like the sheild formfactor either :P I would have waited for parallax to release their version, however I need something up and running ASAP.

    I had been waiting for the Parallax version but apparently they aren't going to be making one. Kye just mentioned this.

    Looks like I'll get the SparkFun version.
  • John BoardJohn Board Posts: 371
    edited 2012-12-03 16:43
    I wrote a terminal (because I don't have a propplug), When I issue the SB (Send Bitmap) command (P41 of the command reference), it returns PART of the result, but never all...
    CON
    
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    
      CR = 13
    
    
    OBJ
    
    
      Serial: "FullDuplexSerialPlus"
      Comp: "FullDuplexSerialPlus"
    
    
    VAR
    
    
      long recv[100]
      
    PUB Start | directory
    
    
      Comp.start(31, 30, 0, 9600)   'Start serial with computer
      Serial.start(1, 0, 0, 19200)  'Start serial with camera
      Comp.str(String("CamTerm v1.0", CR))
    
    
      serial.rxStr(@recv)
      serial.rxStr(@recv)           'Wait for camera to send it's name... (CMUCam4 v1.02)
    
    
      Comp.str(string("Camera Ready!", CR))
      
      Comp.str(String("----------------------------",CR))
    
    
      'Terminal
      
      repeat
        comp.str(directory)
        comp.str(string("> "))
        comp.rxStr(@recv)
        comp.tx(CR)
        
        serial.str(@recv)
        serial.str(string(" '\r'", CR))
    
    
        repeat 'This makes the terminal only work for one command, but it dumps all the output of the camera
          serial.rxStr(@recv)
          comp.str(@recv)
          comp.tx(CR)
        
    
    
    DAT
    {{
    ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
    │                                                   TERMS OF USE: MIT License                                                  │                                                            
    ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
    │Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation    │ 
    │files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,    │
    │modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software│
    │is furnished to do so, subject to the following conditions:                                                                   │
    │                                                                                                                              │
    │The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.│
    │                                                                                                                              │
    │THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE          │
    │WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR         │
    │COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,   │
    │ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                         │
    └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
    }}  
    

    The terminal output:
    SCamTerm v1.0
    Camera Ready!
    ----------------------------
    > SB
    
    
    :ACK
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿ
    

    It doesn't seem to finish the transmission before stopping... any ideas?

    EDIT: With a bit of trickery I think I can get around this using a serial.rx instead of serial.rxStr.... Although any ideas on the above solution will be greatly appreciated :)
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-03 16:52
    It could be a buffer problem. Try using a serial object that lets you change the rx buffer. Tracy Allen's four port driver is a good one for this.

    There could also be a problem with the "rxstr" limiting the size of a string.
  • John BoardJohn Board Posts: 371
    edited 2012-12-03 17:56
    Thanks, I'll look into it.

    At the moment I'm just improving my software and writing a small java GUI. I'll post when I have a nice usable library :D
Sign In or Register to comment.