Shop OBEX P1 Docs P2 Docs Learn Events
Using a NES Controller to control a Boe-Bot - Page 2 — Parallax Forums

Using a NES Controller to control a Boe-Bot

2»

Comments

  • bulkheadbulkhead Posts: 405
    edited 2006-07-08 01:16
    Looks like you are on your way to getting it working. I'd just like to say, if you do get it working, it would be nice if you could create a post in the projects section explaining how to wire up everything and sample code. There's already one for ps2 controllers.

    You could power your boe-bot on and off from your controller IF you added a separate switch leading the power wires out to your controller. Since all NES controllers are wired (correct me if I am wrong) adding an extra 2 wires going to the controller shouldn't get in the way too much.
  • Zsy6Zsy6 Posts: 37
    edited 2006-07-08 05:35
    Ill try rewiring the controller on the breadboard and see what happens, btw a company called messiah does sell wireless NES controllers.
  • dbc1218dbc1218 Posts: 33
    edited 2006-07-09 19:23
    I'm sorry about that, I was using the gamesx info and thats for the SNES controller. The gamesx site also says that the NES is the same as the SNES controller in the color of the wire and it's function.So just match the color of the wires and it should work.

    Brown wire - Ground - Vss
    White wire - +5 volts - Vdd
    Yellow wire - Clock - Stamp I/O Pin 2
    Red wire - Serial Data - Stamp I/O Pin 0
    Orange wire - Latch - Stamp I/O Pin 1
  • Zsy6Zsy6 Posts: 37
    edited 2006-07-09 23:20
    I have everything wired right, but I don't think thats the problem, the BS2 doesnt seem to be working at all sad.gif the light wont go on, and when I turn it on to number 2, activating the servos, the transistor next to the servo inputs heats up ery quickly, what should I do? freaked.gif
  • Zsy6Zsy6 Posts: 37
    edited 2006-07-09 23:56
    It seems that unplugging the NES controller's Vdd pin fixes this problem but since I want this thing to work WITH the NES controller plugged in I need to find some sort of solution to this problem I may make a 5 volt battery pack for the controller with an extra battery pack and a few resistors, but if there is an easier way please tell me.
  • Zsy6Zsy6 Posts: 37
    edited 2006-07-13 18:06
    I still need help, is there any reason y the nes controller would cause the BS2 to heat up?
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-13 21:27
    · It probably didn't like having that PIN tied to +5, so you might try using a different PIN.

    · Which wire from the NES-thing is it that results in this heating up?· That'll be a clue.

    · [noparse][[/noparse] Regarding the 'serial, 'clock', and 'latch' wires -- perhaps a 220ohm resistor in series between them and the STAMP Pin/s. ]
  • Zsy6Zsy6 Posts: 37
    edited 2006-07-14 01:29
    The wire that is causing this to happen is the +5v wire that powers the controller's encoder chip, it's hooked up to Vdd, and I dont understand y it doesnt work.....
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-14 02:08
    · Maybe the revised interconnect provided by dbc1218 isn't quite right either.

    · If I had one of these dudes, then I'd plug it into the (S)NES itself and make sure about the +5V & GND lines (no LED on the BoE, heat, short-circuit?; not good.)· Does it make a difference, NES/SNES?

    · Found a site with a pin-out of/for an NES controller, but didn't include the colors:

    · 1) Ground,· 2) Clock,· 3) Latch,· 4) Strobe,· 5) +5V

    · http://devcast.dcemulation.com/mods/unicont/nes.php


    Post Edited (PJ Allen) : 7/14/2006 2:52:18 AM GMT
  • Zsy6Zsy6 Posts: 37
    edited 2006-07-14 07:06
    I already measured the output of the NES system and 5v is being sent out of the white wire.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-14 22:59
    · On your very first post, there are 3 links and they each present inconsistent "data."
    · Guess what I'd do, presuming that the White wire is +5 and the Brown wire is Ground is, with nothing else connected:
    1. connect·White to VDD
    2. and Brown to VSS,····

    · So, let us see if the BoE (you are using a BoE, I read) can support those two wires with nothing else connected, and take it from there.·

    · I'd also like to know if you're using a battery or an external power supply.


    Post Edited (PJ Allen) : 7/14/2006 11:04:00 PM GMT
  • Zsy6Zsy6 Posts: 37
    edited 2006-07-15 16:32
    That sounds like a great idea, I'll try it and get back to you.· I'm using the battery pack that came with the robot, however one of the wires on the battery pack came off so I soldered it back on, that shouldnt be a problem right?
  • Zsy6Zsy6 Posts: 37
    edited 2006-07-16 16:02
    Ok it is the +5v wire plugged into Vdd that is causing the Boe to not turn on.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-16 16:52
    · Then something about the NES·controller is bad -- because by connecting power alone it is knocking out your STAMP power (extinguishing the LED), presuming the battery pack (?) is good.

    · The controller schematics show only a couple of 4000-series ICs, nothing really power hungry.· On the BoE, VDD (+5V) is derived from the LM2940 (it is not the same as the STAMP's "VCC".)

    · I'm just trying to establish a base-line here and at this point the BoE doesn't like having the NES controller connected to its +5V (VDD) -- not good.· You might want to try totally new batteries.· Make sure that VDD = +5V with nothing connected, first.

    · You mentioned that you repaired your battery lead/s (there are only two wires, so how anyone could mess that much up, I dunno.)

  • Zsy6Zsy6 Posts: 37
    edited 2006-07-16 20:50
    OK lol I guess Ill see what I can do.
  • CJCJ Posts: 470
    edited 2006-07-24 02:17
    how are you connecting the controller to the bot?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Who says you have to have knowledge to use it?

    I've killed a fly with my bare mind.
  • RinksCustomsRinksCustoms Posts: 531
    edited 2007-07-06 04:34
    Just a side note to anyone following this thread in search of answers, i'm pretty sure young Zsy here unfortunately accidentally got the power wires reversed on the NES controller and more than likely fried the 4041 (or whatever website you find this pinnout on) chips in the controller, tried hooking it up again, and possibly fried the 5V regulator on the BOT too.

    In my EE training as well as the hobby side, ship happens, wires get backward, it happens when you got a square foot of breadboards going. But the sad fact is, when a chip fries, it only has to get hot enough to burn your finger to be shot!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Definetly a E3 (Electronics Engineer Extrodinare!)
    "I laugh in the face of imposible,... not because i know it all, ... but because I don't know well enough!"
  • OSOKOSOK Posts: 35
    edited 2007-07-07 07:19
    Zsy... what you want to do is kinda high up there on the difficulty list. The "only" way you're gonna be able to get it done is by working on smaller projects first and slowly making your way up to where you want to go. This not only applies to school projects, but life in general.
  • Tom CTom C Posts: 461
    edited 2007-07-07 22:12
    Zsy6,

    What you want to accomplish has already been done with a Mad Katz/Sony PS2 wireless controller and the BS2/Atom 28 and the MCU code is freely available. You might want to use the previously mentioned wireless system as an example of how to accomplish what you want. The hardware/software utilization is well documented.

    I got my Mad Katz wireless controller and adapter cable from Lynxmotion for $25 which is pretty cheap.

    Being a systems engineering I like to build on what has gone before.

    If you have to reinvent the wheel due to certain limitations, I guess you just have to bite the bullet and do so.

    Just a thought.

    Regards,
    TCIII

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If you are going to send·a Robot·to save the world, you·better make sure it likes it the way it is!

    Post Edited (Tom C) : 7/7/2007 10:18:30 PM GMT
  • natpienatpie Posts: 35
    edited 2007-07-17 04:57
    I'm a new the the forms here, and new to micro controllers as well. However I must disagree with what everyone keeps saying here. Interfacing with a NES controller is not and advanced project. On the contrary I feel communication is a fundamental part of the micro controller world. And I'm a little concerned no one has posted code for this yet.

    That being said, I sat down and looked at the online information for the NES controller. It is very simple and just uses a shift register. All you need to do is cram some wires in the holes on the controller plug (i've included the correct possition in the code) and sit down and write the 2 lines of code needed to get data from the controller. Pulsout on the latch line and shiftin the data.

    Here is the code with limited explanation. Its very simple and you should be able to program your bots reaction with the information included. This test code only displays the controller stats in the debug window.

    After posting this I·realized I should remind you I pluged this into pins 13-15 because it was convinent.·· Be sure not to use these if you are progaming a boe bot to move because 12-15 are the servo connectors.··

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    '  NES Controler connection test code
    '
    '  Hardware Configuration
    '
    '
    '                  O  Ground to VSS
    '     +5 to vdd  O O  Clock to Pin 15
    '             NC O O  Latch to Pin 14
    '             NC O O  Dataout to Pin 13
    
    
    
    
    
    '  Define I/O Lines
    latch PIN 14                'Pin to lock data and prepair for data transmition
    clock PIN 15                'Clock Pulse to drive info from the controler
    dpin  PIN 13                'Pin where data comes in  aka data pin
    nes VAR Byte                'just somewhere to store the data
    
    'for clarity I'll define the joystic inputs here
    
    joyUp     VAR nes.BIT4       'These are just variables that point to the bits stored in the varibale called nes
    joyDown   VAR nes.BIT5
    joyLeft   VAR nes.BIT6
    joyRight  VAR nes.BIT7
    joySelect VAR nes.BIT2
    joyStart  VAR nes.BIT3
    joyA      VAR nes.BIT0
    joyB      VAR nes.BIT1
    
    '  Initial setup
    
    OUTPUT latch
    OUTPUT clock
    latch = 0
    clock = 0
    INPUT dpin
    
    DO    'main program loop
      GOSUB getdata
      GOSUB displaydata
    
    LOOP
    
    getdata:
    PULSOUT latch, 1            'store data in shift register   This lodes the first bit into dpin
    SHIFTIN dpin, clock, LSBPRE, [noparse][[/noparse]nes]        'pull data from the shift register lsbpre tells it lest significat bit first and that the first bit
                                            'is alread there so get it before sending a clock pulse
    nes = ~ nes                                   'inverse the logig state so 1 press and 0 is no press
    
    RETURN
    
    displaydata:
    DEBUG HOME, BIN8 ? nes                        'dislay raw data stored in home
    DEBUG CR, BIN1 ? joyUp,
          CR, BIN1 ? joyDown,
          CR, BIN1 ? joyLeft,
          CR, BIN1 ? joyRight,
          CR, BIN1 ? joySelect,
          CR, BIN1 ? joyStart,
          CR, BIN1 ? joyA,
          CR, BIN1 ? joyB
                                                  'show itemized inputs
    
    RETURN
    
    
    

    Post Edited (natpie) : 7/17/2007 4:05:21 PM GMT
    1504 x 1000 - 140K
  • Zsy6Zsy6 Posts: 37
    edited 2007-07-28 01:48
    Thanks man
Sign In or Register to comment.