Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: How to get only positive values out of a pot?  (Read 1719 times)

0 Members and 1 Guest are viewing this topic.

TacticalChaos

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 44
  • Last login:January 29, 2024, 02:36:46 am
How to get only positive values out of a pot?
« on: May 14, 2015, 01:30:03 pm »
The controller I made used a logitech wheel board in it. I'm trying to use the X-axis for a turnable knob, but the problem is the pot outputs values from about -1 to 1 and the python code I'm using only accepts positive values for this input (WHY they put this stupid limitation on it I don't know, the code accepts negatives for other inputs).  So there's two options I see,
 1. Rewire the pot somehow to only show positives, 2. Hook the pot up to something like one of the pedal axis's (assuming they only have positive values?).
I also noticed a standard gamepad pot does the same thing so changing the board wouldn't do me any good.

« Last Edit: May 14, 2015, 04:47:23 pm by TacticalChaos »

mgb

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3500
  • Last login:August 03, 2025, 07:25:14 pm
  • North East, US
Re: How to get only positive values out of a pot?
« Reply #1 on: May 15, 2015, 07:49:51 pm »
I'm not sure I completely follow and hopefully someone else has a better idea.
But maybe you should post pics and how it's wired currently.
I may have missed something or misunderstood what you meant but a standard potentiometer doesn't really give a negative or positive value. It changes resistance.
What other interface is in place here and what exactly is it interfacing to and controlling.
Also with Python, is there library that will suit your needs maybe

TacticalChaos

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 44
  • Last login:January 29, 2024, 02:36:46 am
Re: How to get only positive values out of a pot?
« Reply #2 on: May 15, 2015, 07:58:16 pm »
Well I have found a work around, and like I thought it is using one of the pedal axis's.
I found that if I set the pedals to combined the brake axis then only reports positive ranges.
Had I used anything other than a wheel board I wouldn't of had this option because evidently negative and positive values are standard for joysticks.

Slippyblade

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3167
  • Last login:June 05, 2024, 10:30:57 am
  • And to the death god we say, "Not today!"
Re: How to get only positive values out of a pot?
« Reply #3 on: May 15, 2015, 09:12:13 pm »
Pots don't output anything at all.  They are just resistors and they will act as a voltage divider.  That voltage gets fed into an ADC usually that outputs a value.  I know it's a nitpick thing, but something that might address the issue.

TacticalChaos

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 44
  • Last login:January 29, 2024, 02:36:46 am
Re: How to get only positive values out of a pot?
« Reply #4 on: May 16, 2015, 05:29:30 pm »
Ok the work around is great in theory, actually getting it hooked up correctly is another matter since I never possessed the pedals for the board to begin with. I have pieced together from online sources the info I need to know what trace on the board does what for the pedals. The issue is I'm only using one pot, and the pots in the pedals were wired together and seem to give a different reading when you only hook one up (and by different reading I mean it does stuff like move the wheel axis for half and then a pedal for the rest, don't even know why).
SO, does anyone know how to wire up just one pot so that it acts just like the other one was still there (albeit minus any input from the missing one). Here's a diagram of the pot pedals in question (that I found, so hopefully it's correct).

Also could someone move this thread to the racing cab section? I think that would be more appropriate since we are dealing with hardware that was originally a steering wheel and thus get better results.
« Last Edit: May 16, 2015, 05:37:22 pm by TacticalChaos »

johnrt

  • Guest
  • Trade Count: (0)
Re: How to get only positive values out of a pot?
« Reply #5 on: May 16, 2015, 06:12:18 pm »
This is the schematic for your setup:


It really doesn't make any sense without knowing the rest of the circuit. And it can definitely not be recreated with just ONE pot.

TacticalChaos

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 44
  • Last login:January 29, 2024, 02:36:46 am
Re: How to get only positive values out of a pot?
« Reply #6 on: May 16, 2015, 06:25:43 pm »
   Ok, well anyway I thought the following info might be helpful.
Green =Accelerator  On    Red=Brake On
Black (Yellow)=Accelerator Ground    Black (White) =Brake Ground

TacticalChaos

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 44
  • Last login:January 29, 2024, 02:36:46 am
Re: How to get only positive values out of a pot?
« Reply #7 on: May 16, 2015, 06:42:03 pm »
I just figured out the python code to make it do what I want. Evidently when use a negative you have to also use a plush sign on the positive (normally there isn't when dealing with all positives) like this (-1,+1) NOT (-1,1) as I was doing.
Anyway the schematic up there is for a logitech wingman force gp if anyone finds this later and needs that image.

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9678
  • Last login:Today at 12:43:37 am
  • Designated spam hunter
Re: How to get only positive values out of a pot?
« Reply #8 on: May 16, 2015, 06:43:57 pm »
[EDIT:  Looks like you found an easier answer just before I posted.  :lol]

Are you sure it isn't wired like the single axis example below?



If it is connected that way, you can wire your pot like the "brake pot" below, but with a fixed resistor with the same resistance value as the "brake pot" in place of the "gas pot".

The fixed resistor/"gas pot" drops 1/2 the total voltage so the "brake pot" wiper outputs between 1/2 of Vcc and Vcc, depending on the position of the "brake pot" wiper.

To tell which tab (1 or 3) the resistor should be on, remove power from the board (unless you don't mind frying your multimeter  :o), turn the pot in the direction that currently gives negative readings, and compare the resistance between tabs 2+3 to the resistance between tabs 1+3.

The pair with the lower resistance tells you which tab (1 or 3) to put the resistor on.




Scott
« Last Edit: May 16, 2015, 06:58:25 pm by PL1 »

TacticalChaos

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 44
  • Last login:January 29, 2024, 02:36:46 am
Re: How to get only positive values out of a pot?
« Reply #9 on: May 16, 2015, 06:54:58 pm »
I did see that wiring setup mentioned else where for other pedals. And for all I know they made the other one wrong. I won't know if that would of actually worked as I'm not going to monkey with it anymore since I fixed the code to do what I want. I already had it crash some .dll while messing with the connections and had to restart my system before it recognized the controller again, so I'd rather not risk anything more now that I don't have to, but thanks for the diagram.