Go to Post Dean's "All Denim" (now referred to as "Deanim") look is apparently catching on. - AndyB [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Events   CD-Media   CD-Spy   FRC-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-09-2011, 09:22 PM
DavisC DavisC is offline
Registered User
FRC #0539 (Titans)
Team Role: Programmer
 
Join Date: Jul 2011
Rookie Year: 2010
Location: Virginia
Posts: 192
DavisC is just really niceDavisC is just really niceDavisC is just really niceDavisC is just really nice
Arduino Board and FRC Victors

So, I made several attempts to use a potentiometer and the PWM outputs on a Arduino board that were connected to a Victor powered by the old FRC distribution board.

Has anyone else tried this? Mind sharing your code or some ideas?

Thanks
Davis
  #2   Spotlight this post!  
Unread 12-09-2011, 09:24 PM
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Is winter over yet?
FRC #1676 (Pascack PI Oneers)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Montvale NJ
Posts: 6,249
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Arduino Board and FRC Victors

A victor uses an R/C type PWM signal. A pulse of 1 mSec is full reverse, 2.0 mSec is full forward, 1.5 mSec is neutral. These pulses repeat at perhaps 200 Hz.

What kind of PWM pulses are you sending to the Victor?
__________________

I am N2IRZ - What's your callsign?
  #3   Spotlight this post!  
Unread 12-09-2011, 09:53 PM
nighterfighter nighterfighter is offline
1771 Alum/4509 Mentor
AKA: Matt B
FRC #4509 (Mechanical Bulls)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee,GA
Posts: 549
nighterfighter has much to be proud ofnighterfighter has much to be proud ofnighterfighter has much to be proud ofnighterfighter has much to be proud ofnighterfighter has much to be proud ofnighterfighter has much to be proud ofnighterfighter has much to be proud ofnighterfighter has much to be proud ofnighterfighter has much to be proud of
Re: Arduino Board and FRC Victors

Hi-

I actually just recently used my Arduino to control both a Victor and a Jaguar, (Wired a potentiometer and had the Arduino scale the speed based on the pot value)

Try using the Servo library that comes with the Arduino.

Telling the pin to write the servo with a value of 90 will stop it, and > 90 is forward and < 90 is backwards.

If you want I can find the code I used.
  #4   Spotlight this post!  
Unread 12-09-2011, 11:40 PM
Cory's Avatar
Cory Cory is offline
Registered User
AKA: Cory McBride
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: May 2002
Rookie Year: 2001
Location: Redwood City, CA
Posts: 6,249
Cory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond repute
Send a message via AIM to Cory
Re: Arduino Board and FRC Victors

Servo library is the way to go. Just finished a project using victors and the arduino. Banged our heads against the wall before figuring out arduino PWM output won't get it done. You need PPM output on the arduino, which the myservo.write() function will generate. Look up the servo example included with the arduino software.
__________________
2001-2004: Team 100
2006-Current: Team 254
  #5   Spotlight this post!  
Unread 12-10-2011, 09:42 AM
DavisC DavisC is offline
Registered User
FRC #0539 (Titans)
Team Role: Programmer
 
Join Date: Jul 2011
Rookie Year: 2010
Location: Virginia
Posts: 192
DavisC is just really niceDavisC is just really niceDavisC is just really niceDavisC is just really nice
Re: Arduino Board and FRC Victors

Thanks all. Yea I set it all up and tested it with the default "Servo Knob" example. Which worked great! I also added part to turn the 0 to 179 value into a -1 to 1 value and used the serial monitor to see the relative value.

Now I believe this is by far a stretch (considering the code is on the board), but has anyone successfully used a joystick with this? When using the computer, the only idea I would have is to somehow (i have no clue) send the joystick value to the board such as what the serial monitor does?

Also have you used the game pad shield to try and control it?
  #6   Spotlight this post!  
Unread 12-10-2011, 04:38 PM
RoboMaster's Avatar
RoboMaster RoboMaster is offline
Alum, former programmer&co-captain
FRC #2472 (The Centurions)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Minnesota, Twin Cities
Posts: 268
RoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant future
Re: Arduino Board and FRC Victors

I haven't, but Google it. I'm sure someone has and you can look at their resources. There's a massive community out there for Arduino.
__________________
My engineering blog: noeticbrainwaves.blogspot.com

I'm not slacking, my code's compiling
...and I'm using LabVIEW
  #7   Spotlight this post!  
Unread 12-10-2011, 05:26 PM
Cory's Avatar
Cory Cory is offline
Registered User
AKA: Cory McBride
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: May 2002
Rookie Year: 2001
Location: Redwood City, CA
Posts: 6,249
Cory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond repute
Send a message via AIM to Cory
Re: Arduino Board and FRC Victors

Quote:
Originally Posted by DavisC View Post
Thanks all. Yea I set it all up and tested it with the default "Servo Knob" example. Which worked great! I also added part to turn the 0 to 179 value into a -1 to 1 value and used the serial monitor to see the relative value.

Now I believe this is by far a stretch (considering the code is on the board), but has anyone successfully used a joystick with this? When using the computer, the only idea I would have is to somehow (i have no clue) send the joystick value to the board such as what the serial monitor does?

Also have you used the game pad shield to try and control it?
Sure. A joystick likely just has a potentiometer inside. Wire it to an analog input, then use the analogRead() function to get the value from the joystick. use the map() command to map the values of the joystick pot onto the range of values you are supplying the victor.

The Arduino website reference section will tell you how to setup all these commands.
__________________
2001-2004: Team 100
2006-Current: Team 254
  #8   Spotlight this post!  
Unread 12-10-2011, 08:47 PM
RoboMaster's Avatar
RoboMaster RoboMaster is offline
Alum, former programmer&co-captain
FRC #2472 (The Centurions)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Minnesota, Twin Cities
Posts: 268
RoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant future
Re: Arduino Board and FRC Victors

Quote:
Originally Posted by Cory View Post
A joystick likely just has a potentiometer inside. Wire it to an analog input...
I think he meant a USB or other type of joystick connected to the computer or laptop, not a direct, wired connection.

You might be able to send it down with the serial connection, but you would have to get or write your own application for the computer side. Arduino's serial monitor can't help you with a joystick.
__________________
My engineering blog: noeticbrainwaves.blogspot.com

I'm not slacking, my code's compiling
...and I'm using LabVIEW
  #9   Spotlight this post!  
Unread 12-10-2011, 10:14 PM
ajlapp ajlapp is offline
Registered User
AKA: Anthony Lapp
None #0118 (Team RUSH and Robonauts)
 
Join Date: Sep 2001
Rookie Year: 1996
Location: Ortonville, MI
Posts: 556
ajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond repute
Re: Arduino Board and FRC Victors

You can definitely hook up joysticks...we build complete robot control systems using only an Arduino.

Robot with Arduino control system
__________________
Anthony Lapp
FIRST Engineering Mentor
Owner/Operator 221 Robotic Systems
221 Robotics Systems - Quality Hardware, Made in the USA
RobotOpen
anthony@221robotics.com
Twitter us: @221RobotSystems
Team 1 --> 94 --> 68 --> 221 --> 857 --> 27 --> 118
Design Engineer/Fabricator and 17 year vet
Team Rush (FRC27) and Robonauts (FRC118)
  #10   Spotlight this post!  
Unread 12-11-2011, 11:42 AM
tsaksa's Avatar
tsaksa tsaksa is offline
Registered User
FRC #0997 (CHS Robotics)
Team Role: Mentor
 
Join Date: Jul 2011
Rookie Year: 2011
Location: Corvallis Oregon
Posts: 191
tsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond repute
Re: Arduino Board and FRC Victors

We did something like this as a side project this summer to build a wired controller for our robot for moving it around and testing without setting up a real drivers station. You can buy old game controllers at Goodwill or other locations for about $2. PS2 controllers are dirt cheap now. Have the students cut the connections to the existing PC board, and wire directly to the potentiometer. We used a standard 9 pin D connector which provided 5 volt power and ground into the controller to connect across the potentiometers. That left left enough extra connections to return the 4 analog values from the center tap on the potentiometers, and three additional connections that could be used to wire some buttons.

The students were very impressed with the idea of opening up an old controller and re-purposing it for a new function. The PS2 controller now just acts as a set of potentiometers and switches connected to the 9 pin connector. A little hot glue for strain relief, and reassembling the case, and the thing looks reasonably professional. The Arduino and a small battery to power it goes into another box that can be placed on the robot and also has four connectors for the PWM outputs. In use you can connect a standard serial cable between the controller and the arduino box since that has a 9 pin D connector as well. Just make sure you serial cable is straight through and not null modem.

I can post the code separately.
__________________
This is the zeroth day of the rest of your life.
  #11   Spotlight this post!  
Unread 12-11-2011, 12:15 PM
tsaksa's Avatar
tsaksa tsaksa is offline
Registered User
FRC #0997 (CHS Robotics)
Team Role: Mentor
 
Join Date: Jul 2011
Rookie Year: 2011
Location: Corvallis Oregon
Posts: 191
tsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond reputetsaksa has a reputation beyond repute
Re: Arduino Board and FRC Victors

Ok, I have access to the code now. here it is

This is untested sample code supplied as is with no implied suitability for any actual application. The programming team is relatively new and still learning Java, so I wrote most of this just to get us started. We still need to test it a bit more and have the software team rewrite it at some point. But this should give you an idea of how to get started.

I had to convert the code to a .TXT file to get it to upload. Hopefully nothing got changed that would mangle the code. I think just changing the extension back, or cutting and pasting all or part of the code into the Arduino editor should allow you to use it. Our team does not have a lot of meetings left before build season, but if there is any interest I will ask for someone to take some pictures of the finished project.
Attached Files
File Type: txt Mypendant.txt (5.4 KB, 48 views)
__________________
This is the zeroth day of the rest of your life.
  #12   Spotlight this post!  
Unread 12-11-2011, 02:31 PM
DavisC DavisC is offline
Registered User
FRC #0539 (Titans)
Team Role: Programmer
 
Join Date: Jul 2011
Rookie Year: 2010
Location: Virginia
Posts: 192
DavisC is just really niceDavisC is just really niceDavisC is just really niceDavisC is just really nice
Re: Arduino Board and FRC Victors

Thanks for the info.
@ajlapp - Was looking around on the site and looks interesting, do you have a document that explains how it is setup?

@tsaksa - That seems like an interesting project, I am definitely going to try that, and yea if you get a chance could you snap a pic.

Thanks,
Davis
  #13   Spotlight this post!  
Unread 12-11-2011, 04:45 PM
Garrett.d.w's Avatar
Garrett.d.w Garrett.d.w is offline
Build Lead
FRC #2733 (The Pigmice)
Team Role: Engineer
 
Join Date: Jul 2011
Rookie Year: 2010
Location: Portland
Posts: 318
Garrett.d.w is a splendid one to beholdGarrett.d.w is a splendid one to beholdGarrett.d.w is a splendid one to beholdGarrett.d.w is a splendid one to beholdGarrett.d.w is a splendid one to beholdGarrett.d.w is a splendid one to beholdGarrett.d.w is a splendid one to behold
Re: Arduino Board and FRC Victors

If you want to use a computer to send commands to the arduino then use Processing (arduino's computer based cousin). There is a library included in the software package that allows you to interface with the arduino though the usb serial connection.

If you want to control the whole setup remotely, you can use an xbee shield and radio to create a wireless serial connection between two arduinos.

Personally, I have used ps2 controllers as shown in this link (http://www.billporter.info/playstati...-library-v1-0/). It's much cleaner than soldering the connections to the potentiometers inside the controller, plus you can do some interesting things with the ruble feature, etc. There is also some canned code on that web page.

The web site also has a library for creating complex serial communication protocols (which comes in handy when you want to transmit more than one variable over a serial connection).

PM me and I can send you pictures of the project setup and code (if I can find it).
__________________
"A mind once stretched by a thought will never regain it's original dimensions."

Optimists think the glass is half full.
Pessimists think the glass is half empty.
Engineers realize it's twice as big as it needs to be.
  #14   Spotlight this post!  
Unread 12-11-2011, 04:52 PM
DavisC DavisC is offline
Registered User
FRC #0539 (Titans)
Team Role: Programmer
 
Join Date: Jul 2011
Rookie Year: 2010
Location: Virginia
Posts: 192
DavisC is just really niceDavisC is just really niceDavisC is just really niceDavisC is just really nice
Re: Arduino Board and FRC Victors

Quote:
Originally Posted by Garrett.d.w View Post
If you want to use a computer to send commands to the arduino then use Processing (arduino's computer based cousin). There is a library included in the software package that allows you to interface with the arduino though the usb serial connection.

If you want to control the whole setup remotely, you can use an xbee shield and radio to create a wireless serial connection between two arduinos.
Thanks, this is truly what I was looking for, I had thought of the xbee addition and that would work; I just didn't know a simple environment that would allow the communication.

Also, I am thinking of the use of bluetooth, or it looks like in aj's link that with the ethernet shield, it could be connected to a router.
  #15   Spotlight this post!  
Unread 12-11-2011, 09:08 PM
ajlapp ajlapp is offline
Registered User
AKA: Anthony Lapp
None #0118 (Team RUSH and Robonauts)
 
Join Date: Sep 2001
Rookie Year: 1996
Location: Ortonville, MI
Posts: 556
ajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond repute
Re: Arduino Board and FRC Victors

Quote:
@ajlapp - Was looking around on the site and looks interesting, do you have a document that explains how it is setup?
No specific document exists at this time, sorry. The source code for both the robot side and operator side is available at the link previously provided.

In general each side of this system has an Arduino and an Ethernet shield. We used Asus routers to communicate.

Everything we use in the system is open-source and available in various libraries.

For the linked project we chose to have an Arduino on the operator side for portability, but this isn't necessary. We typically build these setups with just a laptop on the driver side.

In the very near future this system will be available in a low-cost consumer ready package. It's very cool and very open.
__________________
Anthony Lapp
FIRST Engineering Mentor
Owner/Operator 221 Robotic Systems
221 Robotics Systems - Quality Hardware, Made in the USA
RobotOpen
anthony@221robotics.com
Twitter us: @221RobotSystems
Team 1 --> 94 --> 68 --> 221 --> 857 --> 27 --> 118
Design Engineer/Fabricator and 17 year vet
Team Rush (FRC27) and Robonauts (FRC118)
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:29 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi