Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
Asked — Edited
Resolved Resolved by Niek!

Connecting An Analog To Ez-B To Control Robot

is it possible to put an analog stick to an ez-b through the A0,A1...... ports

User-inserted image


By setting up variables to the x,y and button press (vert, horz, sel) is it possible to setup if statements for controlling the robot ex:

Code:

$Vertical = A1
$Forward = D1

While()
.get(A1)
If $Vertical = 1
$Forward = On
EndIf


sorry code is incorrect have forgotten a few of the terms, since i have been using Java and C++ for the last few months and everytime I start using other languages i need a quick recap of the other languages.


ARC Pro

Upgrade to ARC Pro

ARC Pro will give you immediate updates and new features needed to unleash your robot's potential!

#6  
this is what i figured was happening but my controller is not an official sony controller (which could be differant) and in the picture you will see you can hook up to ports off the board it is on. I have looked inside a sony controller and you are completely right, as for this controller is still to potentialmetres but for some reason they are hooked up weired on the board, instead of 5v Analog GND its got the 2 connected together under AD and 1 from each potentialmetre goes to RX/RY/LX/LY.


User-inserted image


User-inserted image


User-inserted image
Netherlands
#7  
Those 2 leads put together, are they connected to VCC or GND?

And in the other controller board, are there any resistors on the XY etc lines?
#8  
The first picture is the backside of the other 2 pictures, not sure if thats what you mean in other board, if so i don't see any on the board or if you are reffering to the top post then the answer is no, it just connects the 5v and GND pins from the 2 potentiometers. But i see what you mean which would make more sense if there was a resistor.

If you follow the backside of the board you will notice the 2 pins on each potentiometres are connected to eachother, these are all on the AD pins, then the third pin goes sepparately to the RX,RY,LX,LY.

The AD pin is the mystery, AD i would think would stand for an analog input or output but i am unsure.

Here is the 1st boards wiring: here

EDIT: if you mean the board with the buttons etc, their might be resitors on their that the AD is connected to
Netherlands
#9  
@kplamondon with other board, I mean the rest of your ps2 controller. Could you trace what AD is going to on there?
#10  
Visuals are always nice so heres a bunch of pictures, the AD goes to the middle wire on the R1 and R2 (L1 and L2) buttons, the wiring there is R1, JP4, R2 it also goes through all the buttons on the Left and all the Button on the Right. Whatever AD is it goes to every button and potentiometre, either 5v or GND but i am still unsure but it does connect to all the buttons and maybe R23 i am unsure.

User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image
Netherlands
#12  
I think I have an idea how to connect them up to the EZ-B. Could you measure the resistance between the outer terminals in 3 positions? All the way to one side, to the other and centered.
#13  
sorry about not replying have been gone for the past 3 days, i will measure this tomorrow. But how specifically do you want to measure the resistance, send power and use a volts metre or measure ohms? I am not totally sure what you mean, if you can be more specific on the connections i should be able to measure some connections.
Netherlands
#14  
Just hook up a multimeter to the outer two leads, set it to measure ohms and measure the resistance when the potmeter is to one side, to the other and centered. This helps me determine how to hook it up to the EZ-B, if you should use external pullups/downs etc.
#15  
Ok i measured the ohms resistance, although the numbers were jumping around the more i tested, under ohms 2000 the values were: centre 65, down 90, up 41. They changed a bit do to trying to put the ends of the multimetre on soldered ends but i am sure the differance between the values would be similar. A few times i measured centre around 55-65 but my last was 65.

Edit:

Up = 800 resistor
Centre = 1.3K resistor
Down = 1.8K Resistor
#16  
also i found a blog where someone used the same controller as me and was able to use the joystick board that the joysticks are on. check it out pg I, pg II, pg III.

See if you can figure out what he did, he doesn't explain much but he cut out a breadboard to fit and managed to hook it all up to that. I don't really need any of the buttons, which i can already hook those up on my own. But the analogs he was able to hook up to that board he made.
Netherlands
#17  
@kplamondon Thanks, I'll make you a schematic in a couple of days.

The guy you linked just created his own board with tactile switches (on/off, no in between). It's easy to hook up to the EZ-B, but takes up lots of IO.
#18  
thanks a lot, if you can show a schematic that would really help, I'll be able to visualize what you want me to do. I can't wait to get the analogs hooked up.
#19  
How's the schematic coming, haven't heard from you in a while. I have been playing around with potentiometres lately (practicing making script for joysticks) managed to get the robot moving forward, stop, or back depending on the value of the potentiometre. The joysticks will be very much similar to the potentiometre, only more directional code to right EX: setting it up for both turning by using one wheel reverse and the other forwards as well as gradual turns by making one side slower then the other.
Netherlands
#20  
@kplamondon I'm hosting a polish exchange student so I've been kinda busy;) It's good that you started figuring it out on your own!

I finished the schematic yesterday, just writing some example code for you. I can't send the schematics, but it's basically just hooking the AD up to 5V and for every RX, RY etc connect the pin to a analog port and use a 1.3K pulldown resistor. Then you can just write a sketch that constantly prints the analog values of those pins to the console to find out the positions.
#21  
Thats great, is the schamatics computer or drawn. You could always screen shot off the program, or email me the files at Kyle.Plamondon@gmail.com (don't currently have software but have been planning to get one, deppending on price of AutoCAD) if drawn you can always scan and put on here or email to me.

As for the example code i can't wait to see, thanks alot for your help so far.
Netherlands
#22  
Hi Kyle,

I finally had time to finish the schematic and code. Here's how you hook it up. Do the same for RX, RY etc.
User-inserted image


The joystick's resistance is 1.3K when centered, so with the 1.3K pulldown it should divide the voltage in half. ARC's getADC function returns a value between 0 and 255 for 0-5V. This means that centered, it should be around 127. Up it should be around 158 and down 107. The value might fluctuate quite a bit so the code should have tresholds. This means you end up with something like this:

Code:


# Potentiometer joystick script
# Written by Niek Blankers

$value = getADC(adc0) # Change 'adc0' to used analog port
$centerValue = 127 # The potentiometer's value when centered
$treshold = 10 # Up/down treshold

# Check the position
If($value - $centerValue > 30) # Up

Print( "Up" )
ElseIf($centerValue - $value > 30) # Down

Print( "Down" )
Else # Centered

Print( "Center" )
EndIf


Now use this code for every axis and you should be fine:)
#23  
thanks a lot, i will try this out soon. My goal is to make a microchip in the same shape as the button microchip. In this case i will build a schamatic of the microchip using your method and have all the resistors/components needed on it.
Thanks so much this will help a lot, i got lots of work to do on my own still but at least i know what to do now.

What software are you using to build schamatics, Eagle? B/c i just bought it, and i seen the video with you designing a for the EZ-B that can be programmed using Arduino (which i think is a great idea), what was that software? It didn't look like eagle, I'm knew to designing PCB's.
#24  
kplamondon , looks like the community was able to find some really great information for your project. I hope it's all helpful! Do you mind marking the thread as answered/ resolved. Thankyou! - Josh
Netherlands
#25  
@kplamondon I might be a bit late with this, but you should test it out on a breadboard first:D

I am using Eagle CAD, yes. There are lots of great tutorials for it out there. The software Jeremie over at EZ-Robot is using was Altium.