Having issues with dual rotary pots

all righty im wondering if could get some help with my little project i want to make a controller to assist me in star citizen
with what i want and now i plan to do things i need at least 30 buttons and 2 throttle nobs
now i have sort of poked around and i have managed to get the buttons to work…sort of

one of a couple of issues im running into

  1. getting both pots to be read values correctly,
    one pot using the image below, say R1 it reads values from 0 to 1023
    but R2 reads all over the place from 0 to 1023 jumping all over up and down based on R1
    now if i switch R1 and R2 around on the analog read pins R1 still works and R2 is all over
    here is even stranger if i switch R2 to a different pot, one of 5 others ive tried same thing happens. i do accept the odds of 1 or 2 of the pots being faulty but not 5 of of them .
  2. i need to emulate a controller as i have a throttle that i need to emulate, along with 30 buttons. i cant emulate keyboard cause of needing the throttle.

in the code snippits ive found i can allows me to return the pot values to serial monitor
and i have code snippts to allot me to use all the buttons and get them to return values to serial monitor
i cant seem to find a method to emulate a contoller
can this be done, if so can i be directed where i should look
ideally i would see in windows a game pad controller with 1 throttle ( 2 if i manage to work out the dual pot issue) and 30 buttons.

equipment

arduino leonardo
15 dual momentary switches
2 pots 10k ohm

any advice would be greatly appreciated

Hi Steven
Have you tried using a different analog input. I don’t know what your actual set up looks like but it sounds as if you may have a bad connection to A1. could be a bad or missing solder joint or I suppose even a bad input.
Cheers Bob

1 Like

yes i have switched analog inputs from a0 -a4 even switched to a different leo board
both behave the same


forgive dogey wiring and what not … but i assure you its all valid…
i even spread out the 5v and ground pins
the left pot, (red green orange wires) works yet the right pot (gray purple blue wires) dose not
ive tried both on the same 5v and ground lines and different as you can see in the image where im taping into the 5v/g rails of the icsp pins

Hi Steven
Getting down to hair pulling time. Know the feeling. I am assuming that reference to R1 and R2 mean the two pots and the fault always follows R2 even when pot is changed or analog input changed. When the pots changed the solder joints would have been re done so should be able to discount that.
This is getting down to actually changing the 3 wires. I don’t suppose you have tried this yet. It looks as if the connectors at the Arduiono end may be crimped. It is not uncommon for a crimp connection to be made on the plastic insulation instead of the wire causing an intermittent and unreliable connection. Any one of the 3 wires would cause the problems you are encountering. Try this and see how you go.
Do you have a CRO. Invaluable tool, especially for this kind of problem. Any slight variations between ground and signal or 5V should be visible. Failing this I think changing all 3 wires should be your next best option.
If these connections are soldered another problem that very frequently occurs is “solder wicking” where solder “wicks” up the wire out of sight back up under the plastic. With movement like in your situation where jumper leads are moved quite a bit the wire WILL (not maybe) break where the solder finishes. This results in an intermittent contact up inside the plastic out of sight. A quick check for this sometimes is th hold the connector pin and pull the wire with a fair bit of tension. Sometimes the plastic insulation will stretch where the wire is broken. The ultimate test though is to change the wire.
Don’t worry, persevere you will get on top of it
Cheers Bob

i hadent thought of replacing the wires tho when switching from one pot to the next i have used different wires, tho i think you might be on to something with the wires, as they are the wires that came with the adruino starter kit, so im guessing they might not be good quality ill have to see if i can find some other wire to use,
any chance you can expand on what a CRO is. i have no idea what that is

when it comes to switching inputs, the one pot always reads correctly but the other one not … and its constantly the same one that works.
but i can understand it might be the wires ill see what i can do about that i might take me a few days to get to it as i have to wait for the next pay day but i will replace wires and see how it goes

1 Like

Hi Steven
CRO is short for “Cathode Ray Oscilloscope” which harks back to the days when this instrument did indeed have a long cathode ray (think old TV tube) tube to view waveforms. These days they have a digital screen.
A complex (square, triangle, distorted, TV video signal) does not mean much to an analog or digital multimeter. This instrument allows one to view the shape of as well as the amplitude of such signals. Also allows the viewing of small variations and glitches as it has a far faster response than things like a multimeter.
I am not being critical here but if you do not know what a CRO (CRO is a very common term) is you are not likely to have or have access to one of these things and even less likely to have an understanding of how to use it. As this is such a useful device I would urge you to expand your knowledge and do some reading and research on the uses and use of such an instrument. Basically it could be described as a device which displays a waveform of amplitude (vertical) versus time (horizontal) of a voltage applied to it.

If you have got some of those pins or have a spare strip of them cut one off and solder a wire to it to plug into the Arduino and do it 3 times or swap the wires out one at a time.

Cheers Bob

1 Like

i do know of a oscilloscope, tho i only know it as just that oscilloscope, not CRO. tho you are right no idont have access to one nor do i know how to use one. i honestly cant see myself at least in the near future partly due to my limited knowledge, and my current application of electronics.
tho if i do plan to do a mk2 or mk3 of the controller i might invest in the extra tools, i have spent so much on this so far

any idea on the other issue i have, making it emulate a controller?

Hi again Steven
Quick update on my last reply.
It may seem that the term “CRO” is probably as widespread and generally used as I stated. It would be fair to note that the term “oscilloscope” or the shortened “scope” may be more widely used. This would be more correct as I would think the “cathode ray” tube would no longer be used on this application. Anyway “oscilloscope” would be correct in either case.
Cheers Bob

Should read “CRO” is probably not as widespread

Old age creeping up.
Cheers Bob

all good tho in other news i went to got new pots and thicker new wire, soldered them on and they work as expected FFFFFFFFFF… now for my next trick emulating a controller

Hi Steven
Just read your post and have already replied re “CRO”. I note that CoreElectronics have reviews of a couple of Rigol models as Utube videos if you are interested in taking a look at what this instrument does.
Are you trying to emulate some sort of joystick or similar. Can’t help you there. What is required of a game controller seems to be a bit of a secret. I don’t know if Arduino is up to it on its own. Haven’t seen anything published on it.
I have a flight simulator and have a 10 turn pot for elevator trim instead of the flight yolk button. Cheated a bit here. Used a redundant board from an old broken throttle quadrant. connected pot to one of the quadrant axis inputs and plugged into the original PS2 connector on flight yolk. Used Arduino NanoEvery board and LED bar graphs to indicate throttle position with respect to centre. Works well but had trouble with voltage drop on very thin PS2 wiring. Have temporary solution but that is another problem.
Re emulation. I have on order a purpose built board from Leo Bodnar in the UK (has a web site, just google) designated BU0836A which seems very popular and is supposedly compatible with anything requiring a joystick. Apparently just plug in, no drivers required. Maybe most of the work is done within a game or simulator, I just don’t know I have XPlane flight sim which allow any analog axis and any digital button to be assigned to whatever function you want.
Since ordering this board I came across (yesterday) a board called “Teensie” which emulates lots of things including flight sims, specifically XPlane. Have not investigated yet but stocked by CoreElectronics. Programmable with Arduino IDE apparently with the addition of an add on.
Cheers Bob

CONGRATULATIONS. I said you would get on top of it.
At 0.5mA per pot I don’t think the thickness of the wire had much to do with the problem. More so a bad connection somewhere which you eliminated by changing all of them. No matter, you have done it!!!
Now, throw those wires in the garbage so you don’t use them somewhere else and have the same problem all over again.
Most of these problems I find can be fixed using 2 stages.

  1. Observation, then logically try to analyse what has been observed. Write it down if necessary.
  2. Elimination of possibilities. This has to be done in a logical structured manner or you will finish up going in circles getting nowhere. Once again document everything for your own benefit later.
    Things get really messy when you have multiple faults, ie; one fault masking another underlying one. Really have to think about this situation but once again note everything in writing so you can come back to any point.
    What you have done may seem simple but it is really important that you have done it yourself. You had a bit of a confusing time but having had success you will not forget it. Next time you have a sticky problem you will be better equipped to tackle it.
    When you find out how to emulate a controller please let me know. Good luck.
    Cheers Bob
1 Like

i have to admit i sware i had gone through all the options and configs of swaping one thing at a time, to see what worked and what didnt, but i have to admit i never thought it was the wire that was screwing me over… i guess largely due to my limited supplys for the project … tho now i have more and well lets hope i can take it one step at a time

Another one that crops up more than it should.
Wire inserted into a terminal too far and the clamp mechanism clamping on the plastic instead of the wire. This is particularly troublesome if the wire or strands can make some sort of contact some of the time but of course not reliably.
Carelessness !!!.
Cheers and good luck Bob

Another curly one with the above scenario.
It may well work on a hot day (when the plastic under the clamp may soften) but not on a cold day (when said plastic hardens). I have actually experienced this and believe me this sort of problem takes some tracking down. Without noting everything this sort of thing can actually turn into a disaster.
Cheers Bob

yeah i could see how that could be a royal PITA

Especially with a customer over your shoulder keen to get his equipment operational like yesterday.

1 Like

Nice work chasing this one down Steven! Definitely a tricky one to identify!

Regards,
Oliver
Support | Core Electronics

so long story and many many … many … far too many hours of pulling hair out, i have managed to complete this its finally finished and working in game, managed to find all the right librarys blundered my way through getting it right. 2 axis 30 buttons later… works as advertised on the box


i can upload the code if requested

2 Likes

Hey Steven,

Excellent work! Glad to hear that it’s now functional. Have a great day!

Bryce
Core Electronics | Support