Author Topic: wiring joystick to bs2  (Read 2583 times)

0 Members and 1 Guest are viewing this topic.

Offline ang5tTopic starter

  • Jr. Member
  • **
  • Posts: 34
  • Helpful? 0
wiring joystick to bs2
« on: September 21, 2008, 01:11:58 AM »
Hey there. I've been messing with the parallax basic stamp for a little while now and am enjoying making various autonomous programs for it to run, but I really want to be able to control it with a joy stick, (not a PS2 controller). it is currently built kinda like the $50 robot in build. I have the wiring figured out for the most part. They are:
red = power, (currently taking about 5V+)
black = ground
orange = trigger
yellow = button 2
green = button 3
white = button 4
brown = y axis
grey = x axis
purple = not 100% sure, but closes circuit after button press opens it.

I have the buttons pretty much figured out, my question is about the x and y axis pots. I have wired them to my breadboard as I would any other pot or resistor, but cannot get a reading from them. I have googled this and have found info on programing, but not on the hardwiring. Any help is appreciated.
So if the blue wire goes here, then that means...(bzzzt) oops....

paulstreats

  • Guest
Re: wiring joystick to bs2
« Reply #1 on: September 22, 2008, 04:59:43 AM »
You need to create a voltage divider circuit so you can read them with the a/d converter. Look at how the photoresistors on the $50 robot are wired, with an extra resistor.

+5v ------------------POT--------------Resistor---------------GND
                                     |
                                     |
                                     ----------------- to a/d port on mcu

POT's vary the amount of current wheras an a/d port needs a varying voltage. by making the circuit like above, the changes in current will also reflect in a change in the voltage.

You'll have to try different resistor values to get one that works well for yourself

Offline ang5tTopic starter

  • Jr. Member
  • **
  • Posts: 34
  • Helpful? 0
Re: wiring joystick to bs2
« Reply #2 on: September 22, 2008, 09:32:21 AM »
Yay for learning stuff. Ok, first off, thanks for the info paulstreats. I was doing something similar to that. I did find out why it was not working. After trying a few times and getting zero results, I completely took apart the joystick and removed the pots to test them. While doing this I noticed one thing they had in common.. the red wire. Hmm, a common wire. Isn't that a ground? Well, tested it out, and yes, it was. So, for those dismantling things, remember, colors aren't always what they seem.  So the wires colors listed above are incorrect. Black is ground for the buttons, red is the ground for pots, and purple is the +5V for the Y axis trim. Hope someone learns from my mistake ;)
So if the blue wire goes here, then that means...(bzzzt) oops....