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:

$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

Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming

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 [email protected] (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:


#  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