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

Using a NES Controller to control a Boe-Bot

Zsy6Zsy6 Posts: 37
edited 2007-07-28 01:48 in Robotics
Hello, I'm Zsy and I want to use a NES controller to control my Boe-Bot, I am a pretty bad programmer so I need a lot of help.· The schematic for the controller and a site with some info are linked to below as well as a pic of the controller itself.

http://seb.riot.org/nescontr/nes-controller-schematic.png
http://www.gamesx.com/controldata/nessnes.htm
http://www.ladyada.net/make/gamegrrl/NES.jpg
«1

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-05-23 13:12
    Zsy -

    Although the following article deals with the Sony Playstation Controller, you may be able to pick up some information or techniques that will assist you with your Nintendo Controller. Take a look at this article "Playstation Controller Redux" in these Nuts and Volts Magazine articles by Jon Williams of Parallax:
    http://www.parallax.com/html_pages/downloads/nvcolumns/Nuts_Volts_Downloads_V4.asp

    Other than that, you might try to Google "BASIC Stamp + NES controller" and see what comes up.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Zsy6Zsy6 Posts: 37
    edited 2006-05-23 13:28
    Im on a computer that isnt allowed to run adobe acrobat reader so I cant read that at this time, is there any way you can copy the text from the article and paste it here for me?
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-05-23 13:43
    Zsy -

    The entire article is only 363 KB long, so if I were in your position, I'd download it onto a 1.44 MB floppy diskette, and take it wherever you need to take it, to read it.

    To answer your question directly, I have no facility to do what you asked- sorry.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Zsy6Zsy6 Posts: 37
    edited 2006-05-23 16:13
    I'm confused...
    If I get the NES controller to connect to the Boe-Bot, where should I connect it, and how would I program it?
  • Zsy6Zsy6 Posts: 37
    edited 2006-05-23 16:26
    also, is Vdd 5v out and what are Vin and Vss, which one is ground
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-23 16:43
    Vss is ground. You can use SHIFTIN to get data from the device.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-05-23 16:58
    Zsy -

    If you were under the impression that this was a trivial project, or that through some quirk of hardware magic, and a few lines of code, you were going to be able to operate your BOE-Bot from any particular type of game controller, nothing could be further from the truth. In my mind, this would probably qualify as a "medium to advanced level" project, which would best be attempted by someone who has had at least the following experience (which can be gained by reading and understanding the various FREE Parallax Educational Texts):

    1. Basic understanding of analog and digital circuity, along with some basics about power supplies and voltage regulation.

    2. Basic understanding of how to read and interpret schematic drawings, as well as an understanding of basic data sheet parameters for various electronic and electrical parts.

    3. Some, even limited, experience with interfacing custom hardware.

    4. Basic programming concepts and software-to-hardware interfacing methods.

    5. Ability to solder and wire circuits from a schematic drawing.

    6. A fundamental understanding of the programming language to be used.

    7. Basic knowledge of programming theory and concepts.

    8. Basic hardware and software troubleshooting techniques.

    After that you should be good to go. So, I'd suggest something more basic to begin with, if you'd like to pursue this as a hobby. The Parallax text "What's a Microcontroller" is generally suggested as the first stepping stone in this process. That text, along with all of the others, are available on the Parallax web site.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Zsy6Zsy6 Posts: 37
    edited 2006-05-23 17:25
    I'm a 15 year old student in my second year of studying electronics in high school and I'm quite familiar with a lot of electronics terms and circuitry, as well as the controller I'm using to do this project, but I'm not good at programming yet and I am pretty bad at it so this isnt exactly my area of expertise...
  • Zsy6Zsy6 Posts: 37
    edited 2006-05-23 17:27
    The "requirements" that I meet above are numbers 1, 2, 5, and 8, I'm working on the rest by reading the book that comes with the Boe-Bot.
  • Zsy6Zsy6 Posts: 37
    edited 2006-05-23 17:36
    By the way, I've already cut the tip off of the controller's wire, exposing the wires, then I stripped them and tinned the tips so they could be inserted into the Boe-bot's breadboard.
    I also found out what each wire is for and 1 wire is +5v which should go right into the Vdd which is conveniently +5v lol, the second wire is ground which I will insert into Vss, and the other 3 are data, strobe, and clock signal which I have no clue how to use...
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-23 22:26
    You should probably work your way through our "What's A Microcontroller?" and "Robotics" textbooks before taking this on -- that will get you good a programming and the rest will be pretty easy.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Zsy6Zsy6 Posts: 37
    edited 2006-05-25 12:14
    Is it possible to turn the Boe-Bot on and off using a controller?
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-05-25 18:22
    Zsy6, you need to be a little more patient, though that can be hard, I know.

    It is not simple to interface a BS2 to a Playstation controller. No, it's not possible to power on and off the BS2 from the controller. It would be easier to get the IR Remote Control from Parallax, and use the interfacing instructions to provide an IR control of your BS2. The IR remote would then give you a hand-holdable key-pad, and you could program the BS2 to do different things based on the button you press.

    We want to help you.

    Oh, and Vdd is +5 volts.· Vin can be anything from 6.5 to 20 volts -- there's an on-module regulator that drops this to +5 for the BS2.· On the BOE-Bot, the BOE board has a regulator that·can handle up to 1 amp of current, which takes in 7.5 to·20 volts DC and provides +5 to the Vdd line.· And yes, Vss is ground.
    ·
  • Zsy6Zsy6 Posts: 37
    edited 2006-05-26 13:22
    Thank you, but I can't order anything online and I want to use the controller I have, thanks for the info.
  • Zsy6Zsy6 Posts: 37
    edited 2006-05-26 13:24
    Does anyone here know how I could use the Data, strobe or clock signal wire coming from the controller?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-05-26 14:05
    You really need to consolidate your messages.· If you need to add something so quickly after posting simple edit your original message.· And it isn't polite to demand help on the forums.· If anyone has an answer or reply for your message they will.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Zsy6Zsy6 Posts: 37
    edited 2006-05-26 17:51
    OK OK I'm sorry, I just really want to do this...
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-05-26 21:32
    That's great!· Enthusiasm is nice, especially in this field...I just don't want to see you not get help for being pushy.· =)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • ktekxktekx Posts: 71
    edited 2006-05-28 10:25
    Hi Zsy, you might be interested in checking this out: www.parallax.com/html_pages/downloads/sw/sw.asp

    Read experiment #24 and #24b, it will teach you how to read the bit-states of the NES controller by connecting to the proper pins. The link you posted earlier explains it simliarly in layman terms using the "conveyor belt" analogy.

    Hope that helps, good luck!
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-05-28 12:59
    Zsy -

    Let's start putting some of this information from various previously mentioned sources, into one "framework" to see if it makes some logical sense. The format I chose to use is acceptable to the PBASIC Editor, so that it can be inserted right into your program for documentation if you wish.

    <code>

    '====== PBASIC Program to Access NES Controller =======================
    '
    '···· CD4021BC Fairchild 8-Stage Shift Register
    '
    '*
    *
    *
    '|··· 4021········· · ·|·· NES Function·· |
    '|
    |
    |
    |
    '|Pin # Pin Name· | Controller input· |
    '*
    *
    *
    '·· 7···· P1 (Q1)········· Right
    '·· 6···· P2 (Q2)········· Left
    '·· 5···· P3 (Q3)········· Down
    '·· 4···· P4 (Q4)········· Up
    ' 13···· P5 (Q5)··········Start
    ' 14···· P6 (Q6)········· Select
    ' 15···· P7 (Q7)········· "B" button
    '· 1 ···· P8 (Q8)········ "A" button

    'Pin # ·Pin Name··· PBASIC Shiftin Function - Sync Serial Access
    '
    ·
    ····
    ' 10········ Clk······· Serial clock pin
    '· 3········· S/O······ Serial data·output·pin
    '
    '· 9····· PAR/SER ·· Latch ·0 = latch parallel inputs
    '························· Status·1 = permit parallel inputs
    '
    ' PBASIC Pin Assignments (arbitrary)
    '
    'Stamp Pin·· 4021 Pin·· PBASIC Shiftin Function
    '·· Port······· Number
    '
    ····
    ···
    '··· 0············· 10······· ·Serial clock pin
    '··· 1·············· 3········ ·Serial data pin
    '
    'Ancillary pin(s) for accessing 4021 Shift Register
    '
    'Stamp Pin·· 4021 Pin··· Ancillary Function
    '·· Port······· Number
    '
    ···
    ·····
    '··· 2·············· 9··········· Parallel/Serial latch
    '
    '======================================================================
    <code/>

    See if there are any question thus far.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • CheetoCheeto Posts: 19
    edited 2006-05-30 01:42
    When I did something like this I took the controller apart and redid some of the traces. I would suggest hooking the common GND to Vdd of the BOE, then cut all the traces comming from the buttons and ditch the onboard IC in the controller, then solder 8 seperate wires to the traces comming from the buttons, this way when you hook those 8 wires to 8 I/O pins on the BOE and then press the button you will get a 5V to the pin. Then just assemble some IFTHEN statements and you should be good to go. I did this exact thing to hack two NES controllers into a keyboard controller board so I could play my ROMs on the computer.

    edit: looking at the schematic you could just cut the IC and ut all the wires going to VDD, then use the IC pads for the 8 wires going to the switch. An easy way to get a nice 9 wire cable is to buy a Serial extension cable
  • Zsy6Zsy6 Posts: 37
    edited 2006-05-31 12:17
    I think I'll probably go with Cheeto's idea, because the code listed above is rather confusing.
  • Zsy6Zsy6 Posts: 37
    edited 2006-05-31 12:30
    Also, I bought a Vex metal and hardware kit/erector set and built a nice frame for my robot with a built in controller holder, I'll probably take a few pictures, does anyone know what the stopping frequency for vex servomotors are, or any easy ways to attach them.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-05-31 12:32
    Zsy -

    You may be in deeper than you realize already. There hasn't been ANY CODE offered that I can see. That which I offered above is nothing but documentation! There isn't one executable instruction in the entire lot.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->

    Post Edited (Bruce Bates) : 5/31/2006 12:35:01 PM GMT
  • Zsy6Zsy6 Posts: 37
    edited 2006-05-31 13:16
    Sorry, I got confused, I thought that what you posted earlier was a Basic Stamp code
  • ktekxktekx Posts: 71
    edited 2006-06-01 07:27
    Zsy6, if you are still interested in interfacing the NES controller to the Stamp, please refer to the link and experiment #24b I pasted, it is going to be nearly identical in code and pin connection that you'll need to use for the controller that Bruce outlined earlier.

    Taking shortcuts is no fun, you'll be surprised at how much simpler and cleaner interfacing the NES controller the way it was meant to be, really is...as well as learning a thing or two. tongue.gif

    Good luck!
  • Zsy6Zsy6 Posts: 37
    edited 2006-06-01 16:27
    OK, I downloaded the files you posted about before, but I cant look at them cuz im on a school computer without Adobe Reader, I'll look at them later, thanks for the help!
  • dbc1218dbc1218 Posts: 33
    edited 2006-06-24 00:57
    First read the gamesx.com page and the link at the bottom of that page called "our old page", then read experiment #24b and #24, and finally read the explantion of the SHIFTIN command in the Basic Stamp Manual.

    So now that you know what your doing its time to connect the pins.
    NES pin 2 - Brown wire - Ground - Vss
    NES pin 7 - White wire - +5 volts - Vdd
    NES pin 5 - Yellow wire - Clock - Stamp I/O Pin 2
    NES pin 7 - Red wire - Serial Data - Stamp I/O Pin 0
    NES pin 3 - Orange wire - Latch - Stamp I/O Pin 1

    Now just run the program and keep the stamp connected to the commputer.

    You could change ADres to a byte value because theNES contoller is 8 Bit. You can also change the mode if you want. This program should debug the the serial data from the controller and show it to you in decimal and binary form.

    Also, I included a picture of the connector I used to hook everything up. Its a D-Sub connector that you can solder wires to. I think I got it from Radio Shack, but I would not recommend them their prices are outrages.
    2048 x 1536 - 927K
  • Zsy6Zsy6 Posts: 37
    edited 2006-07-07 05:40
    Well I connected the wires like u said, but now the boe bots light wont go on and it begins to heat up! What should I do? freaked.giffreaked.giffreaked.giffreaked.giffreaked.gif
  • Paul Sr.Paul Sr. Posts: 435
    edited 2006-07-07 13:41
    Zsy6 said...
    Well I connected the wires like u said, but now the boe bots light wont go on and it begins to heat up! What should I do? freaked.giffreaked.giffreaked.giffreaked.giffreaked.gif

    Well, if you followed the above post, then it looks like you connected +5V to the STAMP Pin 0 !!

    NES pin 2 - Brown wire - Ground - Vss
    NES pin 7 - White wire - +5 volts - Vdd
    NES pin 5 - Yellow wire - Clock - Stamp I/O Pin 2
    NES pin 7 - Red wire - Serial Data - Stamp I/O Pin 0
    NES pin 3 - Orange wire - Latch - Stamp I/O Pin 1
Sign In or Register to comment.