Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   FRC Control System (http://www.chiefdelphi.com/forums/forumdisplay.php?f=176)
-   -   Driver Station Usb (http://www.chiefdelphi.com/forums/showthread.php?t=77903)

EricVanWyk 23-07-2009 09:51

Re: Driver Station Usb
 
One option would be to use the analog inputs - you might be able to produce two voltages proportional to the X and Y axis on the screen.

My favorite method is still to pretend to be a USB joystick.

Quote:

Originally Posted by RyanCahoon (Post 867572)
Ok cool.
Seeing as your joysticks will be drawing some power as well, I'd say you'd be safe with 1700mA. But yes, I would suggest ganging several of the power connectors if you're going to be drawing that kind of current. Just to be safe ;)

Note, however, that the wall wart supplied in the KoP is only rated for 1000mA, so you'll have to make other arrangements to supply the needed power while developing the system.

--Ryan

The wallwart supplies 1000mA@12V. This is enough power to create 2000mA@5V using a switching regulator. Perfect Linear regulators are current in = current out. Perfect Switching regulators are power in = power out. Reality doesn't match ideal: (most) Linear regulators will draw a little extra current, and typical switching regulators are ~90% efficient.

The actual pins on the DS can safely handle 1 Amp each, so 2 should be fine.

biojae 23-07-2009 19:58

Re: Driver Station Usb
 
Quote:

Originally Posted by EricVanWyk (Post 867597)
One option would be to use the analog inputs - you might be able to produce two voltages proportional to the X and Y axis on the screen.

Yeah, thats what i was thinking of doing,
take 3 analog pins
1 X
2 Y
3 Point #
and update per point on screen

Quote:

Originally Posted by EricVanWyk (Post 867597)
My favorite method is still to pretend to be a USB joystick.

Yes, that would be very cool, but i'm not sure if theres enough memory on the atmega 168 for that (the screen + usb is almost all the available memory and ram)

Quote:

Originally Posted by EricVanWyk (Post 867597)
The wallwart supplies 1000mA@12V. This is enough power to create 2000mA@5V using a switching regulator. Perfect Linear regulators are current in = current out. Perfect Switching regulators are power in = power out. Reality doesn't match ideal: (most) Linear regulators will draw a little extra current, and typical switching regulators are ~90% efficient.

The actual pins on the DS can safely handle 1 Amp each, so 2 should be fine.

How much power does the competition port provide in a competition?

Schnabel 24-07-2009 00:22

Re: Driver Station Usb
 
****PLEASE NOTE: I have very little experience programming, so what I am about to say may not work, it is just an idea.****

I was just thinking, if you really want a touchscreen device, use an iPod touch or iPhone. With the release of OS 3.0, Apple opened up the possibility of utilizing the usb connector for outside devices. Maybe you could build a program for the iPod/iPhone to emulate a HID and get it to connect to the DS.

biojae 24-07-2009 01:07

Re: Driver Station Usb
 
Quote:

Originally Posted by Schnabel (Post 867681)
****PLEASE NOTE: I have very little experience programming, so what I am about to say may not work, it is just an idea.****

I was just thinking, if you really want a touchscreen device, use an iPod touch or iPhone. With the release of OS 3.0, Apple opened up the possibility of utilizing the usb connector for outside devices. Maybe you could build a program for the iPod/iPhone to emulate a HID and get it to connect to the DS.

The referees may not allow it due to the many types of wireless communication that it can do (wifi, bluetooth, cell phone) and i don't know if its a usb host, if its not a HID implementation my not be possible

biojae 24-07-2009 02:02

Re: Driver Station Usb
 
While i wait for everything to arrive (Slowwww mail :mad: ), i have almost finalized how its going to work (Ethernet pending)

3 Analog inputs on the driver station,
#1 X input 100 points of resolution (Have to account for Electrical noise)
#2 Y input 100 points
#3 Point # 50 points (To reduce waypoint navigation math)
1 digital in
#1 to signify point # change
1 Digital out
#1 To signify robot received point

1 digital potentiometer to the arduino and driver station

liquidware touchshield slide to arduino to digital potentiometer

RyanCahoon 24-07-2009 06:35

Re: Driver Station Usb
 
Quote:

Originally Posted by EricVanWyk (Post 867597)
The wallwart supplies 1000mA@12V. This is enough power to create 2000mA@5V using a switching regulator..

Thanks for the correction. I was assuming that they used linear regulators.

Quote:

Originally Posted by biojae (Post 867689)
3 Analog inputs on the driver station,
#1 X input 100 points of resolution (Have to account for Electrical noise)
#2 Y input 100 points
#3 Point # 50 points (To reduce waypoint navigation math)
1 digital in
#1 to signify point # change
1 Digital out
#1 To signify robot received point

Looks good. One suggestion might be to treat digital input as a "valid data" input instead of your current usage. My thought was since the point number input will already be changing (5 ticks difference between point numbers should be distinguishable), you don't really need to inform the robot that the data has changed, but using a valid data bit would handle the case where the DS's inputs get sampled while arduino/digital potentiometer is in the process of changing its outputs. So your update process would go like this:

Code:

set valid data bit to 0
update arduino's outputs
wait a couple milliseconds to give the digital potentiometer time to settle
set valid data bit to 1
wait for data received bit to change

then on the robot

Code:

if valid data pin is 1:
        update x and y coordinates of point
        flip data received bit

--Ryan

biojae 24-07-2009 17:11

Re: Driver Station Usb
 
Quote:

Originally Posted by RyanCahoon (Post 867694)
Thanks for the correction. I was assuming that they used linear regulators.



Looks good. One suggestion might be to treat digital input as a "valid data" input instead of your current usage. My thought was since the point number input will already be changing (5 ticks difference between point numbers should be distinguishable), you don't really need to inform the robot that the data has changed, but using a valid data bit would handle the case where the DS's inputs get sampled while arduino/digital potentiometer is in the process of changing its outputs. So your update process would go like this:

Code:

set valid data bit to 0
update arduino's outputs
wait a couple milliseconds to give the digital potentiometer time to settle
set valid data bit to 1
wait for data received bit to change

then on the robot

Code:

if valid data pin is 1:
        update x and y coordinates of point
        flip data received bit

--Ryan

So something like this on the robot side
Code:

bool DsPoints[100][100];
int validDataPin = 0;
int stopPin = 1;
int recievedPin = 0;
bool stop = false;

void DisabledPeriodic(void)  {
if(ds->GetDigitalIn(validDataPin) && !stop)
{
    int X = (int) ((float)ds->GetAnalogIn(0)/10.24); // 0 - 100
    int Y = (int) ((float)ds->GetAnalogIn(1)/10.24); // 0 - 100
    int pointNum = (int) ((float)ds->GetAnalogIn(2)/20.48); // 0 - 50
    if(pointNum == 50 || ds->GetDigitalIn(stopPin)) stop  = true; // Max 50
    DsPoints[X][Y] = true;
    ds->SetDigitalOut(recievedPin, true);
}
if(stop) calculateRoute();
}

though the highest resolution digi pot i can find is 256 step

EricVanWyk 24-07-2009 18:59

Re: Driver Station Usb
 
Quote:

Originally Posted by biojae (Post 867752)
though the highest resolution digi pot i can find is 256 step

I'm not a big fan of using digital pots in this manner. You could use a Digital to Analog Converter (DAC), or you could duty cycle modulate one of your arduino's pins and follow it with an RC filter.

EDIT: If you do want to use a higher resolution digital pot, the AD5292 has 1024 steps. Still, digital pots aren't designed for this type of use.

biojae 24-07-2009 19:34

Re: Driver Station Usb
 
Quote:

Originally Posted by EricVanWyk (Post 867763)
I'm not a big fan of using digital pots in this manner. You could use a Digital to Analog Converter (DAC), or you could duty cycle modulate one of your arduino's pins and follow it with an RC filter.

EDIT: If you do want to use a higher resolution digital pot, the AD5292 has 1024 steps. Still, digital pots aren't designed for this type of use.

What values of R and C would i need on the low pass filter for PWM?

EricVanWyk 24-07-2009 19:54

Re: Driver Station Usb
 
Quote:

Originally Posted by biojae (Post 867765)
What values of R and C would i need on the low pass filter for PWM?

Good question!

Your update rate is 50Hz (times per second), so you want to be sure that you can change at least that quick. Lets target 100-200 Hz for our filter.

An RC filter's cutoff frequency is 1/ (2 * pi * R * C) . Play with this calculator http://www.muzique.com/schem/filter.htm to find good values. The default 10k and 0.1uF would probably work well. *

This places the filter at about 160Hz. Make sure your DCM** signal is significantly quicker than that (2kHz? faster?) and you should be good to go!


* If you double R, you can cut C in half. So, how do you choose a value? Basically, pick what you can get, and don't let R get too big (over 100k).

** People often say PWM (Pulse Width Modulated) when they mean DCM (Duty Cycle Modulated). I make sure my students know which one they really care about - do they care how long the pulse is, or do they care about the duty cycle? Put more clearly, if your base frequency changes what needs to stay the same?

biojae 25-07-2009 01:37

Re: Driver Station Usb
 
i have a large supply of resistors, but can only find 10 uf capacitors and larger

RyanCahoon 25-07-2009 05:35

Re: Driver Station Usb
 
Quote:

Originally Posted by biojae (Post 867752)
So something like this on the robot side
Code:

bool DsPoints[100][100];
int validDataPin = 0;
int stopPin = 1;
int recievedPin = 0;
bool stop = false;

void DisabledPeriodic(void)  {
if(ds->GetDigitalIn(validDataPin) && !stop)
{
    int X = (int) ((float)ds->GetAnalogIn(0)/10.24); // 0 - 100
    int Y = (int) ((float)ds->GetAnalogIn(1)/10.24); // 0 - 100
    int pointNum = (int) ((float)ds->GetAnalogIn(2)/20.48); // 0 - 50
    if(pointNum == 50 || ds->GetDigitalIn(stopPin)) stop  = true; // Max 50
    DsPoints[X][Y] = true;
    ds->SetDigitalOut(recievedPin, true);
}
if(stop) calculateRoute();
}


Pretty much, except if you notice, there's nothing that ever causes the receivedPin to change from true, so I'd suggest something like
Code:

ds->setDigitalOut(receivedPin, !ds->GetDigitalOut(receivedPin));
You also might want to consider not stopping the update process after point 50, but instead allowing it to start over from the beginning again, which would allow last minute changes to the autonomous strategy if necessary, and also in case for some reason one of the points got skipped the first time through.

--Ryan

biojae 25-07-2009 16:13

Re: Driver Station Usb
 
well i forgot that part, the hard part is going to be in calculateRoute though :rolleyes:

biojae 03-08-2009 20:39

Re: Driver Station Usb
 
well i got the digital pots in the mail today (couldn't get low pass to work properly). first try on the arduino and it works! They are 10k 256 step pots
(Maxim ds1803).
waiting for the screen now.

RyanCahoon 04-08-2009 00:05

Re: Driver Station Usb
 
Awesome! Let us know how the rest goes.

--Ryan


All times are GMT -5. The time now is 02:41.

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